[jdom-interest] getChild and namespace

elephantwalker elephantwalker at home.com
Tue Mar 27 15:48:00 PST 2001

Dear Philip,

This parses in crimson or xerces, latest release. Many parsers *glorck* on
svg because the svg dtd has *many* entity references. For example, the
oracle parser with and without jdom will not work...no matter what version
you use.

A good test for any parser is to parse svg xml. You can get several examples
from Adobe's svg site (www.adobe.com) or you can look at the w3c stuff at



-----Original Message-----
From: philip.nelson at omniresources.com
[mailto:philip.nelson at omniresources.com]
Sent: Tuesday, March 27, 2001 11:41 AM
To: elephantwalker at home.com; jdom-interest at jdom.org
Subject: RE: [jdom-interest] getChild and namespace

> I'm a little confused about something.
> If you have a default namespace (usually the name of the dtd
> without the
> .dtd extension), and there are other namespaces declared in
> the root element
> of your document....
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"
> "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303
> -stylable.dtd"
> >
> <svg  xmlns:a="http://www.adobe.com/svg10-extensions"
> a:timeline="independent">
>   <defs>
>     <symbol id="rectangle" >
>     <path  d="M0,0L0,50L50,50L0,0z" />
>     </symbol>
>   </defs>
>   <g>
>     <use xlink:href="#rectangle" />
>   </g>
> </svg>
> If you do a doc.getRootElement(), and then get the Namespace
> it is the path
> to the dtd without the dtd extension.

I can't even parse this.  I get a StringIndexOutOfBounds exception from
xerces (ver 1.2).  I tried another svg example and the same thing happened.
what parser are you using?

When I try to create my own doctype in a similar fashion but without
including the entities that svg is including in the dtd, I end up with a
NO_NAMESPACE namespace so i don't think that the doctype declaration has
anything to do with a default namespace uri of "svg".  I have to think I've
completely missed the boat on your explanation but that wouldn't even be a
valid uri.

> If you do a
> root.getChild("defs"), the
> return is null, but if you do
> root.getChild("defs",root.getNamespace()), you
> get the symbol element.

What!!!  This is why I spent the time with this because this would be a
serious problem, no?

> If I have "glorcked" to much here, and this is just a bug...

I hope not too...

More information about the jdom-interest mailing list