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]
=?UTF-8?Q?Re=3A_=5Bxml=2Ddev=5D_Foreign_attributes_in_XML_Schemas_=E2=80=93_?==?UTF-8?Q?a_stroke_of_pure_genius=21?=

Hi Roger,

These attributes are not necessarily ignored by schema validators if you consider that an XML Schema is also an XML document.

If you add an xsi:schemaLocation attribute to your XML Schema file and drop the schemas defining your foreign attributes in there, the validator (the one used to validate your schema against the schema schema) will check that attributes declared in these schemas are valid.

Kind regards,
Ghislain


On Mon, Jun 13, 2016 at 8:05 PM, Costello, Roger L. <costello@mitre.org> wrote:

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