|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
XML Schema not being friendly!
I keep getting the following error:
Code:
- Error Code : -1072898028 - Reason : Element 'Result' is unexpected according to content model of pare nt element 'FinalResults'. Expecting: FileInfo. - Character : 159 - Line : 1 - Column : 160 When I try to validate this (trimmed) XML file: Code:
<?xml version="1.0" ?> - <FinalResults> - <Result> <Product>AhnLab-V3</Product> <Version>2008.3.4.0</Version> <Date>2008.03.10</Date> <Answer>-</Answer> </Result> - <FileInfo> <FileSize>File size: 56 bytes</FileSize> <MD5>MD5: cf0c5e881da2d470f6dcdd825f38ec69</MD5> <SHA1>SHA1: 3d8c7b5e25027d842287aa96321445ba2ca99167</SHA1> <PEiD>PEiD: -</PEiD> </FileInfo> </FinalResults> Using this Schema: Code:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="FinalResults"> <xs:complexType> <xs:sequence> <xs:element name="Result"> <xs:complexType> <xs:sequence> <xs:element name="Product" type="xs:string"/> <xs:element name="Version" type="xs:string"/> <xs:element name="Date" type="xs:string"/> <xs:element name="Answer" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="FileInfo"> <xs:complexType> <xs:sequence> <xs:element name="FileSize" type="xs:string"/> <xs:element name="MD5" type="xs:string"/> <xs:element name="SHA1" type="xs:string"/> <xs:element name="PEiD" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema Apologies for the long post but I only kept what was necessary. I'm pretty new to XML (Second Day!) so I really don't know what's happening here. |
|
#2
|
|||
|
|||
|
Ugh I fixed it. The following line should have read:
Code:
<xs:element name="Result" minOccurs="0" maxOccurs="unbounded"> I think having 'Result' appear more then once threw the Schema who only expected it appear once. The new bit tells it to expect it numerous times. Can someone confirm/deny this? |
|
#3
|
|||
|
|||
|
have u tried this?
<xs:sequence minOccurs="0" maxOccurs="unbounded"> with this, the list becomes an unordered list Quote:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XML Schema not being friendly! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|