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]
XML Schema as a transformation language, rather than a validationlanguage

Hi Folks,

Ordinarily we think of XML Schema as a validation language. But suppose we slightly shift our perspective about what an XML Schema is: an XML Schema isn't a description of validation rules, but rather a description of a transformation. Let's suppose we have a processor that has this perspective: the processor takes as input an XML document and transforms it to the form described by the XML Schema. For example, at the end of this message is an XML Schema which specifies lat/long values with at most 2 digits to the right of the decimal point. Given the XML Schema and this XML document:

<location>
    <latitude>42.366978</latitude>
    <longitude>-71.022362</longitude>
</location>

the processor outputs this document:

<location>
    <latitude>42.36</latitude>
    <longitude>-71.02</longitude>
</location>

Notice that the XML document has been transformed so that lat/long have two digits to the right of the decimal point.

You might reasonably argue:

1. There already exists a transformation language - XSLT - so why have another transformation language?

2. If the input XML document and the XML Schema differ widely, how would the processor transform the input XML document into the form specified by the XML Schema?

Here are my answers:

1. XML Schema is way more declarative than XSLT. Making tweaks to an XML Schema doesn't require programming expertise; changes are quick and inexpensive; this is very appealing to the people that I work with. Making tweaks to an XSLT program requires substantial programming expertise and lots of regression testing; changes are slow and expensive; this is very unappealing to the people that I work with.

2. I think that the kinds of transformations that the processor could do would be limited to things such as reducing precision, fuzzing values, replacing values, appending, substring. That would be sufficient for many applications.

Question: I'm sure that I'm not the only one to have this idea. Have you had this idea of using XML Schema as a transformation language? If yes, have you fleshed out the idea? Perhaps created a processor? Got lessons learned that you can share?  

/Roger

<element name="location">
    <complexType>
        <sequence>
            <element name="latitude">
                <simpleType>
                    <restriction base="decimal">
                        <fractionDigits value="2" />
                    </restriction>
                </simpleType>
            </element>
            <element name="longitude">
                <simpleType>
                    <restriction base="decimal">
                        <fractionDigits value="2" />
                    </restriction>
                </simpleType>
            </element>
        </sequence>
    </complexType>
</element>



[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