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]
Re: [xml-dev] Foreign attributes in XML Schemas – a stroke of pure genius!

This is not news, Roger.  Many schemas provide
for annotation using foreign attributes and
elements.  Many do so because people already know that it is helpful.

Being able to use namespaces to do so is, I
think, one of the big wins with namespaces.  No
chance to confused an annotation attribute from a native attribute.

In the US intelligence community publishing
system
(http://www.cranesoftwrights.com/links/ipepaper.htm)
and New Zealand legislation publishing system I
annotate the XSL-FO instances with my own foreign
attributes that are used as clues when
transforming the XSL-FO to HTML for browser
presentation.  This design pattern promotes the
fidelity between renderings because the HTML
rendering isn't from the original XML, it is from
the XSL-FO already processed from interpreting
the semantics of the XML.  No need to keep
parallel transformations in sync as the HTML is
produced serially from the XSL-FO.

And it is made possible because XSL-FO is
tolerant of foreign content, and XSLT simply
accesses this foreign content when creating HTML from XSL-FO.

. . . . . . . Ken

At 2016-06-13 18:05 +0000, Costello, Roger L. 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








--
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Streaming hands-on XSLT/XPath 2 training @US$45: http://goo.gl/Dd9qBK |
Crane Softwrights Ltd. _ _ _ _ _ _ http://www.CraneSoftwrights.com/x/ |
G Ken Holman _ _ _ _ _ _ _ _ _ _ mailto:gkholman@CraneSoftwrights.com |
Google+ blog _ _ _ _ _ http://plus.google.com/+GKenHolman-Crane/posts |
Legal business disclaimers: _ _ http://www.CraneSoftwrights.com/legal |


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



[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