Customer Portal

How to capture [element contents] in XML Extract or else?

Comments 4

  • Avatar
    admin
    0
    Comment actions Permalink
    Hi evanchen,

    what you want is directly not possible. I would recommend to do some kind of xml text preprocessing. You can:

    1] remove unwanted elements "<definition>" and "</definition>" (eg. by CTL2 function 'replace(orig, "<definition>", "")')
    2] somehow escape XML control characters of unwanted elements (eg. by CTL2 function 'replace(orig, "<definition>", "&lt;definition&gt;")')

    Then it will be readable by XmlExtract as you want.
  • Avatar
    evanchen
    0
    Comment actions Permalink
    Hi Jaroslav,

    Thanks again for you support, actually my case is more complicated than I mentioned in the previous example. my current case is as below:

    ex:
    <list>
    <Entity key="alpha">
    <definition>DEFINE1</definition>
    <attribute>ATTRIBUTE1</attribute>
    <metric>METRIC1</metric>

    </Entity>
    <Entity key="beta">
    <definition>DEFINE2</definition>
    <attribute>ATTRIBUTE2</attribute>
    <metric>METRIC3</metric>

    </Entity>
    </list>

    and I need to keep those blue values entirely in the output port, do you know if other component such as XSLTransformer and XMLXPathReader can work for this request? if so, any examples?
  • Avatar
    admin
    0
    Comment actions Permalink
    Hi evanchen,

    Please take a look on attached graph, try to debug in and observe values on edges.
  • Avatar
    evanchen
    0
    Comment actions Permalink
    Hello Jaroslav,

    Thanks for your example!

    I had thought out the similar approach, but your CTL2 code seems more elegant. :D

Please sign in to leave a comment.