Topic
  • 3 replies
  • Latest Post - ‏2012-11-10T13:03:01Z by SystemAdmin
SystemAdmin
SystemAdmin
6772 Posts

Pinned topic Convert String to XML nodeset in Data power

‏2012-11-08T19:47:24Z |
I am facing an issue ... i need to convert a string to XML which is extracted from a CDATA tag and need to validate this XML against some XSD
For E.g like mentioned below

<DATA>
<![CDATA<innerXML> <abc></abc> <xyz></xyz> </innerXML>]>
</DATA>

But when ever i am extracting this inside xml i always found this as of String Type.
HermannSW expecting some help from your side.
Updated on 2012-11-10T13:03:01Z at 2012-11-10T13:03:01Z by SystemAdmin
  • kenhygh
    kenhygh
    1617 Posts

    Re: Convert String to XML nodeset in Data power

    ‏2012-11-08T20:43:54Z  
    dp:parse() is your friend.

    Ken
  • HermannSW
    HermannSW
    4901 Posts

    Re: Convert String to XML nodeset in Data power

    ‏2012-11-08T21:59:12Z  
    • kenhygh
    • ‏2012-11-08T20:43:54Z
    dp:parse() is your friend.

    Ken
    Ken is right, the text in <DATA> element need's to get "dp:parsed".

    Here you can see the difference:
    $ xpath++ "/DATA" cdata.xml 
    <DATA>
    &​lt;innerXML> &​lt;abc>&​lt;/abc> &​lt;xyz>&​lt;/xyz> &​lt;/innerXML>
    </DATA>
    $ xpath++ "dp:parse(/DATA)" cdata.xml 
    <innerXML> <abc/> <xyz/> </innerXML>
    $
    


    Hermann <myXsltBlog/> <myXsltTweets/>
    Updated on 2014-03-25T02:46:03Z at 2014-03-25T02:46:03Z by iron-man
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: Convert String to XML nodeset in Data power

    ‏2012-11-10T13:03:01Z  
    • HermannSW
    • ‏2012-11-08T21:59:12Z
    Ken is right, the text in <DATA> element need's to get "dp:parsed".

    Here you can see the difference:
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">$ xpath++ "/DATA" cdata.xml <DATA> &​lt;innerXML> &​lt;abc>&​lt;/abc> &​lt;xyz>&​lt;/xyz> &​lt;/innerXML> </DATA> $ xpath++ "dp:parse(/DATA)" cdata.xml <innerXML> <abc/> <xyz/> </innerXML> $ </pre>

    Hermann <myXsltBlog/> <myXsltTweets/>
    Thanks Ken and Hermann for your help.