You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Martin Schafföner <th...@googlemail.com> on 2010/06/22 16:51:57 UTC

Problem with xml namespace handling in XmiCasDocSerializer

Hi,

while experimenting with UIMA I observed a problem similar to the one
already posted here: http://tinyurl.com/32spzv9. Since removing Saxon from
the classpath was not an option, I found the problem to be the way
namespaces are handled in
org.apache.uima.cas.impl.XmiCasSerializer$XmiCasDocSerializer.

First of all, the addAttribute/3 method was incorrectly passing null as uri
and localName parameters. According to the javadoc, these must at least be
empty strings. I added a hack to extract the localName from the qName, if
available.

Second, the method computeNamespaceDeclarationAttrs/1 only added namespaces
as attributes, which are not honored by Saxon. I think this is correct, as
the SAX2 standard states that namespaces must be declared via
startPrefixMapping/2, so I added that, as well.

Attached you find a patch with changes which work for me (and seem to solve
the problem).

Cheers,
Martin






RE: Problem with xml namespace handling in XmiCasDocSerializer

Posted by Martin Schafföner <th...@googlemail.com>.
Did it: https://issues.apache.org/jira/browse/UIMA-1817

Regards,
Martin

> -----Original Message-----
> From: Thilo Götz [mailto:twgoetz@gmx.de]
> Sent: Tuesday, June 22, 2010 5:19 PM
> To: user@uima.apache.org
> Subject: Re: Problem with xml namespace handling in XmiCasDocSerializer
> 
> Hi,
> 
> attachments don't work on the mailing lists.  Please open a Jira
> issue and attach the patch there.  Thanks.
> 
> --Thilo
> 
> On 6/22/2010 16:51, Martin Schafföner wrote:
> > Hi,
> >
> > while experimenting with UIMA I observed a problem similar to the one
> > already posted here: http://tinyurl.com/32spzv9. Since removing Saxon
> from
> > the classpath was not an option, I found the problem to be the way
> > namespaces are handled in
> > org.apache.uima.cas.impl.XmiCasSerializer$XmiCasDocSerializer.
> >
> > First of all, the addAttribute/3 method was incorrectly passing null
> as uri
> > and localName parameters. According to the javadoc, these must at
> least be
> > empty strings. I added a hack to extract the localName from the
> qName, if
> > available.
> >
> > Second, the method computeNamespaceDeclarationAttrs/1 only added
> namespaces
> > as attributes, which are not honored by Saxon. I think this is
> correct, as
> > the SAX2 standard states that namespaces must be declared via
> > startPrefixMapping/2, so I added that, as well.
> >
> > Attached you find a patch with changes which work for me (and seem to
> solve
> > the problem).
> >
> > Cheers,
> > Martin
> >
> >
> >
> >
> >


Re: Problem with xml namespace handling in XmiCasDocSerializer

Posted by Thilo Götz <tw...@gmx.de>.
Hi,

attachments don't work on the mailing lists.  Please open a Jira
issue and attach the patch there.  Thanks.

--Thilo

On 6/22/2010 16:51, Martin Schafföner wrote:
> Hi,
> 
> while experimenting with UIMA I observed a problem similar to the one
> already posted here: http://tinyurl.com/32spzv9. Since removing Saxon from
> the classpath was not an option, I found the problem to be the way
> namespaces are handled in
> org.apache.uima.cas.impl.XmiCasSerializer$XmiCasDocSerializer.
> 
> First of all, the addAttribute/3 method was incorrectly passing null as uri
> and localName parameters. According to the javadoc, these must at least be
> empty strings. I added a hack to extract the localName from the qName, if
> available.
> 
> Second, the method computeNamespaceDeclarationAttrs/1 only added namespaces
> as attributes, which are not honored by Saxon. I think this is correct, as
> the SAX2 standard states that namespaces must be declared via
> startPrefixMapping/2, so I added that, as well.
> 
> Attached you find a patch with changes which work for me (and seem to solve
> the problem).
> 
> Cheers,
> Martin
> 
> 
> 
> 
>