XML serializer and name spaces

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

XML serializer and name spaces

Duane Gran-2
I'm using the XML Serializer to output a document direct to the  
browser, but I'm experiencing some really weird behavior with name  
spaces.  My XPL looks like the following:

   <p:processor name="oxf:xml-serializer">
     <p:input name="data" href="#document#xpointer(/*/document/*)"  
debug="indoc"/>
     <p:input name="config">
       <config>
         <content-type>application/xml</content-type>
       </config>
     </p:input>
   </p:processor>

It works, however in the browser (Firefox 1.5) it displays an XML  
parsing error stating that the prefix is not bound to a namespace.  
The reason is pretty clear to me, as my document looks something like  
the following:

<document-info xmlns:xlink="http://www.w3.org/1999/xlink">
     <document>
         <mods xmlns="http://www.loc.gov/mods/v3">
             <titleInfo ID="t1"  xlink:href=""/>
         </mods>
     </document>
</document-info>

Notice the xlink namespace on the root, while the effect of the XML  
processor is to grab only the content within the document element,  
mods.  Now comes the curious part.  If I look at the output from the  
debug attribute (indoc) I see the following:

<mods xmlns="http://www.loc.gov/mods/v3">
     <titleInfo ID="t1" xmlns:xlink="http://www.w3.org/1999/xlink"  
xlink:href=""/>
</mods>

This looks fine to me, but then in Firefox if I view the source of  
the page returned, I get the following:

<mods xmlns="http://www.loc.gov/mods/v3">
  <titleInfo ID="t1" xlink:href=""/>
</mods>

Clearly, the latter is invalid, but the debug attribute told me that  
correct XML would be sent.  Is this a case where Firefox is messing  
up the data?  Should I abandon sending XML directly to the browser in  
favor of a more elaborate view?  Any ideas on this situation are most  
welcome.

Duane



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XML serializer and name spaces

Alessandro  Vernet
Administrator
Hi Duane,

I was able to reproduce the problem and added bug for this. In the
meantime, you can get around this issue by using XSLT instead of
XPointer to extract the <mods>, as shown in the attached XPL file.

http://forge.objectweb.org/tracker/index.php?func=detail&aid=304726&group_id=168&atid=350207

Alex

On 2/25/06, Duane Gran <[hidden email]> wrote:

> I'm using the XML Serializer to output a document direct to the
> browser, but I'm experiencing some really weird behavior with name
> spaces.  My XPL looks like the following:
>
>    <p:processor name="oxf:xml-serializer">
>      <p:input name="data" href="#document#xpointer(/*/document/*)"
> debug="indoc"/>
>      <p:input name="config">
>        <config>
>          <content-type>application/xml</content-type>
>        </config>
>      </p:input>
>    </p:processor>
>
> It works, however in the browser (Firefox 1.5) it displays an XML
> parsing error stating that the prefix is not bound to a namespace.
> The reason is pretty clear to me, as my document looks something like
> the following:
>
> <document-info xmlns:xlink="http://www.w3.org/1999/xlink">
>      <document>
>          <mods xmlns="http://www.loc.gov/mods/v3">
>              <titleInfo ID="t1"  xlink:href=""/>
>          </mods>
>      </document>
> </document-info>
>
> Notice the xlink namespace on the root, while the effect of the XML
> processor is to grab only the content within the document element,
> mods.  Now comes the curious part.  If I look at the output from the
> debug attribute (indoc) I see the following:
>
> <mods xmlns="http://www.loc.gov/mods/v3">
>      <titleInfo ID="t1" xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href=""/>
> </mods>
>
> This looks fine to me, but then in Firefox if I view the source of
> the page returned, I get the following:
>
> <mods xmlns="http://www.loc.gov/mods/v3">
>   <titleInfo ID="t1" xlink:href=""/>
> </mods>
>
> Clearly, the latter is invalid, but the debug attribute told me that
> correct XML would be sent.  Is this a case where Firefox is messing
> up the data?  Should I abandon sending XML directly to the browser in
> favor of a more elaborate view?  Any ideas on this situation are most
> welcome.
>
> Duane
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

url-ser.xpl (1K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet