[oXygen-user] XSD 1.1 XML Page Generation

Robert Leif
Sun Jul 3 12:27:19 CDT 2011


To: Radu Coravu  and oXygen User ML


Study Subject


The use of the openContent element in the schema below was part of trying to
determine how XHTML5 and XML could work together. If the XSD 1.1 openContent
element were usable in XML and  XHTML5, it would aid the development of
combined implementations.

 


Bug: XSD 1.1 openContent mode="interleave in XML Page


Unfortunately, the XML page that was generated by an XSD1.1 schema shown
below was incorrect. 

The schema below, which includes an openContent element successfully
validated 

“SystemID: D:\XML\Schema\Schema1_1\interleave\books.xsd

Main validation file: D:\XML\Schema\Schema1_1\interleave\books.xsd

Engine name: Saxon-EE 9.3.0.5

Severity: info

Description: Validation successful. 

<?xml version="1.0" encoding="UTF-8"?>”

 

The test case is based upon slides 266 and 217 of XML Schema 1.1 by Roger L.
Costello, (http://www.xfront.com) dated 24 March 2011. Slide 217 is a
complete XML page.

        http://www.xfront.com/files/tutorials.html

Then pressing xml schema 1.1. This is followed by going “XML Schema 1.1
Tutorial”

And then going to the hyperlink labeled

Here is the tutorial: XML Schema 1.1 (PowerPoint document). It appears that
there are at least two versions with different dates and slide numbers of
this PowerPoint presentation that can be found with a Google search.

 

XSD1.1 Schema

 

</xs:schema> <?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.books.org" xmlns="http://www.books.org"
    elementFormDefault="qualified">
    <xs:element name="Book">
        <xs:complexType>
            <xs:openContent mode="interleave">
                <xs:any namespace="http://www.r.org"
processContents="strict"/>
            </xs:openContent>
            <xs:sequence>
                <xs:element name="Title" type="xs:string"/>
                <xs:element name="Author" type="xs:string"/>
               <xs:element name="Date" type="xs:string"/>
                <xs:element name="ISBN" type="xs:string"/>
                <xs:element name="Publisher" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

 

When I attempted to use Tools.Generate XML schema, I received the following
error message.

Description: cid:

I ignored the error and generated:

<?xml version="1.0" encoding="UTF-8"?>

<Book xmlns="http://www.books.org"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.books.org
file:/D:/XML/Schema/Schema1_1/interleave/books.xsd
<http://www.books.org%20file:/D:/XML/Schema/Schema1_1/interleave/books.xsd>
">

</Book>

If I comment out 

<!--xs:openContent mode="interleave">
                <xs:any namespace="http://www.r.org"
processContents="strict"/>
      </xs:openContent-->
I was able to generate:

<?xml version="1.0" encoding="UTF-8"?>
<Book xmlns="http://www.books.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.books.org
file:/D:/XML/Schema/Schema1_1/interleave/books.xsd">
    <Title>Title0</Title>
    <Author>Author0</Author>
    <Date>Date0</Date>
    <ISBN>ISBN0</ISBN>
    <Publisher>Publisher0</Publisher>
</Book>

The result with the above XML page was: 

SystemID: D:\XML\Schema\Schema1_1\interleave\book_XSD_1.xml

Main validation file: D:\XML\Schema\Schema1_1\interleave\book_XSD_1.xml

Engine name: Saxon-EE 9.3.0.5

Severity: info

Description: Validation successful.

I created an r.xsd schema based on the XML page shown in :

The comments in r.xsd (below) are the values shown in the XML page I
separate type definitions by a stylized comment <!—xxxxxxxxxxxxà

 

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.r.org" xmlns="http://www.r.org"
    elementFormDefault="qualified">
    <xs:element name="Binding" type="Binding_Type"/>
    <xs:simpleType name="Binding_Type">
        <xs:restriction base="xs:token">
            <xs:enumeration value="Hardcover"/>
            <xs:enumeration value="Soft"/>
        </xs:restriction>
    </xs:simpleType>

    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--r:Binding>Hardcover</r:Binding-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <xs:simpleType name="Category_Type">
        <xs:restriction base="xs:token">
            <xs:enumeration value="Non-fiction"/>
            <xs:enumeration value="Fiction"/>
        </xs:restriction>
    </xs:simpleType>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <xs:element name="Size" type="xs:int"/>
    <!--r:Size>5 x 7</r:Size -->
    <xs:element name="InStock" type="xs:boolean"/>
    <!--r:InStock>true</r:InStock-->
    <xs:element name="Category" type="Category_Type"/>
    <!--r:Category>Non-fiction</r:Category -->
    <xs:element name="NumPages" type="xs:int"/>
    <!--r:NumPages>299</r:NumPages-->
    <xs:element name="AvailableOnTape" type="xs:boolean"/>
    <!--r:AvailableOnTape>false</r:AvailableOnTape-->
</xs:schema>
----------------------------------------------------------------

Test XML page that includes one element (<r:Size>5 x 7</r:Size>) from the
schema (r.xsd) that contains the interleaved elements

<?xml version="1.0" encoding="UTF-8"?>
<Book xmlns="http://www.books.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:r="http://www.r.org"
xsi:schemaLocation="http://www.books.org
file:/D:/XML/Schema/Schema1_1/interleave/books.xsd"> 
  <!--r:Binding>Hardcover</r:Binding-->
  <Title>My Life and Times</Title> 
  <r:Size>5 x 7</r:Size>
  <Author>Paul McCartney</Author>     
  <!--r:InStock>true</r:InStock-->
  <Date>1998</Date> 
  <!--r:Category>Non-fiction</r:Category-->
  <ISBN>1-56592-235-2</ISBN> 
  <!--r:NumPages>299</r:NumPages-->
  <Publisher>McMillin Publishing</Publisher>
  <!--r:AvailableOnTape>false</r:AvailableOnTape--> 
</Book>

“Validating this XML page resulted in

SystemID: D:\XML\Schema\Schema1_1\interleave\book_Inter1.xml

Main validation file: D:\XML\Schema\Schema1_1\interleave\book_Inter1.xml

Engine name: Saxon-EE 9.3.0.5

Severity: error

Description: In content of element <Book>: The content model does not allow
element <r:Size> to appear here. Expected: {http://www.books.org}Author

Start location: 8:11

 

SystemID: D:\XML\Schema\Schema1_1\interleave\book_Inter1.xml

Main validation file: D:\XML\Schema\Schema1_1\interleave\book_Inter1.xml

Engine name: Saxon-EE 9.3.0.5

Severity: fatal

Description: One or more validation errors were reported

Start location: 17:8. 

However, the web page was well formed.”

Thank you.

Bob Leif

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20110703/f090a42c/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 16047 bytes
Desc: not available
Url : http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20110703/f090a42c/attachment.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Interleave_XML_Page_Generation.jpg
Type: image/jpeg
Size: 16047 bytes
Desc: not available
Url : http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20110703/f090a42c/attachment.jpg 


More information about the oXygen-user mailing list