cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
john_madden
Level VI

XPath Query() and XML namespaces

I have a bunch of XML documents that I want to put into a data column. I want to use XPath expressions to pull out values from them, by appending columns that contain formulas that make use of the XPath Query() function.

 

Some of my documents have XML-namespace qualified element names. For example, one might look like this:

 

<?xml version="1.0" encoding="UTF-8"?>
<synopsis xmlns="http://www.cap.org/pert/2009/01/" xmlns:colon="http://www.cap.org/pert/2009/01/colon/">
    <clinical>
        <clinicalFindings>
            <clinicalFinding value="mass"/>
        </clinicalFindings>
    </clinical>
    <specimen>
        <procedures>
            <colon:procedure value="segmental colectomy"/>
        </procedures>
        <sites>
            <colon:site value="cecum" primary="true"/>
        </sites>
        <tumorLocations>
            <colon:tumorLocation value="cecum"/>
        </tumorLocations>
    </specimen>
</synopsis>

It appears that Xpath Query() can't understand namespace-qualified names. It gives an XPath error for an XPath of  "/synopsis/specimen/sites/colon:site/@value" or of "/default:synopsis/default:specimen/default:sites/colon:site/@value".

 

If I remove all namespace qualification, it seems to do okay. Unfortunately for me, my documents use XML namespaces a lot.

 

 

Does anyone have experience with the XPath Query() function? Is there a way to make it XML-namespace aware?

0 REPLIES 0