Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Validating XML

From: LindaWienholt@-----------.---------.---
To: NULL
Date: 1/3/2005 6:31:00 PM
Thanks Mike, that did the trick.

"rdcpro" wrote:

> Hi Linda,
> 
> There seem to be a lot of errors in your schema revolving around how 
> namespaces are handled.
> 
> For a no-namespace schema, try this one.  You can modify the data types as 
> you see fit, and this also brings all types out and defines them globally, 
> which might be more detail than you want:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> elementFormDefault="qualified">
> <xs:element name="Account" type="xs:short"/>
> <xs:element name="Amount" type="xs:decimal"/>
> <xs:element name="AmountFX" type="xs:decimal"/>
> <xs:complexType name="AnalysisType">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:attribute name="TypeID" use="required">
> <xs:simpleType>
> <xs:restriction base="xs:NMTOKEN">
> <xs:enumeration value="Branch"/>
> <xs:enumeration value="Client"/>
> <xs:enumeration value="Consultant"/>
> <xs:enumeration value="Contractor"/>
> <xs:enumeration value="Job"/>
> <xs:enumeration value="Week"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> <xs:complexType name="AnalysisImportType">
> <xs:sequence>
> <xs:element name="Analysis" type="AnalysisType" minOccurs="1" 
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="DataRoot">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="JournalImport" type="JournalImportType"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="DateEntered" type="xs:date"/>
> <xs:element name="DateTransaction" type="xs:date"/>
> <xs:element name="Description" type="xs:string"/>
> <!-- this might be better off as an enumeration of valid currency types -->
> <xs:element name="FX" type="xs:string"/>
> <!-- could also be a URI -->
> <xs:element name="Hyperlink" type="xs:string"/>
> <xs:complexType name="JournalImportType">
> <xs:sequence>
> <xs:element name="Description" ref="Description"/>
> <xs:element name="DateTransaction" ref="DateTransaction"/>
> <xs:element name="Reference" ref="Reference"/>
> <xs:element name="Hyperlink" ref="Hyperlink"/>
> <xs:element name="DateEntered" ref="DateEntered"/>
> <xs:element name="LedgerImport" type="LedgerImportType"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="LedgerImportType">
> <xs:sequence>
> <xs:element name="Account" ref="Account"/>
> <xs:element name="DateTransaction" ref="DateTransaction"/>
> <xs:element name="Reference" ref="Reference"/>
> <xs:element name="Amount" ref="Amount"/>
> <xs:element name="Description" ref="Description"/>
> <xs:element name="TransactionTypeID" ref="TransactionTypeID"/>
> <xs:element name="Hyperlink" ref="Hyperlink"/>
> <xs:element name="Period" ref="Period"/>
> <xs:element name="AnalysisImport" type="AnalysisImportType"/>
> <xs:element name="AmountFX" ref="AmountFX"/>
> <xs:element name="FX" ref="FX"/>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="Period" type="xs:int"/>
> <xs:element name="Reference" type="xs:string"/>
> <xs:element name="TransactionTypeID" type="xs:string"/>
> </xs:schema>
> 
> 
> And your XML document can attach the schema by adding the following to the 
> DataRoot element:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <DataRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xsi:noNamespaceSchemaLocation="JournalImportSchema.xsd">
> <JournalImport>
> <Description>over all desc</Description>
> <DateTransaction>2004-11-22</DateTransaction>
> <Reference>MAIN ENGINE REPAIRS</Reference>
> <Hyperlink>F:\Jobs\23\invoice72635.jpeg</Hyperlink>
> <DateEntered>2004-11-13</DateEntered>
> <LedgerImport>
> <Account>4000</Account>
> <DateTransaction>2004-11-22</DateTransaction>
> <Reference>Inv 72635</Reference>
> <Amount>100</Amount>
> <Description>specific Contractor ABS w/e</Description>
> <TransactionTypeID>JNL</TransactionTypeID>
> <Hyperlink>F:\Jobs\23\invoice72635.jpeg</Hyperlink>
> <Period>200401</Period>
> <AnalysisImport>
> <Analysis TypeID="Branch">Wollongong</Analysis>
> <Analysis TypeID="Client">ABC Pty Ltd</Analysis>
> <Analysis TypeID="Consultant">A N Consultant</Analysis>
> <Analysis TypeID="Contractor">T H Contractor</Analysis>
> <Analysis TypeID="Job">23</Analysis>
> <Analysis TypeID="Week">22</Analysis>
> </AnalysisImport>
> <AmountFX>100.00</AmountFX>
> <FX>USD</FX >
> </LedgerImport>
> </JournalImport>
> </DataRoot>
> 
> 
> Regards,
> Mike Sharp
> 


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent