Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Validating XML

From: Linda Wienholt@-----------.---------.---
To: NULL
Date: 1/2/2005 5:53:00 PM
Hi,

I am a an XML novice and have been trying to create an XSD to validate my 
XML file.  I have used the VS.NET auto-generate feature but keep getting 
errors.  I have an invalid element error for the AnalysisImport element and 
"The element cannot contain text or white space.  Content model is empty" for 
the Analysis elements.  I have included the original XML and generated XSD.

Thanks 
Linda

XML
<?xml version="1.0" encoding="UTF-8" ?>
<DataRoot xmlns:xsi="http://tempuri.org/JournalImport.xsd" 
xmlns="http://tempuri.org/JournalImport.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.0</AmountFX>
			<FX>USD</FX >
		</LedgerImport>
	</JournalImport>
</DataRoot>

XSD
<?xml version="1.0" ?>
<xs:schema id="JournalImportSchema" 
targetNamespace="http://tempuri.org/JournalImport.xsd"
	xmlns:mstns="http://tempuri.org/JournalImport.xsd" 
xmlns="http://tempuri.org/JournalImport.xsd"
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
	attributeFormDefault="qualified" elementFormDefault="qualified">
	<xs:complexType name="DataRootType">
		<xs:sequence>
			<xs:element name="JournalImport" type="mstns:JournalImportType" 
minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="JournalImportType">
		<xs:sequence>
			<xs:element name="Description" type="xs:string" />
			<xs:element name="DateTransaction" type="xs:date" />
			<xs:element name="Reference" type="xs:string" />
			<xs:element name="Hyperlink" type="xs:string" />
			<xs:element name="DateEntered" type="xs:date" />
			<xs:element name="LedgerImport" type="mstns:LedgerImportType" 
minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="LedgerImportType">
		<xs:sequence>
			<xs:element name="Account" type="xs:string" />
			<xs:element name="Period" type="xs:string" />
			<xs:element name="DateTransaction" type="xs:date" />
			<xs:element name="Reference" type="xs:string" />
			<xs:element name="Amount" type="xs:decimal" />
			<xs:element name="Description" type="xs:string" />
			<xs:element name="TransactionTypeID" type="xs:string" />
			<xs:element name="AmountFX" type="xs:string" />
			<xs:element name="FX" type="xs:string" minOccurs="1" />
			<xs:element name="Hyperlink" type="xs:string" />
			<xs:element name="AnalysisImport" type="mstns:AnalysisImportType" 
minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="AnalysisImportType">
		<xs:sequence>
			<xs:element name="Analysis" type="mstns:AnalysisType" minOccurs="0" 
maxOccurs="unbounded" />
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="AnalysisType" mixed="true">
		<xs:sequence></xs:sequence>
		<xs:attribute name="TypeID" form="unqualified" type="xs:string" />
	</xs:complexType>
	<xs:element name="DataRoot" type="mstns:DataRootType" />
	<xs:element name="JournalImportSchema" msdata:IsDataSet="true" 
msdata:Locale="en-AU" msdata:EnforceConstraints="False">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element ref="DataRoot" />
			</xs:choice>
		</xs:complexType>
	</xs:element>
</xs:schema>


transparent
Print
Mail
Like It
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