[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] 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
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]