You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Ryan Schmidt <ry...@cpsc.ucalgary.ca> on 2000/06/14 05:41:20 UTC

DOMParser has weird > handling...

I'm having a small problem here...I'm reading in an XML document
that has a bunch of lines like this:

 <Skills>Language -&gt; Java; Tool -&gt;"Visual Age"</Skills>

When I do this and serialize the document, the output looks
just like the input. However, if I do the following (which
I'm not entirely sure is correct, someone please tell me if it's not...)

	NodeList nodes = doc.getElementsByTagName("Skills");
	for(int i = 0; i < nodes.getLength(); i++){
		Element e = (Element)nodes.item(i);
		Text t = (Text)e.getFirstChild();
		if(t != null)
			System.out.println(t.getNodeValue());
	}

But this doesn't give me the output I want. I get:

  Language -

And that's it. Now, If I follow down the nextSibling chain of the
Text node I can get the properly formatted string

  Language -> Java; Tool -> "Visual Age"

But this seems awkward. Is there some other way to do this? Any
suggestions would be appreciated.

TIA,
-RMS

Re: DOMParser has weird > handling...

Posted by Ryan Schmidt <ry...@cpsc.ucalgary.ca>.
Ok, I'll take a crack at it, but I might need a few pointers.

Right now I'm poking around in XMLDocumentScanner and UTF8Reader
(which I'm starting to think isn't the right place to be).

My real question is this: where do Text nodes get created in
DOMParser? I always use Document.createText(...), but
I can't find any references to this method in DOMParser. Is
it in another class, or is there another way to create Text
nodes? 

Any info would be appreciated,
-RMS

Andy Clark wrote:
> 
> Ryan Schmidt wrote:
> >  <Skills>Language -&gt; Java; Tool -&gt;"Visual Age"</Skills>
> 
> This is a known bug. If you implement a fix in the DOMParser and/or
> DocumentImpl/DeferredDocumentImpl, I'd be more than happy to apply
> the patch for you.
> 
> --
> Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

Re: DOMParser has weird > handling...

Posted by Andy Clark <an...@apache.org>.
Ryan Schmidt wrote:
>  <Skills>Language -&gt; Java; Tool -&gt;"Visual Age"</Skills>

This is a known bug. If you implement a fix in the DOMParser and/or
DocumentImpl/DeferredDocumentImpl, I'd be more than happy to apply
the patch for you.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org