case class Address(name: Option[scalaxb.DataRecord[Any]] = None,
street: String,
city: String) extends Addressable
But when I omit name in the XML file and call as following:
object testXmlFormat extends App {
val subject: Elem = <shipTo xmlns="http://www.example.com/IPO">
<street>1537 Paper Street</street>
<city>Wilmington</city>
</shipTo>
val shipTo: Address = scalaxb.fromXML[Address](subject)
println(shipTo)
}
It shows the strange errors:
Exception in thread "main" scalaxb.ParserFailure: Error while parsing <shipTo xmlns="http://www.example.com/IPO">
<street>1537 Paper Street</street>
<city>Wilmington</city>
</shipTo>: parser error "'{http://www.example.com/IPO}street' expected but {http://www.example.com/IPO}city found" while parsing /{http://www.example.com/IPO}shipTo/{http://www.example.com/IPO}street{http://www.example.com/IPO}city
^
at scalaxb.package$.fromXML(scalaxb.scala:19)
at obp.testXmlFormat$.delayedEndpoint$obp$testXmlFormat$1(testXmlFormat.scala:16)
at obp.testXmlFormat$delayedInit$body.apply(testXmlFormat.scala:7)
at scala.Function0.apply$mcV$sp(Function0.scala:39)
at scala.Function0.apply$mcV$sp$(Function0.scala:39)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
at scala.App.$anonfun$main$1$adapted(App.scala:80)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.App.main(App.scala:80)
at scala.App.main$(App.scala:78)
at obp.testXmlFormat$.main(testXmlFormat.scala:7)
at obp.testXmlFormat.main(testXmlFormat.scala)
usaddress.xsd :
--> mvn generate-sources (scalaxb-maven-plugin, version= 1.8.1, scala.version = 2.12.10)
But when I omit
name
in the XML file and call as following:It shows the strange errors: