[jdom-interest] question on namespaces
Frank.Sauer at trcinc.com
Mon Jun 3 07:02:36 PDT 2002
I didn't really mean text, that was poorly stated.
I do want to treat them as elements, just not elements
that have to be interpreted as fpl commands, but elements
that simply need to be copied to the output. I did figure
this problem out however. The trick was to instruct the
node factory to create a certain class for all elements
not in the fpl namespace, and that class would - when being
processed - simply write the element to the output and recurse
down the tree to output more or process fpl commands down that
part of the tree. I did realize that validation is pretty much out,
so I gave up on that idea.
Question, how do xml editors like XMLSPy validate XSLT stylesheets?
How can it allow for ANY type of content in say an <xsl:template>?
From: Alex Rosen [mailto:arosen at silverstream.com]
Sent: Monday, June 03, 2002 9:53 AM
To: Frank Sauer; jdom-interest at jdom.org
Subject: RE: [jdom-interest] question on namespaces
You're trying to treat all the elements that aren't in the fpl namespace as text? That's not legitimate XML - your <script> tag is an element, not text, whether you're using JDOM or any other mechanism. To make it be text, you need to wrap it in a CDATA section, or use <script>.
In general, DTDs and namespaces work very poorly together. It's possible to modify a DTD to work with namespaces, but only if you require that the particular prefix that you've used in your DTD is the one that's used in each document. That works, but it pretty much goes against the intent and the usefulness of namespaces. On the other hand schemas are namespace-aware, though they're newer and more complicated.
These issues are particularly related to JDOM itself. You can probably find info about all these types of things in articles on sites like xml.com.
> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Frank Sauer
> Sent: Thursday, May 30, 2002 12:00 PM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] question on namespaces
> I apologize if this is a FAQ, but I could not find it there
> or in the archives.
> I have a need to process files much like XSLT files that look
> like this:
> <fpl:frame xmlns:fpl="some uri">
> <fpl:break name="script">
> <fpl:break name="header">
> In other words, I need to process the elements in the namespace
> identified by the fpl: prefix but simply consider everything
> else as content.
> Can anyone out there show me how to set up jdom to do this?
> Can validation be used in this scenario? I have a DTD for the
> fpl tags but it
> does not use namespaces. Can it? What's a good place to find
> info on this?
> I used the jdom node factory to instantiate my own Element
> subclasses for the
> recognized fpl commands, but now I have a need to add
> namespaces to it so it is
> easier to include xml/html like content without the need for CDATA.
> Frank Sauer
> The Technical Resource Connection, Inc.
> a wholly owned subsidiary of Perot Systems
> Tampa, FL
> "If you don't know where you're going, any road will take you
> there" --
> Lewis Carroll
> To control your jdom-interest membership:
uraddr at yourhost.com
More information about the jdom-interest