[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Expat XML complex document read.



Doesn't appear to cause any obvious problems for XML-INTO - don't know  
why you think the name length is an issue - RPG names can be over  
4,000 characters long!

The first part of your document translates (roughly) into this in RPG  
DS terms - and XML-INTO should have no trouble populating it.

Field lengths were arbitrarily chosen (except for State and zip!) -  
make them what you will.

If you have further questions I would suggest you take them to an RPG  
list.


      D CustomerOrder   DS                  Dim(9999) Qualified
      D   TransactionDate...
      D                               10a
      D   TransactionEffectiveDate...
      D                               10a
      D   ShippingAddress...
      D                                     LikeDS(ShippingAddress)
      D   ShipTo...
      D                                     LikeDS(ShipTo)
        // etc. etc.

      D ShippingAddress...
      D                 DS                  Template
      D
      D   CompanyName...
      D                               40a   Varying
      D   Addr1                       40a   Varying
      D   City                        40a   Varying
      D   State                        2a
      D   Zip                          5a



Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



On May 18, 2010, at 6:22 PM, <richbelcher@xxxxxxx>  
<richbelcher@xxxxxxx> wrote:

> I thought  this would be the place to ask the question because of  
> using the EXPAT library and example program that I used to access  
> the XML.  Because of privacy information I will have to use a dummy  
> example.
>
> <xml>
>   <CustomerOrder>
>       <TransactionDate>2010-05-14</TransactionDate>
>       <TransactionEffectiveDate>2010-05-01</TransactionEffectiveDate>
>       <ShippingAddress>
>            <CompanyName>Some Company</CompanyName>
>            <Addr1>123 any street</Addr1>
>            <City>Town</City>
>            <State>AZ</State>
>            <Zip>85015</Zip>
>        </ShippingAddress>
>        <ShipTo>
>             <Consignee>My Company</Consignee>
>             <Addr1>456 another street</Addr1>
>             <City>My Town</City>
>             <State>CA</State>
>             <Zip>99001</ZIp>
>         </ShipTo>
>         <OrderInfo>
>              <OrderNumber>012345</OrderNumber>     (Primary Key of  
> tables)
>              <ShipDate>2010-05-30</ShipDate>
>          </OrderInfo>
>          <OrderItems>
>               <Part>1234</Part>
>               <Desc>One product</Desc>
>               <Quantity>1</Quantity>
>               <Price>10.00</Price>
>               <Part/>2345</Part>
>               <Desc>Another product</Desc>
>               <Quantity>5</Quantity>
>               <Price>20.00</Price>
>           </OrderItems>
>           <SpecialInstructions>
>                <ShipDirections>Ship during business hours</ 
> ShipDirections>
>           </SpecialInstructions>
>   </CustomerOrder>
> </xml>
>
> The XML document I am working with has allot more detail but the  
> above example is kind of what I am facing.  The primary key for the  
> load to the tables is several elements down in the document and the  
> prior information is also needed for one of the tables.  In using  
> the CUSTDATA2 example the only way I can think of retaining the data  
> is use data structures to load to in the subprocedure and then bring  
> them back up into the mainline of the program to process the  
> information.  The only problem with scenario is I am referencing one  
> order where ther could be multiple orders within the same XML  
> document.
>
> Hope that clears it up some.  I have also used to HTTPAPI to access  
> to separate web services and would like to thank you for the example  
> I was able to use in the library.  I did sign up in the iSystems  
> forums but have not figured out where to post the question yet.
>
> Thanks
> Richard.
> ---- Scott Klement <sk@xxxxxxxxxxxxxxxx> wrote:
>> Hi Richard,
>>
>> I'm having a hard time visualizing the problem.  Would a simple  
>> example
>> be possible?
>>
>> Also, can we move this to the System iNetwork forums?  It doesn't  
>> appear
>> to be related to HTTPAPI or FTPAPI.
>> http://forums.systeminetwork.com
>>
>> Thanks!
>>
>>
>> On 5/18/2010 4:14 PM, richbelcher@xxxxxxx wrote:
>>> Hi Scott,
>>>
>>> I am attempting to use the CUSTDATA2 example in LIBEXPAT to read in
>>> an XML document with whitespace that is complex and the data is not
>>> in the order to attempt to write it out to keyed tables.  The  
>>> primary
>>> key is buried several columns past the beginning of the data.  I am
>>> able to get the table copied to the IFS and the program is reading  
>>> it
>>> but I am having a problem trying to think of a logical way to  
>>> extract
>>> the data into elements.  I thought about data structures, but I am
>>> dealing with populating about 15 different tables with information.
>>> I also attempted to use the new XML-SAX and XML-INTO operations but
>>> the complexity and length of the column names make that option not a
>>> valid one.  Any suggestions on how to get the data out and into
>>> tables?  This is going to be an ongoing experience for me and I'm a
>>> little buffalo'ed on the correct way to handle this.
>>>
>>> Thanks
>>> Richard
>>
>> -----------------------------------------------------------------------
>> This is the FTPAPI mailing list.  To unsubscribe, please go to:
>> http://www.scottklement.com/mailman/listinfo/ftpapi
>> -----------------------------------------------------------------------
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------