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

Re: [Ftpapi] How to get the value?




Hi Frank,

here is the solution

         ctl-opt main(main) dftactgrp(*no) option(*nounref);
      //------------------------------------------------------------------//
      //                                                                  //
      // Example with datasubf=data                                       //
      //                                                                  //
      //-----------------                                                 //
      // R.Ross 01.2020 *                                                 //
      //------------------------------------------------------------------//
      // Array XML-File                                                   //
      //------------------------------------------------------------------//

         dcl-ds  Extension             qualified inz;
                  ExtensionField       likeds(ExtensionField) dim(3);
                  cnt_ExtensionField   uns(10);
         end-ds;

         dcl-ds  ExtensionField        qualified;
                  Name                 char(30);
                  Data                 char(30);
         end-ds;

      //------------------------------------------------------------------//
      // Main                                                             //
      //------------------------------------------------------------------//
         dcl-proc main;

         dcl-s   LocData     varchar(1000);
         dcl-s   LocOpt      varchar(256);

           LocOpt = 'doc=string +
                     case=any allowextra=yes +
                     countprefix=cnt_ +
                     datasubf=data +
                     allowmissing=yes';               // XML-Options

           LocData =
            '<Extension extensionTemplate="PARTNER_HEADER">' +
             '<ExtensionField name="Sales Branch">IT</ExtensionField>' +
             '<ExtensionField name="GLA Attached">N</ExtensionField>' +
             '<ExtensionField name="Inside Sales Rep">UNG</ExtensionField>' +
            '</Extension>';

           xml-into Extension %xml(LocData:LocOpt);

         end-proc;
      //------------------------------------------------------------------//


and the debugview



Am 29.01.2020 um 01:05 schrieb Frank Broome:

Everyone,

 

Here’s a challenge for you all.

 

I have to parse an XML string that partly looks this.

You would say that ‘ExtensionField’ has attribute ‘name’ and that “Sales Branch” is the value.

However if you look closely you can see that the actual value is ‘IT’ (for “Sales Branch”).

I have never seen this combination of elements, attributes and its values before.

 

<Extension extensionTemplate="PARTNER_HEADER">

        <ExtensionField name="Sales Branch">IT</ExtensionField>

        <ExtensionField name="GLA Attached">N</ExtensionField>

        <ExtensionField name="Inside Sales Rep">UNG</ExtensionField>

    </Extension>

 

When I parse the XML I can get to the attribute “name” and value “Sales Branch”, but I can’t get to ‘IT’.

Maybe I am just not interpreting the XML correctly and should use a different procedure, but I can’t think of what that could be.

 

Personally I don’t think I can get to the values using the parser, but I would love for someone to prove me wrong.

 

Any ideas are welcome!

 

Best regards,

Frank

 



Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. Providing a safer and more useful place for your human generated data. Specializing in; Security, archiving and compliance. To find out more Click Here.





  

-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi