XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
giancarlo rossiSubject: xsd validation
Author: giancarlo rossi
Date: 26 Apr 2007 04:04 PM
Hi everybody,
I must validate a xml document Vs a .xsd schema...

http://www.transhotel-dev.com/interfaces/schemas/GetAvailAccom.xsd


But I got a vbscript error:
msxml3.dll error '80004005'
Incorrect definition for the root element in schema.
/etp/inc/parser.check.asp, line 9

????


<%
set xmlDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
xmlDoc.async = false
xmlDoc.validateOnParse = true
set xmlDocSchemaCache = Server.CreateObject("Msxml2.XMLSchemaCache.3.0")
xmlDocSchemaCache.add "GetAvailAccom", "http://www.transhotel-dev.com/interfaces/schemas/GetAvailAccom.xsd"
set xmlDoc.schemas = xmlDocSchemaCache
Dim valid
valid = xmlDoc.load(Server.MapPath("dettaglihotel2.xml"))
if( not valid ) then
response.write "Il codice xml non è valido"
end if

%>




Postnext
(Deleted User) Subject: xsd validation
Author: (Deleted User)
Date: 30 Apr 2007 09:59 AM
Hi Giancarlo,
is the XSD schema a standard schema, or is it written by you? When testing it using Stylus Studio I get a report of an ambiguous construct in the definition of GetAccomLocation, where you have

<xs:choice>
<xs:sequence>
<xs:element ref="IDarea"/>
<xs:element ref="IDcity" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="IDhotel" minOccurs="0" maxOccurs="200"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="IDcity" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="IDhotel" minOccurs="0" maxOccurs="200"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="IDhotel" maxOccurs="200"/>
</xs:sequence>
</xs:choice>

Because IDcity in the second sequence is an optional element, it's impossible to determine which branch of the xsd:choice should be used when only IDhotel is present.
Maybe this was the error that MSXML is complaining about...

Hope this helps,
Alberto

Postnext
giancarlo rossiSubject: xsd validation
Author: giancarlo rossi
Date: 01 May 2007 04:21 AM
Originally Posted: 01 May 2007 04:06 AM
HI Alberto,

Thanks for your reply.
It's the first time for me to validate a schema.

THE first error was caused by the msxml version.
Infact the 3.0. are not able to validate xsd schema but just DTD.

SO now I'm testing with 4.0.

I solved, the schema was wrong...

http://www.transhotel-dev.com/interfaces/schemas/GetAvailAccomOutput.xsd


Thanks for your help...

Postnext
(Deleted User) Subject: xsd validation
Author: (Deleted User)
Date: 01 May 2007 04:25 AM
Hi Giancarlo,
it means what I told you in my previous post: the IDhotel element is ambiguous (i.e. non-deterministic) because in this case the validator cannot determine which structure should be used to validate it:

<GetAccomLocation>
<IDhotel>3</IDhotel>
<SearchWithin> .... </SearchWithin>
</GetAccomLocation>

The schema defines that GetAccomLocation can either have this structure

<xs:sequence>
<xs:element ref="IDcity" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="IDhotel" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>

or this one

<xs:sequence>
<xs:element ref="IDhotel" maxOccurs="unbounded"/>
</xs:sequence>

But, when the IDcity element is missing, they look both identical. The schema should be fixed by making the IDcity mandatory (i.e. removing the minOccurs="0" attribute)

Hope this helps,
Alberto

Postnext
giancarlo rossiSubject: xsd validation
Author: giancarlo rossi
Date: 01 May 2007 04:44 AM
Sorry But I meet another problem...

The previouse was able to validate a the server response...
now I'm testing the request format...


but I get this error:
msxml4.dll error '80004005'

http://www.transhotel-dev.com/interfaces/schemas/GetAvailAccom.xsd#/schema[1]/element[position() = 1 and @name = 'GetAvailAccom']/complexType[1]/all[1]/element[position() = 5 and @name = 'GetAccomLocation']/complexType[1]/sequence[1] Schema is non-deterministic. [{GetAvailAccom}IDhotel]


Maybe The schema is not correct, becouse the IDhotel element is optional... ?

The schema check call:


set xmlDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")
xmlDoc.async = false
xmlDoc.validateOnParse = true
set xmlDocSchemaCache = Server.CreateObject("msxml2.xmlschemaCache.4.0")
xmlDocSchemaCache.add "GetAvailAccom", "http://www.transhotel-dev.com/interfaces/schemas/GetAvailAccom.xsd"
set xmlDoc.schemas = xmlDocSchemaCache
Dim valid
valid = xmlDoc.load(xml)
if( not valid ) then
response.write "Il codice xml non è valido"
set xmlhttp = nothing
set xmldoc = nothing
else
response.write "Il codice xml è valido"
'continuo
end if





Postnext
(Deleted User) Subject: xsd validation
Author: (Deleted User)
Date: 01 May 2007 04:53 AM
Giancarlo,
forse la mia risposta non era sufficientemente chiara: lo schema non e' valido perche' e' ambiguo nella definizione di GetAvailAccom, specificatamente nel suo sottoelemento IDhotel. L'unica soluzione e' di rendere IDcity obbligatorio, invece che opzionale; ma, se non puoi cambiare lo schema originale, forse puoi aggirarlo facendo si' che il file XML da validare contenga IDcity (sperando che MSXML non faccia una validazione completa dello schema se ha abbastanza informazioni per escluderne le parti non usate).

Buona fortuna,
Alberto

Postnext
giancarlo rossiSubject: xsd validation
Author: giancarlo rossi
Date: 01 May 2007 05:02 AM
Ciao ALberto, perdonami per i post confusi ma, avevo capito che nel primo errore avevo invertito lo schema di richiesta con quello di risposta...

Hai ragione sembra che il problema siano i tag facoltativi...
sto provando ad aggirare... eliminando gli attributi "minoccurs" ma ho incontrato un altro errore:

msxml4.dll error '80004005'

file:///d:/users/ETP/XML/GetAvailAccom.xsd#/schema[1]/element[position() = 1 and @name = 'GetAvailAccom']/complexType[1]/all[1]/element[position() = 4 and @name = 'Currency'] Undeclared XSD type : '{GetAvailAccom}CurrencyISO_Type'.

/etp/inc/step1Richiesta.asp, line 30

Spero in un tuo commento...
Ciao et grazie.



Posttop
(Deleted User) Subject: xsd validation
Author: (Deleted User)
Date: 03 May 2007 03:16 AM
Ciao Giancarlo,
questa volta si lamenta perche' un elemento e' definito con un tipo (CurrencyISO_Type) che pero' non esiste; ma il server non risponde, e non posso verificare perche' questo succede...

Ciao,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.