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
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
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...
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:
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)
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
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).
Subject: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'.
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...