XML namespaces can be used for more than defining namespace prefixes and using those prefixes with element names. You can also define default namespaces for elements using the xmlns attribute. To query elements with default namespaces you must call XmlSetNamespaces using a prefix name. The prefix name can later be used in an X-Path query.
See the following document:
<root> <child1 xmlns=’MyName1’>value1</child1> </root>
To execute a query like /root/child1 you must define the namespace of child1 with XmlSetNamespaces using a self-defined prefix.
dcltrans transaction TMain var hDoc, hChild : number; sValue, sXML : string; begin hDoc := XmlCreateDocumentFromXml("<root><child1 xmlns=’MyName1’>value1<child></root>"); XmlSetNamespaces(hDoc, "xmlns:myprefix='MyName1'"); hChild := XmlSelectSingleNode("/root/myprefix:child"); ... XmlFreeHandle(hChild); XmlFreeHandle(hDoc); end TMain;