Hi Master,
With "XML Extract" how can I treat the [element contents] under <Entity> element in ex1 as the same as in ex2?
ex1:
<list>
<Entity key="alpha">
<definition>DEFINE1</definition>
</Entity>
<Entity key="beta">
<definition>DEFINE2</definition>
</Entity>
</list>
ex2:
<list>
<Entity key="alpha">
DEFINE1
</Entity>
<Entity key="beta">
DEFINE2
</Entity>
</list>
In another word, how could I get the structured data once transforming ex1 into Clover metadata as below?
Key Attribute
alpha <definition>DEFINE1</definition>
beta <definition>DEFINE2</definition>
I tried to map that [element contents] to a Clover Field in "Mapping" tab of "XML Extract", but the values in the result are null, I assume that in general all the elements included in <> need be predefined to make them identified. Is there any possibility to escape this criterion at such XML level?
I will appreciate any of your ideas or workaround solutions.
Thanks,
With "XML Extract" how can I treat the [element contents] under <Entity> element in ex1 as the same as in ex2?
ex1:
<list>
<Entity key="alpha">
<definition>DEFINE1</definition>
</Entity>
<Entity key="beta">
<definition>DEFINE2</definition>
</Entity>
</list>
ex2:
<list>
<Entity key="alpha">
DEFINE1
</Entity>
<Entity key="beta">
DEFINE2
</Entity>
</list>
In another word, how could I get the structured data once transforming ex1 into Clover metadata as below?
Key Attribute
alpha <definition>DEFINE1</definition>
beta <definition>DEFINE2</definition>
I tried to map that [element contents] to a Clover Field in "Mapping" tab of "XML Extract", but the values in the result are null, I assume that in general all the elements included in <> need be predefined to make them identified. Is there any possibility to escape this criterion at such XML level?
I will appreciate any of your ideas or workaround solutions.
Thanks,
-
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>", "<definition>")')
Then it will be readable by XmlExtract as you want. -
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? -
Hi evanchen,
Please take a look on attached graph, try to debug in and observe values on edges. -
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.
Comments 4