New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extending foreign type with optional xs:sequence generates bad code #196

eed3si9n opened this Issue Feb 24, 2013 · 0 comments


None yet
1 participant

eed3si9n commented Feb 24, 2013


  1. prepare a schema in namespace A with a complex type with an optional sequence.
  <xs:complexType name="ForeignBaseType">
    <xs:sequence minOccurs="0">
      <xs:element name="string1" type="xs:string" />
  1. prepare another schema in namespace B with a complex type extending b:ForeignBaseType.
  <xs:complexType name="ForeignExtensionTest">
      <xs:extension base="b:ForeignBaseType">
        <xs:sequence minOccurs="0">
          <xs:element name="person1" type="gen:Person" />
  1. compile them.


  1. it generates a parser that uses wrong fully qualified name for the sequence.
  trait DefaultGeneralForeignExtensionTestFormat extends scalaxb.ElemNameParser[general.ForeignExtensionTest] {
    val targetNamespace: Option[String] = Some("")

    override def typeName: Option[String] = Some("ForeignExtensionTest")

    def parser(node: scala.xml.Node, stack: List[scalaxb.ElemName]): Parser[general.ForeignExtensionTest] =
      phrase(opt(((scalaxb.ElemName(Some(""), "string1"))) ^^ 
        { case p1 => general.ForeignBaseTypableSequence1(scalaxb.fromXML[String](p1, scalaxb.ElemName(node) :: stack)) }) ~ 
      opt(((scalaxb.ElemName(Some(""), "person1"))) ^^ 
        { case p1 => general.ForeignExtensionTestSequence1(scalaxb.fromXML[general.Person](p1, scalaxb.ElemName(node) :: stack)) }) ^^
      { case p1 ~ p2 =>
        p2) })

    def writesChildNodes(__obj: general.ForeignExtensionTest, __scope: scala.xml.NamespaceBinding): Seq[scala.xml.Node] =
      Seq.concat(__obj.foreignbasetypablesequence1 map { scalaxb.toXML[xmlmime.ForeignBaseTypableSequence1](_, None, Some("foreignbasetypablesequence1"), __scope, false) } getOrElse {Nil},
        __obj.foreignextensiontestsequence1 map { scalaxb.toXML[general.ForeignExtensionTestSequence1](_, None, Some("foreignextensiontestsequence1"), __scope, false) } getOrElse {Nil})



the parser correctly uses b.ForeignBaseTypableSequence1.

@eed3si9n eed3si9n closed this in 210cb08 Mar 1, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment