• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question about xpath

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am testing the XML publishing feature of Informix 11.5, everything works fine for xml input that without namespace.

My question is if i insert a xml with namespace as follow:

<?xml version = '1.0' encoding = 'UTF-8'?><OMG_O19 xmlns="urn:hl7-org:v2xml"> <MSH> <MSH.1>|</MSH.1> <MSH.2>^~\&</MSH.2> <MSH.3> <HD.1>ABCDE</HD.1> </MSH.3> </MSH> </OMG_O19>

when i try query the MSH.3/HD.1 value by this xpath : /OMG_019/MSH/MSH.3/HD.1, i got null returned.

Can someone kindly test me that where should i put the namespace info inside the xpath? or i need to specify it before i use the xpath to perform query?

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know that product specifically, but in general you have to specify a namespace context for the XPath expression. And yes, that has to be done separately from specifying the expression. As I said I don't know how you would do that in your Informix product.

Also, you can't use an XPath 1.0 expression to locate nodes which are in the default namespace. You should change the XPath expression to specify a namespace prefix, and use your namespace context to specify that this prefix identifies the namespace URL in the document.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In vtd-xml you can declare name space using AutoPilot's declareXPathNamespace() function..
then you can insert namespaces into an XPath expression

http://vtd-xml.sf.net has tutorials on that
 
We're all out of roofs. But we still have tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic