Article View: fr.comp.text.xml
Article #9362Re: Parser
From: Diox
Date: Tue, 24 Apr 2001 09:13
Date: Tue, 24 Apr 2001 09:13
43 lines
2647 bytes
2647 bytes
en asp cote serveur ca donne ca :
<% // Parse error formatting function
function reportParseError(error)
var s = "";
for (var i=1; i<error.linepos; i++)
{ s +=" "; }
r = "<font face=Verdana size=2><font size=4>XML Error loading '" +
error.url + "'</font>" + "<P><B>" + error.reason +
"</B></P></font>";
if (error.line > 0)
r += "<font size=3><XMP>" + "at line " + error.line + ", character " +
error.linepos + "\n" + error.srcText + "\n" + s + "^" +
"</XMP></font>";
return r;
}
// Run-time error formatting function
function reportRuntimeError(exception)
{ return "<font face=Verdana size=2><font size=4>XSL Runtime
Error</font>" + "<P><B>" + exception.description +
</B></P></font>"; }
// Set the source and style sheet locations here
var sourceFile = Server.MapPath("/path/monxml.xml");
var styleFile = Server.MapPath("/monxsl.xsl");
// Load the XML
var source = Server.CreateObject("Microsoft.XMLDOM");
source.async = false;
source.load(sourceFile);
// Load the XSL
var style = Server.CreateObject("Microsoft.XMLDOM");
style.async = false;
style.load(styleFile);
if (source.parseError.errorCode != 0)
result = reportParseError(source.parseError);
else { if (style.parseError.errorCode != 0)
result = reportParseError(style.parseError);
else { try { result = source.transformNode(style); }
catch (exception) { result =
tRuntimeError(exception); } } }
Response.Write(result);%>
diox
Technical Details
Message-ID:
<9c3fqe$5e3$1@reader1.imaginet.fr>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.43.194.69!fr.clara.net!heighliner.fr.clara.net!fr.colt.net!writer!not-for-mailReferences:
<9c3cjm$doe$1@demo2.univ-lyon1.fr> <QkbF6.349$_w.792637@nnrp4.proxad.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114f60,cd6e494fcf7a3786 X-Google-Attributes: gid114f60,public X-Google-ArrivalTime: 2001-04-24 02:13:35 PST Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.43.194.69!fr.clara.net!heighliner.fr.clara.net!fr.colt.net!writer!not-for-mail From: "Diox" <diox@diox.com> Newsgroups: fr.comp.text.xml Subject: Re: Parser Date: Tue, 24 Apr 2001 11:13:03 +0200 Organization: ImagiNET / Colt Internet Lines: 44 Message-ID: <9c3fqe$5e3$1@reader1.imaginet.fr> References: <9c3cjm$doe$1@demo2.univ-lyon1.fr> <QkbF6.349$_w.792637@nnrp4.proxad.net> NNTP-Posting-Host: f888iext.auchan.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: reader1.imaginet.fr 988103310 5571 195.68.11.129 (24 Apr 2001 09:08:30 GMT) X-Complaints-To: abuse@imaginet.fr NNTP-Posting-Date: 24 Apr 2001 09:08:30 GMT X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3612.1700