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] defining correctness for an XML transformation - how?

Hi Folks,

As I mentioned previously, I need to convert <Airport_Name> to <name>. Here is an example conversion:

<Airport_Name>JOHN F KENNEDY INTL           </Airport_Name>

<name>JOHN F KENNEDY INTL</name>

The value of <name> is identical to the value of <Airport_Name>, except trailing spaces are removed.

The value of <Airport_Name> is a fixed-length field (30 characters). There is an XML Schema for the <Airport_Name> element, here it is:

<xs:element name="Airport_Name">
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:length value="30"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>

The value of <name> is a string up to 50 characters, with trailing spaces removed. There is an XML Schema for the <name> element, here it is:

<xs:element name="name">
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:maxLength value="50"/>
            <xs:whitespace value="collapse"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>

I have a file containing an <Airport_Name> for every airport in the world. The airport names are expressed using ASCII characters.

Suppose I iterate over every <Airport_Name> element in the file, convert its value to the appropriate <name> value, and evaluate the following predicate:

normalize-space(Airport_Name) eq name

Suppose the predicate evaluates to true for every conversion.

Have I verified the correctness of my conversion?

If yes, then the way to verify the correctness of an XML-to-XML conversion is:

  1. Validate the source element against the XML Schema for the source element
  2. Validate the converted target element against the XML Schema for the target element
  3. Create a predicate that the source-target conversion must satisfy and evaluate the predicate
  4. If all predicates return true, then the correctness of the conversion is verified


Do you agree?

/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