As it turns out, my problem is in trying to transform a document from not
using
a namespace to one that does.  And most likely my naivety about namespaces
is
hampering my progress.

Basically, what I do is:  parse an XML file with no default namespace
declared, but
which does use at least "named" namespace prefix (e.g. my:element); that
document
is stored as a DOM tree; parse some text data with my own parser and store
it in
temporary data structures; finally, I generate SAX events based on the
structure of
the first document, but containing the data of the second.

The problem I run into is that I want the document build by the
ContentHandler to
be namespace aware for ALL elements.  What I get when I parse the initial
XML doc
is namespace information (i.e. qName, localName, namespaceURI) defined on
only the
elements with a specific prefix (e.g. my:element returns:
qName="my:element",
localName="element", namespaceURI="http://www.my.com";).  For any elements
who don't
have a prefix, I get null for all the values (which causes a 'DOM002 Illegal
character'
error when I try to createElementNS in the ContentHandler).

I've tried defining a default namespace (xmlns="http:/www.your.com") in the
input
XML, but that made no difference.  I've also tried checking the namespace
information
of each element before I perform a createElementNS -- if it's null, then
change it
to "" since I don't want bogus namespaces.  That does not work either.

Also, Andy mentioned, as far as my doctype is concerned, that I should try
removing
it after creating the document, but I get a 'DOM008 Not found' exception
using the
method call:  doc.removeChild(doctypeNode); where 'doc' is my newly-created
Document
and 'doctypeNode' is the doctype I created to allow me to create a Document
(I know
I can create a new Document using DocumentBuilder, so this is less of a
problem and
more of a "just wanted to let you know...")

Thanks for all the help.

Brion Swanson

-----Original Message-----
From: Edwin Goei [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2001 8:31 PM
To: [EMAIL PROTECTED]
Subject: Re: creating an null DOCTYPE in Xerces2

If you want an empty Document object, then I'd say you can just use JAXP
to do it instead of DOM.  What problems are you having with this
solution?

-Edwin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to