J
jl
Hi everybody!
I have an interesting problem - and so far, I haven't been able to
solve it. Maybe somebody else has an idea...
I have a source xml structure that comes from a legacy system. It is
somewhat similar to a database structure:
<data>
<fieldnames>
<name>Column 1</name>
<name>Column 2</name>
...
</fieldnames>
<rows>
<row id="1">
<value>Value 1</value>
<value>Value 2</value>
...
</row>
<row id="2">
....
</row>
</rows>
</data>
This should be tranformed to a structure much like this:
<data>
<record id="1">
<col1>Value 1</col1>
<col2>Value 2</col2>
...
</record>
<record id="2">
...
</record>
</data>
All of this wouldn't be too hard if I could hard-code the respective
column indices, i.e. if 'Column 1' was alwas at position 1 etc. But
unfortunately that is not always the case - the columns can 'switch
places' - and therefore I cannot select <value> tags according to their
'position()'.
I am at a loss here - any ideas?
Thanks,
Joerg
I have an interesting problem - and so far, I haven't been able to
solve it. Maybe somebody else has an idea...
I have a source xml structure that comes from a legacy system. It is
somewhat similar to a database structure:
<data>
<fieldnames>
<name>Column 1</name>
<name>Column 2</name>
...
</fieldnames>
<rows>
<row id="1">
<value>Value 1</value>
<value>Value 2</value>
...
</row>
<row id="2">
....
</row>
</rows>
</data>
This should be tranformed to a structure much like this:
<data>
<record id="1">
<col1>Value 1</col1>
<col2>Value 2</col2>
...
</record>
<record id="2">
...
</record>
</data>
All of this wouldn't be too hard if I could hard-code the respective
column indices, i.e. if 'Column 1' was alwas at position 1 etc. But
unfortunately that is not always the case - the columns can 'switch
places' - and therefore I cannot select <value> tags according to their
'position()'.
I am at a loss here - any ideas?
Thanks,
Joerg