define a segmentGroup

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

define a segmentGroup

jamad@yorku.ca
Guys,

I stuck trying to define a segmentGroup.

Here is my example:

       <medi:segmentGroup  xmltag="transaction">
             <medi:segment  segref="TS130:ST" segcode="^ST\$130\$.*" xmltag="st_details" />
             <medi:segment  segref="TS131:ST" segcode="^ST\$131\$.*" xmltag="st_details" />
      </medi:segmentGroup>

(* schema/edi-message-mapping-1.2.xsd)


Is there a work around?
(I just want to keep it clean, but I can definitely do it in the code, if there is no other way to do that).

Many thanks.
Reply | Threaded
Open this post in threaded view
|

Re: define a segmentGroup

Ted Lum
It's not clear to me what you're trying to do there. But there is:

<medi:edimap ...>
     <medi:segments xmltag="foo">
         <medi:segment xmltag="bar" segcode=...>
                 <medi:segmentGroup>
                     <medi:segment xmltag="abc" segcode=...></medi:segment>
                     <medi:segment xmltag="def" segcode=...></medi:segment>
                 </medi:segmentGroup>
             </medi:segment>
     </medi:segments>
</medi:edimap>

You can't tag a SegmentGroup, it's just a container, but you can tag the
outer segment. I don't know if that will help.

On 6/12/2014 11:10 AM, [hidden email] wrote:

> Guys,
>
> I stuck trying to define a segmentGroup.
>
> Here is my example:
>
>         <medi:segmentGroup  xmltag="transaction">
>               <medi:segment  segref="TS130:ST" segcode="^ST\$130\$.*"
> xmltag="st_details" />
>               <medi:segment  segref="TS131:ST" segcode="^ST\$131\$.*"
> xmltag="st_details" />
>        </medi:segmentGroup>
>
> (* schema/edi-message-mapping-1.2.xsd)
>
>
> Is there a work around?
> (I just want to keep it clean, but I can definitely do it in the code, if
> there is no other way to do that).
>
> Many thanks.
>


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: define a segmentGroup

jamad@yorku.ca
Hi Ted,

Thank you very much for the quick reply.

Sorry, I though you would recognize the issue.

What I need is to create a parent tag around a group of segments. I just dont know how to do that.
I've tried segmentGroup, but it relies on the first segment in the group to be present.

Basically, I don't know how to wrap the following segments:
 
<medi:segment minOccurs="0" segref="ns1:ST" segcode="^ST\$130.*" xmltag="st_details" />
<medi:segment minOccurs="0" segref="ns2:ST" segcode="^ST\$131.*" xmltag="st_details" />


any idea how to approach this?

thank you!
Reply | Threaded
Open this post in threaded view
|

Re: define a segmentGroup

Ted Lum
That's too small of a fragment to know. I mean, is there a parent
segment? Do those groups keep repeating, or is it a single message?

When I ran into that at first I simply made the first segment the
parent, and then the subsequent segments children of that. That would be
like:

<medi:segment minOccurs="0" segref="ns1:ST" segcode="^ST\$130.*"
xmltag="st_details" />
     <medi:segmentGroup>
         <medi:segment minOccurs="0" segref="ns2:ST"
segcode="^ST\$131.*" xmltag="st_details" />
         <medi:segment minOccurs="0" segref="ns3:ST"
segcode="^ST\$132.*" xmltag="st_details" />
     </medi:segmentGroup>
</medi:segment>

Except that's not going to work right with a minOccurs="0" which
suggests they are all optional. I don't believe there is a straight
forwards way to do it through mapping configuration alone.

I've written my own parser - actually extended EDIParser - because I'm
dealing with fixed position fields within fixed length segments, so I
also had to extended the mapping schema to handle that which made it
easier to deal with some of those cases. But if this is your only issue
its not that hard to do in code or a template.

Also, I'm thinking it depends on whether you're using DOM or SAX,
because with SAX you can have a visitor that wraps "st_details", so
while you can't do it in the mapping it's fairly trivial in the event
stream.


On 6/12/2014 2:33 PM, [hidden email] wrote:

> Hi Ted,
>
> Thank you very much for the quick reply.
>
> Sorry, I though you would recognize the issue.
>
> What I need is to create a parent tag around a group of segments. I just
> dont know how to do that.
> I've tried segmentGroup, but it relies on the first segment in the group to
> be present.
>
> Basically, I don't know how to wrap the following segments:
>
> <medi:segment minOccurs="0" segref="ns1:ST" segcode="^ST\$130.*"
> xmltag="st_details" />
> <medi:segment minOccurs="0" segref="ns2:ST" segcode="^ST\$131.*"
> xmltag="st_details" />
>
>
> any idea how to approach this?
>
> thank you!
>


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: define a segmentGroup

jamad@yorku.ca
Hi Ted,

Thanks a lot. It's exactly what I was looking for.

I've recently started a project with Smoooks.
I am getting better, but often not aware of limitations, or/and best practices.


Thanks again.



Have a great Day!

jama