[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] Problems with XML from ASP.
On Mon, Nov 26, 2001 at 04:12:33PM -0800, Byron Stuart wrote:
>I'm trying to use the MSXML 4 DOMDocument, but for some reason, it doesn't
>like the XML from my ASP. When I load a page of sample data w/ either a .xml
>or .asp extension, everything works fine. But, when I add any ASP statements
>(even a comment like this: <% 'this is asp %>) to the .asp page, the XML
>parser chokes and gives the following error:
>Error loading XML Document :
>Error Code : -1072896764
>Reason : A name was started with an invalid character.
>The generated XML page looks fine in the browser, but when I load it in
>another page using the DOMDocument object with the following code:
>xmldoc.load server.mapPath("mypage.asp"), I get the error. Does anyone have
>any idea what's going on here? Thanks, Byron.
Well, I'd say that an XML name was started with an invalid character.
'%' is not a legal name character (where 'name character' means
something that can be part of a tag, or in SGML terms part of a GI).
If the parser *did* manage to choke down a tag with the name "%", it
would then choke on an attribute that starts with an illegal character
('this), then on the lack of an equals sign following the attribute,
then on the lack of a value following the missing equals sign. It
would proceed to do the same, without having the problem of the illegal
initial character for the remaining two simple attributes ("is" and
"asp"), and would barf again on the attribute called "%". Finally, if
you could force it to swallow that much grotesquely ill-formed XML, it
would barf again because the tag <%> does not have a corresponding end
ASP syntax is not legal XML. Turn it into legal XML before you hand it
to an XML processor (someone else may be able to suggest if there's an
alternative ASP syntax that is legal XML; there is for JSP, which is
basically Sun chasing ASP's taillights).
But really, the error message is quite adequate to diagnose the
problem. Please forgive me if I'm taking too much amusement from it.
Amelia A. Lewis email@example.com firstname.lastname@example.org
Never imagine yourself not to be otherwise than what it might appear to others
that what you were or might have been was not otherwise than what you had been
would have appeared to them to be otherwise. -- The Duchess