[
https://issues.apache.org/jira/browse/OODT-395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218793#comment-13218793
]
Ricky Nguyen commented on OODT-395:
-----------------------------------
Let me clarify the issue.
# Currently, SerializableMetadata#toXML returns a DOM document object with the
following:
## root element has localname "cas:metadata" and NULL namespace
## keyval has NULL namespace
## key has NULL namespace
## val has NULL namespace
# Parsing a DOM document from serialized metadata returns a DOM document object
with the following:
## root element has localname "metadata", "http://oodt.jpl.nasa.gov/1.0/cas"
namespace, and "cas" prefix
## keyval has NULL namespace
## key has NULL namespace
## val has NULL namespace
I am changing 1.1 to be equivalent to 2.1.
To consider backwards compatibility, suppose we read in a metadata file
serialized before this bug fix.
{code:title=old-met.xml}
<cas:metadata xmlns:cas="http://oodt.jpl.nasa.gov/1.0/cas">
<keyval type="vector">
<key>Name</key>
<val>Value</val>
</keyval>
</cas:metadata>
{code}
My fix does not change the output, so backwards compatibility is preserved.
If we set the default namespace as Paul suggested, the output changes:
{code:title=new-met.xml}
<metadata xmlns="http://oodt.jpl.nasa.gov/1.0/cas">
<keyval type="vector">
<key>Name</key>
<val>Value</val>
</keyval>
</metadata>
{code}
Here, ALL elements belong to the cas namespace. DOM parsed from new file !=
DOM parsed from old file. This could be a major issue, I don't know. People
with existing XSLT (in PgeConfig <dynInputFiles>) will have to change their
templates.
If we really want ALL elements to belong to the cas namespace, we need to be
smarter about parsing old files (see
http://www.xfront.com/HideVersusExpose.html about hiding the "cas:" qualifier).
Also, we would need to change cas.metadata.xsd to reflect these changes. Let
me know if this is the road we want to take, otherwise I'm inclined to stick
with the simplest fix.
> SerializableMetadata.toXml() doesn't set namespace on root element
> ------------------------------------------------------------------
>
> Key: OODT-395
> URL: https://issues.apache.org/jira/browse/OODT-395
> Project: OODT
> Issue Type: Bug
> Components: metadata container
> Affects Versions: 0.4
> Reporter: Ricky Nguyen
> Fix For: 0.4
>
> Attachments: rickdn.oodt-395.patch
>
>
> This issue becomes apparent when using
> o.a.o.cas.pge.writers.xslt.XslTransformWriter in the <dynInputFile> element
> of a PGE config xml. If you use the identity xsl transform
> (http://en.wikipedia.org/wiki/Identity_transform#Using_XSLT):
> {code}
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="@*|node()">
> <xsl:copy>
> <xsl:apply-templates select="@*|node()"/>
> </xsl:copy>
> </xsl:template>
> </xsl:stylesheet>
> {code}
> Then the root element is NOT part of the "cas" namespace:
> {code}
> <metadata xmlns:cas="http://oodt.jpl.nasa.gov/1.0/cas">
> ...
> </metadata>
> {code}
> Whereas the serialized form of metadata (when written to a File or
> OutputStream) DOES use the "cas" namespace:
> {code}
> <cas:metadata xmlns:cas="http://oodt.jpl.nasa.gov/1.0/cas">
> ...
> </cas:metadata>
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira