foo monkey
Thu, 21 Dec 2006 09:13:51 -0800
I guess this brings up a more fundamental question. The XML I am needing to parse is coming to me as the body of a JMS message. So, I have a String that contains the XML. I was using the DocumentHelper.parseText method to create the Document object which I was using. Is there another class/method I should use to load the XML into a DOM Document object? I could not figure out another way to do that. Thanks. Andrew On 12/21/06, foo monkey <[EMAIL PROTECTED]> wrote:
Using the setXPathNamespaceURIs method? setXPathNamespaceURIs public void *setXPathNamespaceURIs*(Map <http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html> namespaceURIs) Sets the namespace URIs to be used by XPath expressions created by this factory or by nodes associated with this factory. The keys are namespace prefixes and the values are namespace URIs. *Parameters:*namespaceURIs - DOCUMENT ME! On 12/21/06, Evan Kirkconnell <[EMAIL PROTECTED]> wrote: > > You can map the namespaces in your DocumentFactory and this will apply > to the <Node>.selectNodes() function for nodes within the document > created by the DocumentFactory. > --Evan > > foo monkey wrote: > > SchemaVersion is an element in the document. This code seems to imply > > to me that I need to create a separate XPath object for each element I > > want to search for. Is that correct? > > > > On 12/21/06, *Edwin Dankert* <[EMAIL PROTECTED] > > <[EMAIL PROTECTED]>> wrote: > > > > The adapted code: > > > > //SchemaVersion > > Document doc = DocumentHelper.parseText (msgText); > > XPath xp = > > DocumentFactory.getInstance > ().createXPath("//prefix:SchemaVersion"); > > Map ns = new HashMap(); > > ns.put ( "prefix"," http://bpm.tibco.com/2004/IAP/MED/1.2/MED"); > > xp.setNamespaceURIs( ns); > > List nodes = xp.selectNodes(doc.getRootElement()); > > > > Regards, > > Edwin > > -- > > http://www.edankert.com/ > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to > > share your > > opinions on IT & business topics through brief surveys - and earn > cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > _______________________________________________ > > dom4j-user mailing list > > dom4j-user@lists.sourceforge.net > > <mailto: dom4j-user@lists.sourceforge.net> > > https://lists.sourceforge.net/lists/listinfo/dom4j-user > > > > > > > > > > -- > > "The future will be better tomorrow" > > -- Al Gore > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > dom4j-user mailing list > dom4j-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dom4j-user > -- "The future will be better tomorrow" -- Al Gore
-- "The future will be better tomorrow" -- Al Gore
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user