<?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>Question Re: Openxml() syntax problem in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaa-p/13839651#M4870494</link>
    <description>&lt;P&gt;Awesome Ivan!   Not only did your changes work perfectly, I understand a bit better... thanks to your explanations.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2011 22:15:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-04-20T22:15:06Z</dc:date>
    <item>
      <title>Openxml() syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaq-p/13839648</link>
      <description>&lt;P&gt;The lightbulb just isn't turning on in my head... I don't get it.   (Ever have that feeling??) &lt;/P&gt;
&lt;P&gt;Im trying to dig the value of my 'token' out of a mess of XML....   I read the docs, but I just don't follow it, so I just made sure I had the right number of parameters, and copied from code that works.  &lt;BR /&gt;
&lt;/P&gt;
&lt;P&gt;Yet my code doesn't.   It appears to return an empty string, rather than my coveted token value.&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;:::SQL
select * from openxml(

-- xml string
'&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&amp;lt;soapenv:Envelope  
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;
&amp;lt;soapenv:Body&amp;gt;
&amp;lt;ns1:doAuthenticateResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"  xmlns:ns1="http://ws.defgh.com"&amp;gt;
&amp;lt;doAuthenticateReturn xsi:type="ns2:SecurityToken" xmlns:ns2="urn:security.ws.abcd.com"&amp;gt;
&amp;lt;token xsi:type="xsd:string"&amp;gt;8ec45270-67fb-4e08-a0ca-8dee4e9c203c&amp;lt;/token&amp;gt;
&amp;lt;/doAuthenticateReturn&amp;gt;&amp;lt;/ns1:doAuthenticateResponse&amp;gt;
&amp;lt;/soapenv:Body&amp;gt;
&amp;lt;/soapenv:Envelope&amp;gt;',

-- xpath query &amp;amp; flag to map attributes to columns
'/token', 1,

-- list of namespaces in the XML string
'&amp;lt;soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /&amp;gt;'
)
with ( mytoken char(35) 'token' )
&lt;/LI-CODE&gt;
&lt;P&gt;BTW... I'm on 9.0.2&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2011 19:24:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaq-p/13839648</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-20T19:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Openxml() syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaa-p/13839650#M4870493</link>
      <description>&lt;P&gt;Two things I discovered... I misdiagnosed above...I'm not getting an empty string -- instead I'm get no result at all.&lt;/P&gt;
&lt;P&gt;And the other thing is that if I change the xpath query parameter to simply '/'  -- I do get a result record, but it's got a NULL value in mytoken&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2011 21:37:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaa-p/13839650#M4870493</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-20T21:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Openxml() syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaa-p/13839649#M4870492</link>
      <description>&lt;P&gt;I think you want something like the following:&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;:::SQL
select *
from openxml(

-- xml string
'&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&amp;lt;soapenv:Envelope  
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;
&amp;lt;soapenv:Body&amp;gt;
&amp;lt;ns1:doAuthenticateResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"  xmlns:ns1="http://ws.defgh.com"&amp;gt;
&amp;lt;doAuthenticateReturn xsi:type="ns2:SecurityToken" xmlns:ns2="urn:security.ws.abcd.com"&amp;gt;
&amp;lt;token xsi:type="xsd:string"&amp;gt;8ec45270-67fb-4e08-a0ca-8dee4e9c203c&amp;lt;/token&amp;gt;
&amp;lt;/doAuthenticateReturn&amp;gt;&amp;lt;/ns1:doAuthenticateResponse&amp;gt;
&amp;lt;/soapenv:Body&amp;gt;
&amp;lt;/soapenv:Envelope&amp;gt;',

-- xpath query &amp;amp; flag to map attributes to columns
'/soapenv:Envelope/soapenv:Body/ns1:doAuthenticateResponse/doAuthenticateReturn/token', 1,

-- list of namespaces in the XML string
'&amp;lt;soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ns1="http://ws.defgh.com"
/&amp;gt;'
)
with ( mytoken char(36) '.' )
&lt;/LI-CODE&gt;
&lt;P&gt;You should use &lt;CODE&gt;'.'&lt;/CODE&gt; to get the contents of the "token" element, you should use the full expected path to the token tag or perhaps &lt;CODE&gt;'//token'&lt;/CODE&gt; to find a token tag anywhere with any parents. You might want to consider using &lt;CODE&gt;*:foo&lt;/CODE&gt; for namespace wildcards if that is sufficient. If you do declare namespaces you might consider declaring the prefix &lt;CODE&gt;mp&lt;/CODE&gt; bound to &lt;CODE&gt;urn:ianywhere-com:sa-xpath-metaprop&lt;/CODE&gt; so you can access meta properties like @mp:id&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2011 21:58:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaa-p/13839649#M4870492</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-20T21:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Openxml() syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaa-p/13839651#M4870494</link>
      <description>&lt;P&gt;Awesome Ivan!   Not only did your changes work perfectly, I understand a bit better... thanks to your explanations.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2011 22:15:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/openxml-syntax-problem/qaa-p/13839651#M4870494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-20T22:15:06Z</dc:date>
    </item>
  </channel>
</rss>

