java - org.apache.xerces.dom.DeferredDocumentImpl incompatible with org.dom4j.Document -


After text "itemprop =" text ">

Im reading some RSS from a URL and facing some difficulties. Initially I had a direct implementation like this:

  SAXReader reader = new SAXReader (); Document Doctor = Reader Read (new url (s url));   

However, if my response was very slow, I did not get permission to terminate this request. So I have changed it to:

  Public static org.dom4j.Document ReadXml (InputStream) throws SAXException, IOException, ParserConfigurationException {DocumentBuilderFactory DBF = DocumentBuilderFactory.newInstance (); Dbf.setValidating (wrong); Dbf.setIgnoringComments (incorrect); Dbf.setIgnoringElementContentWhitespace (true); Dbf.setNamespaceAware (true); DocumentBuilder DB = Faucet; Db = dbf.newDocumentBuilder (); Return (org.dom4j.Document) is db.parse (); } SAXReader Reader = new SAXReader (); Url myUrl = new URL (s url); URL Connection c = myUrl.openConnection (); C.setConnectTimeout (10000); C.setReadTimeout (10000); Org.dom4j.Document doc = readXml (c.getInputStream ()); Element root = doc.getRootElement ();   

Trying this, I get an annoosing error:

  with org.apache.xerces.dom.DeferredDocumentImpl org.dom4j.Document Incompatible   

How can I avoid this? None of the above methods is to return the type of document, and I also try to enter the correct document type.

Edit: The problem is DB The text "itemprop =" text ">

after PRSE (is) returns ORG.w3c.dom ..

make sure your element is the type of org.dom4j.Element and not org.w3c.dom , javax.bind.xml ,

etc. In other words, the Dom4j API is not compatible with Java's built-in XML API. The two do not blend together, unless you work with strings (for example, create XML in dom4j and parse Java's XML or vice versa).

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -