XSD from XML with multiple rows
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 1
- Joined: Wed May 11, 2011 12:20 am
XSD from XML with multiple rows
Is there a way to automatically generate XSD from the following XML which includes each row w/FieldName (not including the value attribute):
Currently all I'm getting is the following:
Code: Select all
<SelectResult>
<Document DocumentType="Orders" DocumentKey="100000" Company="Z-Corp">
<Header>
<Row FieldName="Cust No." Value=""/>
<Row FieldName="Order No." Value="2066"/>
<Row FieldName="PO Number" Value="09-31"/>
<Row FieldName="Ship To Address Line 1" Value="EMERALD POINTE GOLF CLUB"/>
<Row FieldName="Ship To Address Line 2" Value="7000 HOLIDAY ROAD"/>
<Row FieldName="Ship To Name" Value="LAKE LANIER ISLAND RESORT"/>
<Row FieldName="Ship To Country" Value="United States of America"/>
<Row FieldName="Ship To City" Value="BUFORD - LAKE LANIER ISLAND"/>
<Row FieldName="Ship To Zip" Value="30518"/>
<Row FieldName="Ship To State" Value="GA"/>
<Row FieldName="Order Total" Value="1723.78"/>
<Row FieldName="Ship Via" Value="TRUCK"/>
<Row FieldName="Terms" Value="1.5% -10 - 30"/>
<Row FieldName="Company Name" Value="Dewitt - Play"/>
<Row FieldName="Company Address 1" Value="905 South Kingshighway"/>
<Row FieldName="Company Address 2" Value=""/>
<Row FieldName="Company City" Value="Sikeston"/>
<Row FieldName="Company State" Value="MO"/>
<Row FieldName="Company Zip code" Value="63801"/>
<Row FieldName="Company Phone" Value="573-472-0048"/>
<Row FieldName="Company Contact person" Value=""/>
<Row FieldName="Ship To Contact Name" Value=""/>
<Row FieldName="Ship To Phone" Value="256-766-2091"/>
<Row FieldName="Ship Date" Value="11/19/2008"/>
</Header>
</Document>
</SelectResult>
Code: Select all
<xs:element name="Row">
<xs:complexType>
<xs:attribute name="FieldName" use="required"/>
<xs:attribute name="Value" use="required"/>
</xs:complexType>
</xs:element>
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: XSD from XML with multiple rows
Hi,
You can pass the XML file though a simple XSLT like below that will remove the Value attribute, then pass that to the XML Schema instance generator:
Best Regards,
George
You can pass the XML file though a simple XSLT like below that will remove the Value attribute, then pass that to the XML Schema instance generator:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- copy -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<!-- do nothing on Row/@Value -->
<xsl:template match="Row/@Value"/>
</xsl:stylesheet>
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service