Search the web
Sign In
New User? Sign Up
jena-dev · Jena Developers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Parsing XML Literals   Message List  
Reply | Forward Message #6979 of 42078 |
Hi,
A couple of weeks I sent an e-mail about a problem I encountered while
parsing XML Literals but didn't get a reply so let me try to explain the
problem in more detail. I have bunch of web service descriptions written
in OWL-S. Each OWL-S description has a grounding part where each service
parameter may have an XSLT transformation associated with it. These XSLT
descriptions are given as XML literals where the value of the literal is
a complete XSLT stylesheet. A simplified example looks like this:

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:grounding="http://www.daml.org/services/owl-s/1.0/Grounding.owl#">
<grounding:Grounding>
<grounding:xsltTransformation rdf:parseType="Literal">
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns1="http://www.example.org/test#">
<xsl:template match="/">
<xsl:variable name="X1" select="//ns1:SomeThing"/>
<output>
<xsl:value-of select="$X1"/>
</output>
</xsl:template>
</xsl:stylesheet>
</grounding:xsltTransformation>
</grounding:Grounding>
</rdf:RDF>

The interesting thing here is the stylesheet defines a namespace with
prefix "ns1" but the usage of this namespace is not obvious because it
is somewhat hidden inside an attribute value. When I parse this file
with Jena, the literal value I get does not have the namespace
declaration for "ns1" and looks like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:variable name="X1" select="//ns1:SomeThing"></xsl:variable>
<output>
<xsl:value-of select="$X1"></xsl:value-of>
</output>
</xsl:template>
</xsl:stylesheet>

This is not a valid XSLT stylesheet anymore and cannot be used. The hack
I found to get around this is to add something to the XML literal that
uses the namespace ns1. An element <ns1:dummy/> or an attribute like
ns1:dummy="" brings back the namespace declaration like this:

<xsl:stylesheet xmlns:ns1="http://www.example.org/test#"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ns1:dummy=""
version="1.0">
<xsl:template match="/">
<xsl:variable name="X1" select="//ns1:SomeThing"></xsl:variable>
<output>
<xsl:value-of select="$X1"></xsl:value-of>
</output>
</xsl:template>
</xsl:stylesheet>

What I'd like to learn is if it is possible to get the correct literal
value without adding dummy attributes. I thought this problem (dropping
unused namespaces) could be related to Xerces parsing but I couldn't
find anything relevant in the parser documentation. I'd appreciate if
you have any ideas or suggestions.

Thanks,
Evren

---
Evren Sirin evren@...
Graduate Research Assistant
Computer Science Department
Univ of Maryland, College Park, MD 20742
Phone: (301) 405-7027, Fax: (301) 405-6707








Mon Mar 15, 2004 10:09 pm

evren@...
Send Email Send Email

Forward
Message #6979 of 42078 |
Expand Messages Author Sort by Date

Hi, A couple of weeks I sent an e-mail about a problem I encountered while parsing XML Literals but didn't get a reply so let me try to explain the problem in...
Evren Sirin
evren@...
Send Email
Mar 15, 2004
10:09 pm

... Sorry, unless you push me I will reply to this message and not the earlier one. ... You lose. ... Correct - this is a known 'feature' of the treatment of...
Jeremy Carroll
jjchplb
Offline Send Email
Mar 16, 2004
11:13 am

... Andy has just pointed out another relevant point. In more recent versions of Jena we have been trying harder to remember the namespace prefix bindings from...
Jeremy Carroll
jjchplb
Offline Send Email
Mar 16, 2004
1:50 pm

... Yes; every Model is a PrefixMapping. [The prefixes are actually objects attached to the underlying graph; all the Model does is delegate to those objects....
Chris Dollin
flitz_cloud
Offline Send Email
Mar 16, 2004
2:22 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help