|
next
|
 Subject: EDI to XML Author: Roel van der Hoeven Date: 15 May 2009 10:03 AM
|
We're using XQuery to translate EDI to XML.
Whenever we open an EDI file through XML converter (using a sef file) it gives us an overview of all segments in this message.
Let's say for instance in a group within the EDI message there are a possible of 4 RFF segments. Stylus studio presents them like one RFF "group" with 4 sub composites, something like:
RFF
--RFF01-C506-ACompositeType
----RFF0101-1153ElementType
----RFF0102-1154ElementType
--RFF01-C506-RCompositeType
----RFF0101-1153ElementType
----RFF0102-1154ElementType
--RFF01-C506-UnCompositeType
----RFF0101-1153ElementType
----RFF0102-1154ElementType
--RFF01-C506-6CompositeType
----RFF0101-1153ElementType
----RFF0102-1154ElementType
Let's say the RFF segment are numbered, the qualifier in RFF0101-1153ElementType would be 1, 2, 3 and 4 so the EDI file would read:
RFF+1:number1'
RFF+2:number2'
RFF+3:number3'
RFF+4:number4'
In this case RFF01-C506-ACompositeType (mind the "A" in there) would reference to RFF+1, and RFF01-C506-RCompositeType (again, mind the "R") would be RFF+2, and so on.
This is something I can handle... (phew.....) however for arguments sake let us say these RFF segments are optional, and my EDI file reads:
RFF+1:number1'
RFF+3:number3'
In this case RFF01-C506-ACompositeType still correspondes with RFF+1, however RFF01-C506-RCompositeType is now related to RFF+3 and not like in the top example RFF01-C506-UnCompositeType.
Is there an easy way to handle these situations?
For example I could do a for loop:
for $RFF in $input/EDIFACT/GROUP/COPRAR/GROUP_1/RFF
where $RFF/RFF01-C506-RCompositeType/RFF0101-1153ElementType/text() = 1
But I would have to do this 4 times (note the A, R, Un and 6 before Compositetype > RFF01-C506-RCompositeType), could I use a wildcard of somekind making it like:
for $RFF in $input/EDIFACT/GROUP/COPRAR/GROUP_1/RFF
where $RFF/*/RFF0101-1153ElementType/text() = 1
I hope my problem is clear, if anyone has any difficulties trying to understand this post, please let me know.
|
|
|
|