xsl-list
[Top] [All Lists]

Help needed in XSD

2005-07-18 04:02:47

Hi,
I have an xml file and XSD file. For example consider the following xml and
xsd files.
In the XSD file, I mentioned the sequence of elements to appear in the XML.
But what I need
is, if they are not in the specified sequence in the xml file, the xml
should be modified to place them in order.
For this, do I need to write XSLT or we can acheive it using XSD only.
Please give the code whther in XSLT or XSD.

XML file
 <Exception>
      <Type>X</Type>
      <Location><![CDATA[Right/Door Front]]></Location>
      <Description>Dings No Paint Damage, PDR</Description>
      <ChargeableFlag>0</ChargeableFlag>
      <PaintHours>0.0</PaintHours>
      <PartCost>50.0</PartCost>
      <RepairHours>0.0</RepairHours>
      <Total>50.0</Total>
 </Exception>

XSD file

<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
        <xs:element name="Exception">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="Type" type="xs:string"/>
                                <xs:element name="Description" 
type="xs:string"/>
                                <xs:element name="ChargeableFlag" 
type="xs:boolean"/>
                                <xs:element name="FrameHours" type="xs:decimal" 
minOccurs="0"/>
                                <xs:element name="PaintHours" type="xs:decimal" 
minOccurs="0"/>
                                <xs:element name="PartCost" type="xs:decimal" 
minOccurs="0"/>
                                <xs:element name="MetalHours" type="xs:decimal" 
minOccurs="0"/>
                                <xs:element name="RepairHours" 
type="xs:decimal" minOccurs="0"/>
                                <xs:element name="Total" type="xs:decimal"/>
                                <xs:element name="Location" type="xs:string"/>
                                <xs:element name="ExceptionImage" minOccurs="0" 
maxOccurs="5">
                                        <xs:complexType>
                                                <xs:all>
                                                        <xs:element 
name="FileName" type="xs:string"/>
                                                </xs:all>
                                        </xs:complexType>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>

Thanks
Laxmi Narayana


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>