Skip to content

Automatic xsd:any resolution#389

Merged
eed3si9n merged 4 commits into
eed3si9n:masterfrom
anatoliykmetyuk:xsd-any-resolution
Aug 16, 2016
Merged

Automatic xsd:any resolution#389
eed3si9n merged 4 commits into
eed3si9n:masterfrom
anatoliykmetyuk:xsd-any-resolution

Conversation

@anatoliykmetyuk
Copy link
Copy Markdown
Contributor

I have slightly changed the solution for this, so that to avoid a dependency between scalaxb.scala and protocol.scala. Now the function to handle non-default cases is passed by the means of implicits rather than the direct access to the protocol.

From my previous PR:

Automatic resolution of xsd:any

Consider the following snippet from dml-main.xsd, which is a part of OpenOffice schemata:

  <xsd:complexType name="CT_GraphicalObjectData">
    <xsd:sequence>
      <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="strict"/>
    </xsd:sequence>
    <xsd:attribute name="uri" type="xsd:token" use="required"/>
  </xsd:complexType>

In a pptx presentation slide, a XML tree that represents a table goes in place of xsd:any, for example:

<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
  <a:tbl>
  ...
  </a:tbl>
</a:graphicData>

a:graphicData is CT_GraphicalObjectData.
Apparently, not only the CT_Table can be used there, hence xsd:any, but often the CT_Table, or a:tbl is of interest.

The problem is, ScalaXB stores xsd:any as bare scala.xml.Elem, wrapped into scalaxb.DataRecord[Any]. Perhaps this is because xsd:any doesn't carry any type information, so ScalaXB doesn't know what to bind the element to.

However, there is a way to know for sure that <a:tbl> is a CT_Table, since it is declared in the schema:

  <xsd:element name="tbl" type="CT_Table"/>

@eed3si9n eed3si9n merged commit 108d65c into eed3si9n:master Aug 16, 2016
@anatoliykmetyuk anatoliykmetyuk deleted the xsd-any-resolution branch August 16, 2016 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants