| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | How do I get all the errors out of MSXML? |
From: Adam
Dear All,
Still on with XML-XSD validation inc on Windows.
Two questions for the win dev types here.
A)
std bit of jScript to load an XML Doc & to check it against it's schema:
var xmldoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmldoc.async = false;
xmldoc.load(WScript.Arguments(0));
var resultstring = new String();
if(xmldoc.parseError.errorCode != 0){
resultstring="Result=1"+"\n"
+"Filename="+ WScript.Arguments(0) +"\n"
+"url="+ xmldoc.parseError.url +"\n"
+"Error_Code="+ xmldoc.parseError.errorCode +
"\n"
+"Reason="+ xmldoc.parseError.reason
+"File_Position="+ xmldoc.parseError.filepos +
"\n"
+"Line_Number="+ xmldoc.parseError.line + "\n"
+"Line_Position="+ xmldoc.parseError.linepos +
"\n"
+"srcText="+ xmldoc.parseError.srcText
;
}
or with a declared schema & namespace:
var cache = new ActiveXObject("Msxml2.XMLSchemaCache.4.0");
cache.add(WScript.Arguments(2), WScript.Arguments(1));
var xmldoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmldoc.async = false;
xmldoc.schemas = cache;
xmldoc.load(WScript.Arguments(0));
if(xmldoc.parseError.errorCode != 0){
resultstring="Result=1"+"\n"
+"Filename="+ WScript.Arguments(0) +"\n"
+"url="+ xmldoc.parseError.url +"\n"
+"Error_Code="+ xmldoc.parseError.errorCode +
"\n"
+"Reason="+ xmldoc.parseError.reason
+"File_Position="+ xmldoc.parseError.filepos +
"\n"
+"Line_Number="+ xmldoc.parseError.line + "\n"
+"Line_Position="+ xmldoc.parseError.linepos +
"\n"
+"srcText="+ xmldoc.parseError.srcText
;
}
Works fine.....for one error but how do get back all errors (against a
schema) for a given doc? i.e. imagine I have some valid xml which breaks a
number of the schema rules. At the moment I just get back (formatted by my
app):
Element content is invalid according to the DTD/Schema.
10
11
373
http://apache.org/xml/features/validation/schema-full-checki
ng",true);
To make it strict or leave it out to make it at it's default level.
TIA
Adam
--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)SEEN-BY: 633/267 270 5030/786 @PATH: 379/45 1 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.