DTD plug'n play [was Re: [jdom-interest] Problem with Element.getChildren()]

Christophe D. Laprun chris.laprun at nist.gov
Thu Aug 17 15:05:30 PDT 2000


Hi all,

> In the past, we had getChildren() called without a specified namespace
> match any children with the given local name regardless of namespace.
> Things were changed this way (where no namespace means no namespace) to
> be truer to XML.  I don't see an easy middle ground, and considering new
> Element("foo") creates an element with no namespace not the default
> namespace, it's only right for getChildren("foo") to retrieve that same
> element.

Is there a way to retrieve all the defined namespaces in a document ?
The application I'm working on will users to specify their own
components to parse the content of (otherwise) specified elements so
that they can extend the expressive power of the application without
having to modify the DTD. I was thinking about using namespaces to
distinguish between standard and specific elements. What I am trying to
do is basically DTD plug and play where users can specify their own
external DTD to change the logic of elements while still using a
skeleton that I will provide.
Example:

<std:element>
  <param type="int">12</param>
</std:element>

<extension:element>
  <param type="float">12.0</param>
</extension:element>

when parsed std:element will load the standard component able to
"understand" the content of element but when extension:element is
parsed, the application should load another component. I was considering
basing the look-up of components on namespaces. The problem is that the
namespaces won't be known before parsing the document. Is there a way
(using JDOM) to retrieve all the declared namespaces of a given document
? Also, if validation is on, is declaring namespaces with a reference to
external DTDs enough to ensure validation of the document, i.e. in the
previous example, will SAXBuilder use the DTD defined by the "extension"
namespace to validate all extension:element elements ? If not, how can I
do that ?

Sorry if this is a little bit off topic.

Regards,

Chris
-- 
Christophe Laprun    [Ingenieur ISIMA, France / Guest researcher @NIST]
web: http://www.nist.gov/speech/staff/laprunch.htm
email: chris.laprun at nist.gov
phone: (301) 975 3191             fax: (301) 670 0939
--
The universe seems neither benign nor hostile, merely indifferent -
Sagan



More information about the jdom-interest mailing list