[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: defining correctness for an XML transformation - how?

  • From: Thomas Passin <list1@tompassin.net>
  • To: xml-dev@lists.xml.org
  • Date: Wed, 3 Jul 2024 17:55:32 -0400

Re:  defining correctness for an XML transformation - how?
On 7/3/2024 4:43 PM, Roger L Costello wrote:
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?
I don't think I do. You have got the output for an element validating against its target schema. But I don't see where you validate an overall target schema. There could be more to the output than just those converted elements, their order might be different, probably many other possible differences beyond just the converted target elements.



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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.