C
Chip Grandits
I am new to XML and my background is not as a web developer or network
services application.
I am investigating whether XML technologies would be appropriate for
managing configurations of a federation of simulations in aerospace.
Validation of configuration is a major factor that would make me
consider adopting XML based technology. Therefore I have gained basic
knowledge of XML and XML Schemata as implemented in XSD files.
I am trying to understand who supplies tools that validates XML
against schema. The Visual Studio editor seems to do a pretty good
job. But when I move on to the idea of creating uniqueness
requirements (but not global to the whole document) then I can't find
out who to go to.
The example below is, in my belief, a very simple and very contrived
to demonstrate a uniqueness requirement in an XSD file, followed by a
document that violates that requirement. I simply copied the XSD file
for a book, although I created the XML file. Yet none of the tools I
have tried indicates an error. Perhaps I don't understand how XML
validation is suppose to work. Is it simply the developers
responsibility to implement the software to do the validation? It
seems like the whole point of a global standard is so that software
tool vendors could implement the validation and individual developers
who followed the XML could rely on those tools? Perhaps I don't
understand the "business model" behind XML? Perhaps I just don't
understand how the unique element works?
Perhaps I need to pay for a special high priced tool? Can anyone
recommend a source or vendor for such a tool?
(I tried going to various websites which claim to do validation of XML
against a user supplied XSD, but I just get namespace oriented errors
that I don't get through Visual Studio or XML Notepad)
Any assistance or even just leads are greatly appreciated.
Thank You,
Chip Grandits
Advanced Technology Associates.
<xs:schema targetNamespace="http://tempuri.org/myschema/unique"
elementFormDefault="qualified"
xmlns="http://tempuri.org/myschema/unique"
xmlns:mstns="http://tempuri.org/myschema/unique"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="customerOrderType">
<xs:sequence>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="itemID" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="CustomerID" type="xs:string"/>
</xs:complexType>
<xs:element name="ordersByCustomer">
<xs:complexType>
<xs:sequence>
<xs:element name="customerOrders" type="customerOrderType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="oneCustomerOrdersforEachCustomerID">
<xs:selector xpath="mstns:customerOrders"/>
<xs:field xpath="@customerID"/>
</xs:unique>
</xs:element>
</xs:schema>
Now below is a very simple XML instance document that I believe
violates the requirement that Customer IDs be unique for the
CustomerOrders children of the ordersByCustomer element.
<?xml version="1.0" encoding="utf-8"?>
<ordersByCustomer xmlns="http://tempuri.org/myschema/unique">
<customerOrders CustomerID="1">
<item itemID="442"/>
<item itemID="443"/>
</customerOrders>
<customerOrders CustomerID="2">
<item itemID="444"/>
<item itemID="252"/>
</customerOrders>
<!-- DELIBERATE VIOLATION? repeating CustomerID-->
<customerOrders CustomerID="1">
<item itemID="282"/>
<item itemID="114"/>
</customerOrders>
</ordersByCustomer>
But I must confess I can't really tell where the accountability lies.
I don't mean legal accountability. But in comparison for C/C++ there
is a standard and various vendors and open source organization claim
to write a compiler to a standard.
services application.
I am investigating whether XML technologies would be appropriate for
managing configurations of a federation of simulations in aerospace.
Validation of configuration is a major factor that would make me
consider adopting XML based technology. Therefore I have gained basic
knowledge of XML and XML Schemata as implemented in XSD files.
I am trying to understand who supplies tools that validates XML
against schema. The Visual Studio editor seems to do a pretty good
job. But when I move on to the idea of creating uniqueness
requirements (but not global to the whole document) then I can't find
out who to go to.
The example below is, in my belief, a very simple and very contrived
to demonstrate a uniqueness requirement in an XSD file, followed by a
document that violates that requirement. I simply copied the XSD file
for a book, although I created the XML file. Yet none of the tools I
have tried indicates an error. Perhaps I don't understand how XML
validation is suppose to work. Is it simply the developers
responsibility to implement the software to do the validation? It
seems like the whole point of a global standard is so that software
tool vendors could implement the validation and individual developers
who followed the XML could rely on those tools? Perhaps I don't
understand the "business model" behind XML? Perhaps I just don't
understand how the unique element works?
Perhaps I need to pay for a special high priced tool? Can anyone
recommend a source or vendor for such a tool?
(I tried going to various websites which claim to do validation of XML
against a user supplied XSD, but I just get namespace oriented errors
that I don't get through Visual Studio or XML Notepad)
Any assistance or even just leads are greatly appreciated.
Thank You,
Chip Grandits
Advanced Technology Associates.
<xs:schema targetNamespace="http://tempuri.org/myschema/unique"
elementFormDefault="qualified"
xmlns="http://tempuri.org/myschema/unique"
xmlns:mstns="http://tempuri.org/myschema/unique"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="customerOrderType">
<xs:sequence>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="itemID" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="CustomerID" type="xs:string"/>
</xs:complexType>
<xs:element name="ordersByCustomer">
<xs:complexType>
<xs:sequence>
<xs:element name="customerOrders" type="customerOrderType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="oneCustomerOrdersforEachCustomerID">
<xs:selector xpath="mstns:customerOrders"/>
<xs:field xpath="@customerID"/>
</xs:unique>
</xs:element>
</xs:schema>
Now below is a very simple XML instance document that I believe
violates the requirement that Customer IDs be unique for the
CustomerOrders children of the ordersByCustomer element.
<?xml version="1.0" encoding="utf-8"?>
<ordersByCustomer xmlns="http://tempuri.org/myschema/unique">
<customerOrders CustomerID="1">
<item itemID="442"/>
<item itemID="443"/>
</customerOrders>
<customerOrders CustomerID="2">
<item itemID="444"/>
<item itemID="252"/>
</customerOrders>
<!-- DELIBERATE VIOLATION? repeating CustomerID-->
<customerOrders CustomerID="1">
<item itemID="282"/>
<item itemID="114"/>
</customerOrders>
</ordersByCustomer>
But I must confess I can't really tell where the accountability lies.
I don't mean legal accountability. But in comparison for C/C++ there
is a standard and various vendors and open source organization claim
to write a compiler to a standard.