Questions tagged [scala-xml]

Scala XML is the standard XML library built for Scala.

Scala XML is the standard XML library built for Scala. It provides options for working with XML documents - parsing, processing, building, manipulating and navigating within, and others. Since Scala version 2.11, the Scala XML is a separate, independent library.

63 questions
1
vote
1 answer

scala-xml for Scala 2.13 on Debian and Ubuntu

In order to make them fully JVM 11 compatible, I want to update several Scala scripts on Debian and Ubuntu systems from Scala 2.12.12 to Scala 2.13.3. The first problem I encountered is that the scala-xml jar file is not included anymore. So I tried…
Marcus
  • 1,857
  • 4
  • 22
  • 44
1
vote
2 answers

scala-xml child method from an xml node gets trailling white space

I am actually working on windows and I have to parse xml from a file. The issue is when i parse the root element, and get the children via the child method, I am getting empty children. XML.load("my_path\\sof.xml").child res0: Seq[scala.xml.Node] =…
BlueSheepToken
  • 5,751
  • 3
  • 17
  • 42
1
vote
1 answer

Subsequent RewriteRules don't transform elements added in previous transform

import scala.xml._ import scala.xml.transform.{RewriteRule, RuleTransformer} object TransformIssue { def addNewElement(): RewriteRule = new RewriteRule { override def transform(n: Node): Seq[Node] = n match { case =>…
chim
  • 8,407
  • 3
  • 52
  • 60
1
vote
2 answers

ArrayIndexOutofBoundException In Scala Program Usind VTD-XML

import java.lang._ import com.ximpleware._ object Sample { def main(args :Array[String])= { // println("helloo") try{ var i :Int = -1 val vgen :VTDGen= new VTDGen() …
AnsigT
  • 91
  • 6
1
vote
1 answer

scala - xml transformation using variable and RewriteRule

I'm playing with scala xml transformation and my below program doesn't give me expected output. import scala.xml.{Elem, Node, Text} import scala.xml.transform.{RewriteRule, RuleTransformer} object XmlTransform extends App { val name = "contents" …
Hiren
  • 708
  • 1
  • 7
  • 14
1
vote
0 answers

Customize scala xml interpolation

When I insert arbitrary expressions inside xml literals it seems that result of .toString() is inserted object Foo { override def toString: String = "foo" } println(
{Foo}
) // prints "
foo
" Can I customize that process in a…
Yaroslav
  • 4,543
  • 5
  • 26
  • 36
1
vote
1 answer

Scala XML transformation with Rewrite rules

I have a XML template with some fields predefined in it. I want to build new XML based on it template with new Value values using RewriteRules. ex. template: val template = Persons
1
vote
1 answer

Updating node attribute in Scala XML

I got an xml document that I want to update and I'm looping through the nodes using a recursive function. However I'm having an issue with updating node attributes. I want to hide all the paths from the user and replacing them with a key. This is…
Joseph118
  • 505
  • 6
  • 21
1
vote
1 answer

Why is my scala program not ignoring my xml file's DTD?

I have an XML file that contains the following code
Zee
  • 1,321
  • 2
  • 18
  • 41
1
vote
0 answers

Output XHTML entity references with scala-xml

Using scala.xml.parsing.XhtmlParser I can parse an XHTML document without either losing or having to resolve the entity references against the DTD. However, XhtmlParser appears to do this by internally resolving the entities, such that, for instance…
David Moles
  • 48,006
  • 27
  • 136
  • 235
1
vote
0 answers

Parsing HTML without minimizing elements + Transformation

I am writing a plugin for a web application that takes user provided HTML and transforms it to a different piece of HTML code. I mostly want to find all elements with given class/content ("directives") and rewrite it to something else. I am using…
Karel Horak
  • 1,022
  • 1
  • 8
  • 19
0
votes
1 answer

How to generate case class with annotation using ScalaXB

I am using the ScalaXB plugin to convert XSD files to Scala case classes and it is working fine but is there any way to add javax.xml.bind.annotation with it? The reason I need is to marshal/unmarshal XML to generated classes and I am using JAXB but…
Prabhat Kashyap
  • 139
  • 2
  • 10
0
votes
0 answers

Reading xml from Dataframe column in scala, How to Read non mandatory xml element?

I have a requirement where I need to process a column in a dataframe containing an XML. I am trying to convert the XML column from dataframe into multiple individual columns based on the tags. MyDataframe look like this…
S_Pandey
  • 1
  • 1
0
votes
1 answer

scala.xml.Node reporting non-access

I am currently processing big XML files using Scala 3. I wish every node (XML element) to report automatically if not all their attributes and children were read. I have developed a solution, but feel it's not very elegant and maybe even kind of…
Marcus
  • 1,857
  • 4
  • 22
  • 44
0
votes
1 answer

Suspicious Shadowing by a Type Parameter while defining Scala 3 Type Class

I'm trying to implement some small quality-of-life improvements around an XML parser, basically trying to ape the way Circe looks like for Json parsing in Scala. The idea then would be to come up with a type class definition along these lines type…