Re: Problems with application/xml

Hello Michael,

At 05:30 04/08/08 +0000, Michael Terry wrote:




>Hello.  I have an RDF document http://www.mterry.name/test.xml that I am
>serving as application/xml.  I am using Apache's Multiview option so
>that its URI is just /test.  I also have an exact copy of that file as
>/test2.rdf that is served as application/rdf+xml.
>
>When I give the RDF validator the URIs
>"http://www.mterry.name/test2.rdf" or "http://www.mterry.name/test2", it
>says the RDF document validated successfully.
>
>When I pass the URI "http://www.mterry.name/test" to the RDF validator,
>I get the error message "An attempt to load the RDF from URI
>'http://www.mterry.name/test' failed. (Cannot open stream.)".  I don't
>know what the deal is with that.

The RDF validator sends
Accept: application/rdf+xml
as one of it's headers. This can be found in
http://dev.w3.org/cvsweb/java/classes/org/w3c/rdf/examples/ARPServlet.java?r 
ev=1.78&content-type=text/x-cvsweb-markup

 >>>>
         try {
             con = url.openConnection();
             con.setRequestProperty("Accept", "application/rdf+xml");
             con.connect();
         } catch (Exception e) {
             throw new getRDFException("Unable to open connection.");
         }
 >>>>


What your server then sends back is:

 >>>>>>>>
 > telnet www.mterry.name 80
Trying 69.56.221.162...
Connected to 69-56-221-162.theplanet.com.
Escape character is '^]'.
GET /test HTTP/1.1
Host: www.mterry.name
Accept: application/rdf+xml

HTTP/1.1 406 Not Acceptable
Date: Mon, 09 Aug 2004 01:38:05 GMT
Server: Apache/1.3.31 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 
mod_bwlimited/1.4 PHP/4.3.8 FrontPage/5.0.2.2634a mod_ssl/2.8.19 OpenSSL/0.9.7a
Alternates: {"test.xml" 1 {type application/xml}}
Vary: negotiate
TCN: list
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

19d
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>406 Not Acceptable</TITLE>
</HEAD><BODY>
<H1>Not Acceptable</H1>
An appropriate representation of the requested resource /test could not be 
found on this server.<P>
Available variants:
<ul>
<li><a href="test.xml">test.xml</a> , type application/xml
</ul>
<HR>
<ADDRESS>Apache/1.3.31 Server at www.mterry.name Port 80</ADDRESS>
</BODY></HTML>

0

Connection closed by foreign host.
 >>>>>>>>

i.e. it doesn't have application/rdf+xml, only application/xml.
I guess there is a way to configure the server to not return
"406 Not Acceptable" if there is just one choice. But maybe
that's against HTTP, because the client explicitly said that
it didn't understand anything else that application/rdf+xml.

Later pieces of the code deal with cases other than application/rdf+xml,
for example:

 >>>>
         // A server could return content but not the RDF/XML that
         // we need.  Check the beginning of s and if it looks like
         // a generic HTML message, return an error.
 >>>>

So telling the server that we only handle application/rdf+xml isn't
really correct. I think replacing
             con.setRequestProperty("Accept", "application/rdf+xml");
with something like
             con.setRequestProperty("Accept",
                  "application/rdf+xml,application/*;q=0.2,*;q=0.05");
or so (indicating a clear preference for application/rdf+xml, but
allowing other types) would be better. Eric/Ryan, can you please
test/fix this?



>If I pass in "http://www.mterry.name/test.xml" to the validator, I get
>the error "Exception parsing: {E301} The processing instruction target
>matching "[xX][mM][lL]" is not allowed.".  It seems the validator is
>hard coded to bail on any xml PI, including the simple 'I am XML'
>declaration?  Is that right?

No. Your file starts with:

----
<?xml version="1.0" encoding="utf-8"?>

<!-- To trick Microsoft Internet Explorer -->
<?xml-stylesheet href="./copy.xsl" type="text/xsl"?>
<rdf:RDF
----

There is quite some code dealing with the XML declaration.
What seems to create problems (I'm not sure it should, or it
shouldn't) is the stylesheet PI. Jeremy, others, any opinion?


Regards,     Martin.

>Why is the validator choking so hard on application/xml?  Is there a way
>I can get around this?
>
>Thank you for your time, and please cc: me as I am not subscribed to
>this list,
>Michael Terry

Received on Monday, 9 August 2004 07:30:12 UTC