Djakisback <[EMAIL PROTECTED]> wrote on 06/05/2006 05:47:59 PM: > > Hi, > I'd like to get a DeferredNode with getNodeObject() of DeferredDocumentImpl > but it doesn't work like I'd want. Maybe someone could help me ? Here is my > code : > > DocumentBuilderFactoryImpl factory = new > DocumentBuilderFactoryImpl(); > DocumentBuilderImpl DOMParser = > (DocumentBuilderImpl)factory.newDocumentBuilder(); > DeferredDocumentImpl domTree = > (DeferredDocumentImpl)DOMParser.parse(new FileInputStream(fileName)); > > domTree.getNodeObject(1); > domTree.getNodeObject(2); > domTree.getNodeObject(3); > domTree.getNodeObject(4); > domTree.getNodeObject(5); > etc... > > All theses lines : "domTree.getNodeObject(n);" make an > IllegalArgumentException : -1 > Is someone could say me how I can get a node object in a > DeferredDocumentImpl from its fNodeIndex ?
What you are trying to do isn't supported. getNodeObject() is an internal method which must only be called by Xerces' DOM implementation. If you call it directly (assuming it doesn't fail immediately) it will probably corrupt the DOM since the node it returns will never be initialized properly. Coding to the implementation is usually a bad idea. You could have easily written the above using JAXP as: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new FileInputStream(fileName)); ... > Thank's for all. > Bye :) > > -- > View this message in context: http://www.nabble.com/usage-of- > getNodeObject%28%29-t1738026.html#a4723034 > Sent from the Xerces - J - Users forum at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
