I've run into some strange behavior regarding PCDATA.  The first time I parse 
my document the DOM gets built exactly as I expect.  The second time I parse 
the same document my DOM is missing text nodes.  I only see this behavior when 
I'm using an external DTD and declare at least one external entity.

I don't know if this is a problem with my code, my documents or what.  Has 
anyone seen anything like this?

I'm using 2.3 with the DOM3 build.  The program (ReproText.java), document 
(ReproText.xml) and dtd (ReproText.dtd) are pasted below.  Note that the 
external entity declarations are also missing when we write out the second 
time.  I also got the same results using DOMBuilderImpl instead of 
DOMASBuilderImpl.

*************************************** ReproText.java 
***************************
public class ReproText {

        public static void main(String[] args) {

                try {

                        DOMASBuilderImpl test = new DOMASBuilderImpl();
                        Document d = test.parseURI("ReproText.xml");
                        DOMWriter writer = new DOMWriterImpl();
                        writer.writeNode(System.out, d);

                        test = new DOMASBuilderImpl();
                        d = test.parseURI("ReproText.xml");
                        writer = new DOMWriterImpl();
                        writer.writeNode(System.out, d);
                } catch (Exception e) {
                        e.printStackTrace();    
                }
        }
}

***********************************  ReproText.xml  
**********************************

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE person SYSTEM "ReproText.dtd"
[<!ENTITY e SYSTEM "entity.xml">]>

<person>
        <person-name> me </person-name>
        <person-email> [EMAIL PROTECTED] </person-email>
        <other> moreinfo </other>
</person>

***********************************  ReproText.dtd  
**********************************
<!ELEMENT person (person-name, person-email, other)>
<!ELEMENT person-name (#PCDATA)>
<!ELEMENT person-email (#PCDATA)>
<!ELEMENT other (#PCDATA)>



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

Reply via email to