|
next
|
Subject: Unwanted blanks in XML schema / XSD to XML conversion (padding) Author: Bruno F Date: 10 Jan 2006 05:19 AM
|
*rofl*
sounds good... especially because I just came across a couple of issues on which I would greatly appreciate your opinion.
I'm still concerned with the "XML Schema to XML"-Functionality.
Issues:
- Generated XML is not valid when mutliple facets apply (esp. a regular expression pattern and minInclusive/maxInclusive)
- Generated XML depends on the order of restriction facets (below cases put the pattern first and last, respectively)
- Number padding is not working for these cases (minor issue).
I am currently working on a project where we have to deal with a large amount of complex schemata featuring stuff like you see below. I need to regularly create XML instances...
Here are XSD Samples and XML generated by StylusStudio. Both are reported invalid by StylusStudio.
Sample XSD 1:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="Schemas/Typ9002/1.0" elementFormDefault="qualified" targetNamespace="Schemas/Typ9002/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Type">
<xs:complexType>
<xs:sequence>
<xs:element name="StandardData">
<xs:complexType>
<xs:sequence>
<xs:element name="A">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,16}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="18" />
<xs:maxInclusive value="1000000000000000" />
<xs:minInclusive value="-1000000000000000" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="B">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,16}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="18" />
<xs:maxInclusive value="10000000000000000" />
<xs:minInclusive value="-10000000000000000" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="C">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,9}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="11" />
<xs:maxInclusive value="999999.99" />
<xs:minInclusive value="0.01" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="D">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,9}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="11" />
<xs:maxInclusive value="9999.99" />
<xs:minInclusive value="0" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="E">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,9}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="11" />
<xs:maxInclusive value="999999999.99" />
<xs:minInclusive value="-999999999.99" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="F">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="36" />
<xs:maxLength value="36" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="G">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="978" />
<xs:enumeration value="000" />
<xs:enumeration value="978" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Generated XML 1:
<?xml version="1.0"?>
<p1:Type xmlns:p1="Schemas/Typ9002/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="Schemas/Typ9002/1.0 file:///c:/AUTOMATION/VerarbeitungsSet/_issues/Issues.xsd">
<p1:StandardData>
<p1:A>-1000000000000000</p1:A>
<p1:B>-10000000000000000</p1:B>
<p1:C>0.01</p1:C>
<p1:D>0</p1:D>
<p1:E>-999999999.99</p1:E>
<p1:F>stringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p1:F>
<p1:G>978</p1:G>
</p1:StandardData>
</p1:Type>
Sample XSD 2:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="Schemas/Typ9002/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="Schemas/Typ9002/1.0" elementFormDefault="qualified">
<xs:element name="Type">
<xs:complexType>
<xs:sequence>
<xs:element name="StandardData">
<xs:complexType>
<xs:sequence>
<xs:element name="A">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="18"/>
<xs:maxInclusive value="1000000000000000"/>
<xs:minInclusive value="-1000000000000000"/>
<xs:pattern value="(-)?\d{1,16}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="B">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="18"/>
<xs:maxInclusive value="10000000000000000"/>
<xs:minInclusive value="-10000000000000000"/>
<xs:pattern value="(-)?\d{1,16}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="C">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="11"/>
<xs:maxInclusive value="999999.99"/>
<xs:minInclusive value="0.01"/>
<xs:pattern value="(-)?\d{1,9}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="D">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="11"/>
<xs:maxInclusive value="9999.99"/>
<xs:minInclusive value="0"/>
<xs:pattern value="(-)?\d{1,9}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="E">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="11"/>
<xs:maxInclusive value="999999999.99"/>
<xs:minInclusive value="-999999999.99"/>
<xs:pattern value="(-)?\d{1,9}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="F">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="36"/>
<xs:maxLength value="36"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="G" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="978"/>
<xs:enumeration value="000"/>
<xs:enumeration value="978"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Generated XML 2:
<?xml version="1.0"?>
<p1:Type xmlns:p1="Schemas/Typ9002/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="Schemas/Typ9002/1.0 file:///c:/AUTOMATION/VerarbeitungsSet/_issues/Issues_2.xsd">
<p1:StandardData>
<p1:A>-1.23</p1:A>
<p1:B>-1.23</p1:B>
<p1:C>-1.23</p1:C>
<p1:D>-1.23</p1:D>
<p1:E>-1.23</p1:E>
<p1:F>stringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p1:F>
<p1:G>978</p1:G>
</p1:StandardData>
</p1:Type>
|
|
|
|