Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 14 06:04
    SethTisue commented #357
  • Sep 13 23:08
    ashawley commented #357
  • Sep 13 23:06
    SethTisue commented #357
  • Sep 13 23:01
    ashawley commented #357
  • Sep 13 22:20
    SethTisue commented #357
  • Sep 13 21:59
    djspiewak commented #357
  • Sep 13 19:28
    lrytz commented #356
  • Sep 13 19:22

    ashawley on master

    Update dotty 0.18.1-RC1 Change… Merge pull request #352 from as… (compare)

  • Sep 13 19:22
    ashawley closed #352
  • Sep 13 19:03
    ashawley synchronize #352
  • Sep 13 19:00

    ashawley on master

    Update sbt to 1.3.0 (compare)

  • Sep 13 19:00
    ashawley closed #353
  • Sep 13 18:58

    ashawley on master

    Temporarily disable Coursier in… Merge pull request #355 from as… (compare)

  • Sep 13 18:58
    ashawley closed #355
  • Sep 13 18:58
    ashawley closed #354
  • Sep 13 18:58
    ashawley commented #356
  • Sep 13 18:50
    ashawley synchronize #355
  • Sep 13 17:04
    ashawley commented #357
  • Sep 13 17:00

    SethTisue on master

    Add Coursier to Travis cache Remove lock files for Coursier … Add Coursier to Circle cache and 1 more (compare)

  • Sep 13 17:00
    SethTisue closed #357
Aaron S. Hawley
@ashawley
By "it works" you mean the scope is added?
Or you mean it parses successfully in scalaxb?
Peter László
@ptrlaszlo
Hi Aaron, By "it works" I meant that it parses successfully in scalaxb
"ORDERNUMBER" is not the root element, it's a child element in the "xml" above in the example
it seems that adding the scope doesn't apply to the child elements
Aaron S. Hawley
@ashawley
Yeah, seems you'll need to traverse the tree and add the scope.
Seth Tisue
@SethTisue
@ashawley what do you make of scala/scala-xml#253 ?
Aaron S. Hawley
@ashawley
Yikes, good catch! All hail the community build!
Nothing obvious, but I'll look in to it.
Aaron S. Hawley
@ashawley
@ptrlaszlo Here's an example of a traversal
object addScope extends scala.xml.transform.RewriteRule {
  override def transform(n: scala.xml.Node): Seq[scala.xml.Node] = n match {
    case elem: scala.xml.Elem =>
      elem.copy(scope = elem.scope.copy(uri = "urn:CollectionResponse", parent = scala.xml.TopScope),
                child = elem.child.map(addScope))
    case n => n
  }
}

val order = <order><ordernumber/></order>

addScope(order)
Peter László
@ptrlaszlo
thanks Aaron!
Marcel Koopman
@marcelkoopman_gitlab
how can i retrieve the xpath of a xml element? I mean the getRelativeXPath or something like that
Aaron S. Hawley
@ashawley
There may have been a Stackoverflow question about that
Here's an answer in Java for all elements
Marcel Koopman
@marcelkoopman_gitlab
i've seen one where the answer was not implemented
Marcel Koopman
@marcelkoopman_gitlab
thx, but i was looking for scala xml solutions
Aaron S. Hawley
@ashawley
Here's a solution using Scala and the Java DOM
Well, scala-xml doesn't come with anything out of the box with this
Aaron S. Hawley
@ashawley
This was similar
Marcel Koopman
@marcelkoopman_gitlab
thx
ethicalbeginner
@nitishram
hi all ,how to parse xml in scala using sax parser?
Seth Tisue
@SethTisue
@nitishram where you are you stuck?
ethicalbeginner
@nitishram
for single xml with one root tag i could take it but for multiple root tags cound't read all
Seth Tisue
@SethTisue
@nitishram showing the code you have so far might help
Brian Kent
@bdkent
Is there a particular reason scala.xml.Utility.serialize works on a StringBuilder rather than something more abstract? As it seems like the only operation used is StringBuilder#append, is there any reason it couldn't be reworked to use something like java.lang.Appendable so that a java.io.Writer could be provided (and the entire XML wouldn't have to exist as a huge string in memory )?
Aaron S. Hawley
@ashawley
Well, althoughscala.xml.Utility.serialize is a published function, it seems that its intended for internal use rather than external. Internally, scala-xml implements a lot of the library on StringBuilder.
You're right, it's not ideal that the entire serialized XML is held in memory.
Aaron S. Hawley
@ashawley
Are you actually using this method directly, or did you run in to memory issues when using other methods?
Brian Kent
@bdkent
Memory issues, yes. I have locally made a version of the serialize method using Appendable and it all seems to work.
Aaron S. Hawley
@ashawley
Cool. I wonder if that improvement could be leveraged in XML.write, generally?
Brian Kent
@bdkent
I don’t see why not.
I used a few implicit classes to limit the actual files that had to change.
aappddeevv
@aappddeevv
Does the latest scala-xml (1.2.0) work with dotty? I'm having a hard time discerning whether what the XML story is with the current RC release of dotty. I saw this but am unsure how it relates.
Aaron S. Hawley
@ashawley
@aappddeevv What are you trying to do?
I'm not aware of any dotty artifacts for scala-xml that have been published, yet.
aappddeevv
@aappddeevv
Simple XML parsing, not creation nor literals. I saw that the scala-xml uses CanBuildFrom which I think is gone in dotty so it started me wondering about what scala.xml might be pulling in and if there are hidden gotchas I should be worried about. Its working in dotty using the scala-xml 2.13 version but I was worried.
Seth Tisue
@SethTisue
Dotty can use Scala 2 binaries, so I would expect it to just work without needing a special artifact to be published for Dotty
CanBuildFrom is already gone in Scala 2.13, so CanBuildFrom isn't a Scala 2 vs 3 difference
at present Dotty still uses the Scala 2.12 stdlib, where CanBuildFrom is still present. but they expect to switch to the 2.13 stdlib quite soon
aappddeevv
@aappddeevv
I just saw that. I'm thinking that once dotty switches to the 2.13 stdlib that this is where there may be a problem unless scala-xml is republished under 2.13--if I read your comment right.
That could happen in as little as 30 days if they keep publishing RC releases each month.
Seth Tisue
@SethTisue
@aappddeevv scala-xml is already published for 2.13
aappddeevv
@aappddeevv
Ah..that's right...I'm getting a transitive dependency that pushes it back to a 2.12 version though for this dotty project. I guess I'll wait and see what happens to that lib and the xml dependency once the dotty stdlib is updated..
Seth Tisue
@SethTisue
:+1:
Aaron S. Hawley
@ashawley
Indeed, seems you need to use the sbt-dotty plugin and 2.12 artifacts to work with dependencies from dotty
I've made some changes to the old scala modules sample repo to show that it works