You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Murray Altheim <mu...@sun.com> on 2001/12/13 17:58:36 UTC

Xindice namespace problem

The subject? Xindice, XML Namespaces and the Xerces 2 parser.
 
We've been fairly successful in using the new Xindice (NEE dbXML), which 
comes delivered with its own jar files for Xerces 1.4.3, xalan 2.0.1. 
We've replaced some of those existing jars with Xerces 2 and the Xalan 
2.2D14. But we have a namespace bug.
 
Last night we finalized a "soft freeze" on a project using Xindice, and had
to file a bug against our code and hardwire a workaround because we've been 
losing 'xmlns' and 'xmlns:foo' declarations. When setting the parser up, I've
tried both true and false on "http://xml.org/sax/features/namespace-prefixes"
with true always on namespace awareness. This is AFAIK the fix that Tom added
to the code in the CVS tree, which we've just duplicated on our end. [One
of our problems is that we've had difficulty getting the CVS distribution
of Xindice behind our firewall, so we're using 1.0rc1 and bugfixing as we
go.]

I switched my code checking for specific attributes from something akin to:

      String id = element.getAttributeNS("foo","id");

to

      String id = element.getAttribute("foo:id");

so that things work, but this is really incorrect namespace processing,
which we can't leave in for our "hard freeze." I've watched the SAX messages
go by, and looked at what comes out of the database. If markup went in as

    <foo:element  xmlns:foo="http://www.foo.com/fur/">

it comes out as

    <foo:element  foo="http://www.foo.com/fur/">

which throws an exception because of a null namespace. We're currently
ignoring that exception.

We're using the Xindice compressed DOM. Is there any way around this?

Thanks,

Murray

...........................................................................
Murray Altheim                         <mailto:murray.altheim&#x40;sun.com>
XML Technology Center, Java and XML Software
Sun Microsystems, Inc., MS MPK17-102, 1601 Willow Rd., Menlo Park, CA 94025

               Rally against the evils of iceburg lettuce! 
            Grab a kitchen knife and join the Balsamic Jihad!

Re: Xindice namespace problem

Posted by Tom Bradford <br...@dbxmlgroup.com>.
Tom Bradford wrote:
> 
> On Thursday, December 13, 2001, at 12:16 PM, Tom Bradford wrote:
> > It looks as though the Xerces 2 SAX parser is reporting the namespaceURI
> > for xmlns:<blah> as null.  I don't know if this is legal or not...  One
> > would think it should be reported as an empty string, but I'll follow up
> > with the Xerces team.  In either case, I'm working on a clean workaround
> > for it, which should be available within a half hour or so.
> 
> Ok, I've checked in a workaround for this namespace problem.  There is a
> bug on file for Xerces 2 that describes this behavior, so hopefully when
> they get around to fixing it, I can back this code change out.
> Basically, I have to check every reported attribute for an xmlns prefix
> and then forcefully set the attribute in the DOM using a qualified name
> instead of a local name.
> 
> It'll slow things down a tad, but it'll work.

Oh, this is *only* for SAX parsing.  Once the document is in the
database, this won't hurt performance any.

-- 
Tom Bradford - http://www.tbradford.org
Developer - Apache Xindice (formerly dbXML)
Maintainer - jEdit-Syntax Java Editing Bean

Re: Xindice namespace problem

Posted by Tom Bradford <br...@dbxmlgroup.com>.
On Thursday, December 13, 2001, at 12:16 PM, Tom Bradford wrote:
> It looks as though the Xerces 2 SAX parser is reporting the namespaceURI
> for xmlns:<blah> as null.  I don't know if this is legal or not...  One
> would think it should be reported as an empty string, but I'll follow up
> with the Xerces team.  In either case, I'm working on a clean workaround
> for it, which should be available within a half hour or so.

Ok, I've checked in a workaround for this namespace problem.  There is a 
bug on file for Xerces 2 that describes this behavior, so hopefully when 
they get around to fixing it, I can back this code change out.  
Basically, I have to check every reported attribute for an xmlns prefix 
and then forcefully set the attribute in the DOM using a qualified name 
instead of a local name.

It'll slow things down a tad, but it'll work.

--
Tom Bradford - http://www.tbradford.org
Developer - Apache Xindice (formerly dbXML)
Maintainer - jEdit-Syntax Java Editing Bean


Re: Xindice namespace problem

Posted by Tom Bradford <br...@dbxmlgroup.com>.
Murray Altheim wrote:
> Last night we tested it against Java 1.3 and 1.4, and it seems that from
> the command line tools the "xmlns:" is getting taken off of "xmlns:foo"
> in the server itself. I spit out a serialization of the DOM node before I
> add it as well as when I get it out, and the node is fine on addition.

It looks as though the Xerces 2 SAX parser is reporting the namespaceURI
for xmlns:<blah> as null.  I don't know if this is legal or not...  One
would think it should be reported as an empty string, but I'll follow up
with the Xerces team.  In either case, I'm working on a clean workaround
for it, which should be available within a half hour or so.

-- 
Tom Bradford - http://www.tbradford.org
Developer - Apache Xindice (formerly dbXML)
Maintainer - jEdit-Syntax Java Editing Bean

Re: Xindice namespace problem

Posted by Murray Altheim <mu...@sun.com>.
Kimbro Staken wrote:
> 
> On Thursday, December 13, 2001, at 11:26 AM, Murray Altheim wrote:
> 
> >
> > Last night we tested it against Java 1.3 and 1.4, and it seems that from
> > the command line tools the "xmlns:" is getting taken off of "xmlns:foo"
> > in the server itself. I spit out a serialization of the DOM node before I
> > add it as well as when I get it out, and the node is fine on addition.
> 
> Are you using the SAX support in the XML:DB API to retrieve the data or
> just using the command line tools?

Both. Jeff Suttor has been using the command line tools, and I've written
a GUI demo application that does everything via the API. The demo app is
where I've had the best ability to see what's happening on the inside. 

Murray

...........................................................................
Murray Altheim, Staff Engineer          <mailto:murray.altheim&#64;sun.com>
Java and XML Software
Sun Microsystems, 1601 Willow Rd., MS UMPK17-102, Menlo Park, CA 94025

       Ernst Martin comments in 1949, "A certain degree of noise in 
       writing is required for confidence. Without such noise, the 
       writer would not know whether the type was actually printing 
       or not, so he would lose control."

Re: Xindice namespace problem

Posted by Kimbro Staken <ks...@dbxmlgroup.com>.
On Thursday, December 13, 2001, at 11:26 AM, Murray Altheim wrote:

>
> Last night we tested it against Java 1.3 and 1.4, and it seems that from
> the command line tools the "xmlns:" is getting taken off of "xmlns:foo"
> in the server itself. I spit out a serialization of the DOM node before I
> add it as well as when I get it out, and the node is fine on addition.

Are you using the SAX support in the XML:DB API to retrieve the data or 
just using the command line tools?

>
>>> We're using the Xindice compressed DOM. Is there any way around this?
>>
>> I'll do some testing with Xerces 2 and see what I can dig up.
>
> As per your suggestion, I left the vm.cfg directive to use Xindice's
> DocumentBuilderFactory, but it'd be nice if it worked on any. I'm pretty
> wiped after yesterday, but I'm going to spend today trying to figure out
> what's going on on the inside.
>
> [It'd be a great help if I could get another snapshot of the CVS tree as
> it stands right now, as my copy of Xindice is now out of sync with yours.
> I keep thinking about getting a private ISP account so I can get around
> our firewall...]
>
> Murray
>
> .........................................................................
> ..
> Murray Altheim, Staff Engineer          
> <mailto:murray.altheim&#64;sun.com>
> Java and XML Software
> Sun Microsystems, 1601 Willow Rd., MS UMPK17-102, Menlo Park, CA 94025
>
>        Ernst Martin comments in 1949, "A certain degree of noise in
>        writing is required for confidence. Without such noise, the
>        writer would not know whether the type was actually printing
>        or not, so he would lose control."
>
>
Kimbro Staken
XML Database Software, Consulting and Writing
http://www.xmldatabases.org/


Re: Xindice namespace problem

Posted by Tom Bradford <br...@dbxmlgroup.com>.
On Thursday, December 13, 2001, at 11:26 AM, Murray Altheim wrote:
> Last night we tested it against Java 1.3 and 1.4, and it seems that from
> the command line tools the "xmlns:" is getting taken off of "xmlns:foo"
> in the server itself. I spit out a serialization of the DOM node 
> before I
> add it as well as when I get it out, and the node is fine on addition.

I'm investigating it now as well, since I'm able to recreate your 
problem easily with Xerces 2, but not with Crimson or Xerces 1.  
Hopefully, I'll have a good answer within a couple of hours.
>

> [It'd be a great help if I could get another snapshot of the CVS tree as
> it stands right now, as my copy of Xindice is now out of sync with 
> yours.
> I keep thinking about getting a private ISP account so I can get around
> our firewall...]

I'll send a snapshot.  We should probably also arrange to have nightly 
snapshots tarballed and zipped somewhere, so that they can be access via 
HTTP.

--
Tom Bradford - http://www.tbradford.org
Developer - Apache Xindice (formerly dbXML)
Maintainer - jEdit-Syntax Java Editing Bean


Re: Xindice namespace problem

Posted by Murray Altheim <mu...@sun.com>.
Tom Bradford wrote:
> 
> On Thursday, December 13, 2001, at 09:58 AM, Murray Altheim wrote:
> > The subject? Xindice, XML Namespaces and the Xerces 2 parser.
> >
> > We've been fairly successful in using the new Xindice (NEE dbXML), which
> > comes delivered with its own jar files for Xerces 1.4.3, xalan 2.0.1.
> > We've replaced some of those existing jars with Xerces 2 and the Xalan
> > 2.2D14. But we have a namespace bug.
> 
> I've only testing things against Xerces 1 and Crimson at this point, and
> the fix the I committed, though it addressed Xerces 1, should have fixed
> any potential SAX parser problems.  Can you tell me whether the
> documents are ok in the server itself?  Or is this happening in the
> XML:DB SAX event generator?

Last night we tested it against Java 1.3 and 1.4, and it seems that from
the command line tools the "xmlns:" is getting taken off of "xmlns:foo"
in the server itself. I spit out a serialization of the DOM node before I
add it as well as when I get it out, and the node is fine on addition.

> > We're using the Xindice compressed DOM. Is there any way around this?
> 
> I'll do some testing with Xerces 2 and see what I can dig up.

As per your suggestion, I left the vm.cfg directive to use Xindice's
DocumentBuilderFactory, but it'd be nice if it worked on any. I'm pretty
wiped after yesterday, but I'm going to spend today trying to figure out
what's going on on the inside. 

[It'd be a great help if I could get another snapshot of the CVS tree as
it stands right now, as my copy of Xindice is now out of sync with yours.
I keep thinking about getting a private ISP account so I can get around
our firewall...]

Murray

...........................................................................
Murray Altheim, Staff Engineer          <mailto:murray.altheim&#64;sun.com>
Java and XML Software
Sun Microsystems, 1601 Willow Rd., MS UMPK17-102, Menlo Park, CA 94025

       Ernst Martin comments in 1949, "A certain degree of noise in 
       writing is required for confidence. Without such noise, the 
       writer would not know whether the type was actually printing 
       or not, so he would lose control."

Re: Xindice namespace problem

Posted by Tom Bradford <br...@dbxmlgroup.com>.
On Thursday, December 13, 2001, at 09:58 AM, Murray Altheim wrote:
> The subject? Xindice, XML Namespaces and the Xerces 2 parser.
>
> We've been fairly successful in using the new Xindice (NEE dbXML), which
> comes delivered with its own jar files for Xerces 1.4.3, xalan 2.0.1.
> We've replaced some of those existing jars with Xerces 2 and the Xalan
> 2.2D14. But we have a namespace bug.

I've only testing things against Xerces 1 and Crimson at this point, and 
the fix the I committed, though it addressed Xerces 1, should have fixed 
any potential SAX parser problems.  Can you tell me whether the 
documents are ok in the server itself?  Or is this happening in the 
XML:DB SAX event generator?

> We're using the Xindice compressed DOM. Is there any way around this?

I'll do some testing with Xerces 2 and see what I can dig up.

--
Tom Bradford - http://www.tbradford.org
Developer - Apache Xindice (formerly dbXML)
Maintainer - jEdit-Syntax Java Editing Bean