<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic XPath Query() and XML namespaces in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/XPath-Query-and-XML-namespaces/m-p/281432#M54503</link>
    <description>&lt;P&gt;I have a bunch of XML documents that I want to put into a data column. I want to use&amp;nbsp;XPath expressions to pull out values from them, by appending columns that contain formulas that make use of the&amp;nbsp;XPath Query() function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some of my documents have XML-namespace qualified element names. For example, one might look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;synopsis xmlns="http://www.cap.org/pert/2009/01/" xmlns:colon="http://www.cap.org/pert/2009/01/colon/"&amp;gt;
    &amp;lt;clinical&amp;gt;
        &amp;lt;clinicalFindings&amp;gt;
            &amp;lt;clinicalFinding value="mass"/&amp;gt;
        &amp;lt;/clinicalFindings&amp;gt;
    &amp;lt;/clinical&amp;gt;
    &amp;lt;specimen&amp;gt;
        &amp;lt;procedures&amp;gt;
            &amp;lt;colon:procedure value="segmental colectomy"/&amp;gt;
        &amp;lt;/procedures&amp;gt;
        &amp;lt;sites&amp;gt;
            &amp;lt;colon:site value="cecum" primary="true"/&amp;gt;
        &amp;lt;/sites&amp;gt;
        &amp;lt;tumorLocations&amp;gt;
            &amp;lt;colon:tumorLocation value="cecum"/&amp;gt;
        &amp;lt;/tumorLocations&amp;gt;
    &amp;lt;/specimen&amp;gt;
&amp;lt;/synopsis&amp;gt;&lt;/PRE&gt;&lt;P&gt;It appears that&amp;nbsp;Xpath Query() can't understand namespace-qualified names. It gives an XPath error for an XPath of &amp;nbsp;"/synopsis/specimen/sites/colon:site/&lt;I&gt;@value&lt;/I&gt;" or of "/default:synopsis/default:specimen/default:sites/colon:site/&lt;I&gt;@value&lt;/I&gt;".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I remove all namespace qualification, it seems to do okay. Unfortunately for me, my documents use XML namespaces a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have experience with the&amp;nbsp;XPath Query() function? Is there a way to make it XML-namespace aware?&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 23:33:11 GMT</pubDate>
    <dc:creator>john_madden</dc:creator>
    <dc:date>2023-06-09T23:33:11Z</dc:date>
    <item>
      <title>XPath Query() and XML namespaces</title>
      <link>https://community.jmp.com/t5/Discussions/XPath-Query-and-XML-namespaces/m-p/281432#M54503</link>
      <description>&lt;P&gt;I have a bunch of XML documents that I want to put into a data column. I want to use&amp;nbsp;XPath expressions to pull out values from them, by appending columns that contain formulas that make use of the&amp;nbsp;XPath Query() function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some of my documents have XML-namespace qualified element names. For example, one might look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;synopsis xmlns="http://www.cap.org/pert/2009/01/" xmlns:colon="http://www.cap.org/pert/2009/01/colon/"&amp;gt;
    &amp;lt;clinical&amp;gt;
        &amp;lt;clinicalFindings&amp;gt;
            &amp;lt;clinicalFinding value="mass"/&amp;gt;
        &amp;lt;/clinicalFindings&amp;gt;
    &amp;lt;/clinical&amp;gt;
    &amp;lt;specimen&amp;gt;
        &amp;lt;procedures&amp;gt;
            &amp;lt;colon:procedure value="segmental colectomy"/&amp;gt;
        &amp;lt;/procedures&amp;gt;
        &amp;lt;sites&amp;gt;
            &amp;lt;colon:site value="cecum" primary="true"/&amp;gt;
        &amp;lt;/sites&amp;gt;
        &amp;lt;tumorLocations&amp;gt;
            &amp;lt;colon:tumorLocation value="cecum"/&amp;gt;
        &amp;lt;/tumorLocations&amp;gt;
    &amp;lt;/specimen&amp;gt;
&amp;lt;/synopsis&amp;gt;&lt;/PRE&gt;&lt;P&gt;It appears that&amp;nbsp;Xpath Query() can't understand namespace-qualified names. It gives an XPath error for an XPath of &amp;nbsp;"/synopsis/specimen/sites/colon:site/&lt;I&gt;@value&lt;/I&gt;" or of "/default:synopsis/default:specimen/default:sites/colon:site/&lt;I&gt;@value&lt;/I&gt;".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I remove all namespace qualification, it seems to do okay. Unfortunately for me, my documents use XML namespaces a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have experience with the&amp;nbsp;XPath Query() function? Is there a way to make it XML-namespace aware?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:33:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/XPath-Query-and-XML-namespaces/m-p/281432#M54503</guid>
      <dc:creator>john_madden</dc:creator>
      <dc:date>2023-06-09T23:33:11Z</dc:date>
    </item>
  </channel>
</rss>

