on 09-08-2006 2:26 PM
Hi,
I have a source XML:
<root>
<record>
<itemA>
<id>1</id>
</itemA>
<itemB>
</itemB>
<itemA>
<id>2</id>
</itemA>
<itemA>
<id>3</id>
</itemA>
<itemB>
</itemB>
</record>
</root>
And, the target needs to look like:
<root>
<record>
<itemA>
<id>1</id>
</itemA>
<itemB>
<id>1</id>
</itemB>
<itemA>
<id>2</id>
</itemA>
<itemA>
<id>3</id>
</itemA>
<itemB>
<id>3</id>
</itemB>
</root>
In summary:
1. (easy) an element "itemB/id" needs to be created only when "itemB" exists. In the target XSD, "itemB/id" is optional.
2. (hard or impossible) the value of "itemB/id" is equal to the "itemA/id" right before it in the source XML.
Is this possible?
Thanks in advance for any help,
Bill
Hi William ,
Please confirm your data types .
If you have data types like this-
Source Data type
=================
<recordSet>1..1
<record> 1..unbounded
<itemA> 0..1
<id> 0..1
<itemB>0..1
<id> 0..1
Target Data type
==================
<recordSet>1..1
<record> 1..unbounded
<itemA> 0..1
<id> 0..1
<itemB>0..1
<id> 0..1
Then you can attain the target structure mapping you expected ..
Sample test data with source and target message types..
Please confirm this ..
Source Structure -
=================
<root>
<recordSet>
<record>
<itemA>
<id>1</id>
</itemA>
<itemB>
</itemB>
</record>
<record>
<itemA>
<id>2</id>
</itemA>
</record>
<record>
<itemA>
<id>3</id>
</itemA>
<itemB>
</itemB>
</record>
</recordSet>
</root>
Target Structure -
=================
<root>
<recordSet>
<record>
<itemA>
<id>1</id>
</itemA>
<itemB>
<id>1</id>
</itemB>
</record>
<record>
<itemA>
<id>2</id>
</itemA>
</record>
<record>
<itemA>
<id>3</id>
</itemA>
<itemB>
<id>3</id>
</itemB>
</record>
</recordSet>
</root>
Please let me know if you need any further information
Nanda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nanda,
Unfortunately, <itemA> and <itemB> are not grouped together by <record>. Pls see the original post.
I admit, this XML document does not conform to the spirit of the XML standard. It contains structure/hiearchial information which cannot be determined just by looking at the XSD.
But, this is the document created by the source system, with that embedded information. And, it cannot be changed.
Regards,
Bill
Really weird XML...
Can you give me your XSD of your XML?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
what if you would take values to one array (assuming you have SP14 - global array) in UDF
and then in the table you'd have:
A has a value 1
B exits context change
A has a value 2
B does not exit nothing in the array
A has a value 3
so you would end up with
an array like:
1
context
2
3
then based on this I believe you could
create correct context changes in RECORD tag
(you can check the array - <b>if a context exists
fill itemB it with i = i -1</b> )
and fill them correctly in <itemA> and <itemB>
I didn't test it but maybe it could be possible ?
Regards,
michal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
I need additional guide on this.
In Message Mapping, itemA and itemB are group individually. By examining the context/queue of itemB, I will not be able to determine its posiiton with respect to itemA. Unless, you have a way to group both itemA and itemB together keeping their positioning information.
Regards,
Bill
hi,
>>>>2. (hard or impossible) the value of "itemB/id" is equal to the "itemA/id" right before it in the source XML.
but you can do this
as you will have context (for B) and value (for a)
before it don't you think ?
unless I don't understand the problem which may also be a case:)
Regards,
michal
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.