Posted: Sun Feb 09, 2003 3:15 pm Post subject: Empty XML tags, Cardinality and Dynamic References
Novice
Joined: 01 Jul 2002 Posts: 13
Hi,
I'm trying to traverse an XML message tree to remove all empty tags: ie, any tags of the type <A></A> or <A/>.
If my input message looks like this:
<A>
<B>
</B>
<C>
<D>...</D>
</C>
</A>
I would like the output to look like:
<A>
<C>
<D>...</D>
</C>
</A>
My first attempt used dynamic references to step through the message tree and detect all empty tags with a IF TagName = '' test. This had an unfortunate side effect of detecting parent tags as being empty (since they contained no data, only child tags).
I know that a CARDINALITY test will return 0 if a tag is empty and has no child tags. However, I don't know how to incorporate this into the process of stepping through the message tree.
Is there anyway of either combining a cardinality test with dynamic references, or is there some other solution to stepping through the message tree and removing these empty tags?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum