XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Foreign attributes in XML Schemas – a stroke of pure genius!

Hi Folks,

When you create an XML Schema you can add any number of non-XML-Schema attributes onto each item in the schema.

These non-xml-schema attributes are called foreign attributes. They are ignored by XML Schema validators. (However, they can be effectively used by other applications.)

Here is an example of an XML Schema that has foreign attributes:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                     xmlns:foo="http://www.example.org"
                     elementFormDefault="qualified">
   
<xs:element name="Book" foo:binding="hardcover">
       
<xs:complexType>
           
<xs:sequence foo:order="strict">
               
<xs:element name="Title" type="xs:string" />
               
<xs:element name="Author" type="xs:string" />
           
</xs:sequence>
       
</xs:complexType>
   
</xs:element>
</xs:schema>

That schema has a foreign attribute, foo:binding, on <xs:element> and a foreign attribute, foo:order, on <xs:sequence>.

The creators of XML Schema had remarkable foresight!

How did the creators of XML Schema know that people would utilize foreign attributes to create entirely new, unforeseen technologies?

Data Format Description Language (DFDL) is a technology that is entirely based on the use of foreign attributes. Here is a portion of a “DFDL Schema”:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                     xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
                     elementFormDefault="qualified">
   
<xs:element name="PNG">
       
<xs:complexType>
           
<xs:sequence>
               
<xs:sequence dfdl:hiddenGroupRef="hiddenFile_SignatureGroup" />
                
<xs:element name="Chunk" maxOccurs="unbounded" dfdl:occursCountKind="implicit">
                   
<xs:complexType>
                       
<xs:choice>
                           
<xs:element ref="IHDR" />
                           
<xs:element ref="IDAT" />
                           
<xs:element ref="IEND" />
                            …

                       
</xs:choice>
                   
</xs:complexType>
               
</xs:element>
           
</xs:sequence>
       
</xs:complexType>
   
</xs:element>
    …

</xs:schema>

Notice the use of the dfdl:hiddenGroupRef and dfdl:occursCountKind foreign attributes.

In case you’re interested, DFDL is a technology for parsing any data format, text or binary. The output of the parser is XML. It’s pretty cool.

/Roger

 

 

 

 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS