[jdom-interest] XPath expression / Jython / JDOM

Espen Falkevik sp1_falkevik at yahoo.com
Tue Jun 21 07:01:36 PDT 2005


Hi.
I have a problem with my XPath expression, I can't
seem to get any result when I use the
selectSingleNode. The code is written in Jython

The XML file looks like this:
<?xml version="1.0" ?> 
<Configuration xmlns="http://www.w3.org/1999/xhtml">
<Audio>1</Audio>
</Configuration>

I get my XML-file using http to a web site:
url =
URL("http://10.0.0.1/getxml?location=/Configuration/Audio")
builder = SAXBuilder("org.ccil.cowan.tagsoup.Parser")
doc = builder.build(url)
print doc.toString()
gives: [Document:  No DOCTYPE declaration, Root is
[Element: <html [Namespace:
http://www.w3.org/1999/xhtml]/>]]

Then I try to use XPath:
xp = JDOMXPath("//xmlns:Audio")	
xp.addNamespace("xmlns","http://www.w3.org/1999/xhtml")
node = xp.selectSingleNode(doc)

but this always gives node = null.

Can someone tell me what I'm doing wrong??

-espen-



	
	
		
___________________________________________________________

Yahoo! Messenger - NEW crystal clear PC to PC calling
worldwide with voicemail http://uk.messenger.yahoo.com


	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com


More information about the jdom-interest mailing list