![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Validating XML >Thread Next - RE: Validating XML RE: Validating XMLTo: NULL Date: 1/3/2005 11:25:00 AM 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 | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
