You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by SB <st...@cyberspace.org> on 2002/05/23 15:11:39 UTC

HTML - DOMParser (bug?)

The following program works correctly with xerces-1.4.4, but not 
with 2.0.1. Is this a bug?


import org.w3c.dom.*;
import org.w3c.dom.html.*;
import org.apache.html.dom.*;
import org.apache.xerces.parsers.*;
import org.xml.sax.*;
import java.io.StringReader;
 
public class TestHtml {
 
        public static void main (String[] args)
        {
                String html = "<html><head><title>T</title></head><body>hello </body></html>";
                DOMParser domp = new DOMParser();
                try {
                domp.setProperty("http://apache.org/xml/properties/dom/document-class-name",
                                "org.apache.html.dom.HTMLDocumentImpl");
 
                        domp.parse(new InputSource(new StringReader (html)));
                }
                catch (Exception e) {
                        System.out.println ("Error in parsing "+ e.getMessage());
                }
                HTMLDocument d = (HTMLDocument)domp.getDocument();
                System.out.println ("Title: "  + d.getTitle());
                System.out.println ("#forms: " + d.getForms().getLength());
 
 
        }
 
}

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: HTML - DOMParser (bug?)

Posted by SB <st...@cyberspace.org>.
thanks for the response, I will try with the jars from
the daily build.
I would like to know if the HTML DOM implementation
in 2.0.1 has a great improvement compared to that in
1.4.4. Can I get a list of changes in HTML DOM
implementation somewhere?

thanks, st.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: HTML - DOMParser (bug?)

Posted by Andy Clark <an...@apache.org>.
SB wrote:
> The following program works correctly with xerces-1.4.4, but not
> with 2.0.1. Is this a bug?

A bug was introduced indirectly to the HTML DOM from a
change that was made in the base XML DOM implementation
in Xerces 2.0.1. Either use version 2.0.0 or grab the
jars from the daily build:

  http://gump.covalent.net/jars/latest/xml-xerces2/

-- 
Andy Clark * andyc@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org