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

Re: xml-sax issue



   Perhaps you have a CCSID issue? Just a guess. Sounds like XML is
   correct, but iSeires is not seeing it as XML.

   On Fri, Sep 4, 2015 at 6:00 PM, RPG List <[1]rpglist@xxxxxxxxxxx>
   wrote:

     It does not show any errors, in the xml.� I took the string and
     stuck in
     it in a document added the .xml extension and opened it.
     I have no clue why I can't see each ELEMENT name as it loops through
     the
     document.� It gives me START_DOCUMENT on the first pass and then
     END_DOCUMENT on the second pass and that's all.
     > I understand what your saying, I'll double check it that way... I
     misread
     > what you said.
     >
     > Dutch
     >
     >
     >> Alan,
     >> Its coming in as a string, its not stored on the system.
     >>
     >> Its coming from a web service, its a return response.
     >>
     >>
     >>
     >>>� � Take the document, make sure it has a .xml on the end and
     double
     >>> click
     >>>� � in Windows and IE will open as a XML document. If there is
     anything
     >>>� � wrong with the document, it will throw an error telling you
     were the
     >>>� � problem is.
     >>>
     >>>� � On Fri, Sep 4, 2015 at 2:34 PM, RPG List
     <[1][2]rpglist@xxxxxxxxxxx>
     >>>� � wrote:
     >>>
     >>>� � � Scott,
     >>>� � � I'm not sure we don't have another problem.�  Here's
     why when I
     >>> step
     >>>� � � through the xmlhandler, I get the start_document on the
     first
     >>> read,
     >>>� � � and
     >>>� � � then I get end_document on the second read.�  That's
     it.�  Its
     >>>� � � almost as
     >>>� � � though its never seeing the data further.�  I ran a
     test using the
     >>>� � � following:
     >>>� � � XML = '<xmlTest>+
     >>>� � � �  �  �  �  �  �  �  �<name type="author">AS400
     Sample
     >>> Code/name>+
     >>>� � � �  �  �  �  �  �  �  �</xmlTest>';
     >>>� � � that worked.
     >>>� � � Here is what the xml document looks like coming in:
     >>>� � �     '<MMMProcess><Results><Claim>8104550</Claim><Amount>1995.83</'
     >>>� � � 'Amount><Code>7320</Code><Xrg>53</Xrg><MEANLOS2>2</MEAN'
     >>>� � �     'LOS2><Error_Code>0</Error_Code></Results></MMMProcess>�  �  �  '
     >>>� � � I just can't find what's wrong with the xml..
     >>>� � � > Dutch,
     >>>� � � >
     >>>� � � > The XML processing instructions ("header" as you call
     it) are
     >>>� � � optional.
     >>>� � � > They are not required.
     >>>� � � >
     >>>� � � > The problem is what I said in my first reply to
     you.�  Please
     >>> read
     >>>� � � the
     >>>� � � > article I linked to so you can learn how XML-SAX
     works.
     >>>� � � >
     >>>� � � > -SK
     >>>� � � >
     >>>� � � >
     >>>� � � > On 9/4/2015 3:18 PM, RPG List wrote:
     >>>� � � >> one additional issue I saw this morning Scott and
     maybe this is
     >>>� � � the
     >>>� � � >> problem, the incoming XML does not have what I would
     call a
     >>>� � � standard
     >>>� � � >> header:
     >>>� � � >>
     >>>� � � >> IE: it does not have a version or description that I
     see in
     >>> most
     >>>� � � xml
     >>>� � � >> documents, maybe that's needed or maybe not?
     >>>� � � >>
     >>>� � � >>
     >>>� � � >>> Dutch,
     >>>� � � >>>
     >>>� � � >>> This looks an awful lot like a program that I wrote
     a long
     >>> time
     >>>� � � ago to
     >>>� � � >>> print the XML events.�  I would not recommend using
     this to
     >>>� � � actually
     >>>� � � >>> parse a document -- to parse with XML-SAX you're
     going to need
     >>>� � � to
     >>>� � � >>> create
     >>>� � � >>> a stack of XML elements (implemented in RPG as an
     array, most
     >>>� � � likely)
     >>>� � � >>> and keep track of the current XML element you're
     working on,
     >>>� � � etc.
     >>>� � � >>> There
     >>>� � � >>> was another program included in that same article
     called
     >>>� � � "CustXml" that
     >>>� � � >>> demonstrates this -- that program would be a better
     starting
     >>>� � � point.
     >>>� � � >>>
     >>>� � �     [2][3]http://iprodeveloper.com/print/rpg-programming/rpgs-xml-sax-op
     cod
     >>>� � � e
     >>>� � � >>>
     >>>� � � >>> (use the "print" option to format the code better,
     Penton
     >>> media
     >>>� � � has
     >>>� � � >>> screwed up the code figures in their article
     archive)
     >>>� � � >>>
     >>>� � � >>> Based on what you've shown us, the only thing you'd
     get in
     >>> your
     >>>� � � string
     >>>� � � >>> is the name of the XML tag you're parsing.�  (Since
     that's
     >>>� � � what's
     >>>� � � >>> pointed
     >>>� � � >>> to by "string" during the XML_START_ELEMENT event.)
     >>>� � � >>>
     >>>� � � >>> You say you're getting nothing at all...?�  Since
     you're
     >>> getting
     >>>� � � it from
     >>>� � � >>> the 'value' field, you'd need to show us the
     definition and/or
     >>>� � � code
     >>>� � � >>> that
     >>>� � � >>> populates 'value' for us to see how that works.�
     Funny that
     >>> you
     >>>� � � omitted
     >>>� � � >>> that part of the code considering that your question
     is about
     >>>� � � it?
     >>>� � � >>>
     >>>� � � >>> Also, is this part of a program that uses HTTPAPI or
     FTPAPI?�     >>>� � � If so, I
     >>>� � � >>> guess we can discuss it here...�  �if not,
     however, this
     >>> really
     >>>� � � doesn't
     >>>� � � >>> belong on this mailing list.
     >>>� � � >>>
     >>>� � � >>> -SK
     >>>� � � >>>
     >>>� � � >>>
     >>>� � � >>> On 9/3/2015 9:17 PM, RPG List wrote:
     >>>� � � >>>> I am attempting to parse out the data I'm getting
     from a web
     >>>� � � service
     >>>� � � >>>> and
     >>>� � � >>>> I'm having a little trouble.
     >>>� � � >>>>
     >>>� � � >>>> I'm using the following as my to the handler:
     >>>� � � >>>>
     >>>� � � >>>>�  �  �  xml = %trim(%subSt(GetResponse:3:5000));
     >>>� � � >>>>�  �  �  xml-sax %handler(xmlHandler: ignoreMe)
     >>>� � � >>>>�  �  �  �  �%XML(xml: 'doc=string');
     >>>� � � >>>>
     >>>� � � >>>> GetResponse has the full xml string I'm expecting.
     >>>� � � >>>>
     >>>� � � >>>> my xmlhandler is defined as follows:
     >>>� � � >>>>
     >>>� � � >>>> P xmlHandler�  �  �  b
     >>>� � � >>>> D�  �  �  �  �  �  �  �  �pi�  �  �
     �  �  �  10i 0
     >>>� � � >>>> D ignore�  �  �  �  �  �  �  �  �  �  �
     �  �1a
     >>>� � � >>>> D event�  �  �  �  �  �  �  �  �  �  �
     �  �10i 0 value
     >>>� � � >>>> D�  �string�  �  �  �  �  �  �  �  �
     �  �  �  *�  �value
     >>>� � � >>>> D�  �stringLen�  �  �  �  �  �  �  �  �
     �20i 0 value
     >>>� � � >>>> D�  �exceptionId�  �  �  �  �  �  �  �  �     10i 0 value
     >>>� � � >>>>
     >>>� � � >>>> I then have the following code in the procedure:
     >>>� � � >>>>
     >>>� � � >>>> OutputXML.name = XML_Event_Name(event);
     >>>� � � >>>> OutputXML.data = *blanks;
     >>>� � � >>>>
     >>>� � � >>>> select;
     >>>� � � >>>> when string=*null or stringlen<1;
     >>>� � � >>>>�  �  �  // no string given...
     >>>� � � >>>> when stringlen>%size(value);
     >>>� � � >>>>�  �  �  OutputXML.data = '** string length
     invalid';
     >>>� � � >>>> other;
     >>>� � � >>>>�  �  �  OutputXML.data =
     %subst(value:1:stringlen);
     >>>� � � >>>> endsl;
     >>>� � � >>>>
     >>>� � � >>>> // Change Current XML group if applicable
     >>>� � � >>>> Select;
     >>>� � � >>>>�  �  �  When OutputXML.name =
     'XML_START_ELEMENT';
     >>>� � � >>>>
     >>>� � � >>>>
     >>>� � � >>>>
     >>>� � � >>>>
     >>>� � � >>>> The problem is outputXML.data never has a value
     that I can
     >>>� � � see.�  Am I
     >>>� � � >>>> doing something wrong or am I missing a step?
     >>>� � � >>>>
     >>>� � � >>>>
     >>>� � � >>>>
     >>>� � � >>>>
     >>>� � � >>>>
     >>>� � � >
     >>>� � � >
     >>>� � �     --------------------------------------------------------------------
     >>>� � � ---
     >>>� � � > This is the FTPAPI mailing list.�  To unsubscribe,
     please go to:
     >>>� � � >
     [3][4]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>� � � >
     >>>� � �     --------------------------------------------------------------------
     >>>� � � ---
     >>>� � � >
     >>>� � �     --------------------------------------------------------------------
     >>>� � � ---
     >>>� � � This is the FTPAPI mailing list.�  To unsubscribe,
     please go to:
     >>>� � �     [4][5]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>� � �     --------------------------------------------------------------------
     >>>� � � ---
     >>>
     >>> References
     >>>
     >>>� � 1. mailto:[6]rpglist@xxxxxxxxxxx
     >>>� � 2.
     >>>
     [7]http://iprodeveloper.com/print/rpg-programming/rpgs-xml-sax-opcod
     e
     >>>� � 3. [8]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>� � 4. [9]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>
     --------------------------------------------------------------------
     ---
     >>> This is the FTPAPI mailing list.� To unsubscribe, please go to:
     >>> [10]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>
     --------------------------------------------------------------------
     ---
     >>>
     >>
     >>
     >>
     --------------------------------------------------------------------
     ---
     >> This is the FTPAPI mailing list.� To unsubscribe, please go to:
     >> [11]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>
     --------------------------------------------------------------------
     ---
     >>
     >>
     >
     >
     >
     --------------------------------------------------------------------
     ---
     > This is the FTPAPI mailing list.� To unsubscribe, please go to:
     > [12]http://www.scottklement.com/mailman/listinfo/ftpapi
     >
     --------------------------------------------------------------------
     ---
     >
     >
     --------------------------------------------------------------------
     ---
     This is the FTPAPI mailing list.� To unsubscribe, please go to:
     [13]http://www.scottklement.com/mailman/listinfo/ftpapi
     --------------------------------------------------------------------
     ---

   --
   Lloyd Bailey
   Phone: 631-258-3198

References

   1. mailto:rpglist@xxxxxxxxxxx
   2. mailto:rpglist@xxxxxxxxxxx
   3. http://iprodeveloper.com/print/rpg-programming/rpgs-xml-sax-opcod
   4. http://www.scottklement.com/mailman/listinfo/ftpapi
   5. http://www.scottklement.com/mailman/listinfo/ftpapi
   6. mailto:rpglist@xxxxxxxxxxx
   7. http://iprodeveloper.com/print/rpg-programming/rpgs-xml-sax-opcode
   8. http://www.scottklement.com/mailman/listinfo/ftpapi
   9. http://www.scottklement.com/mailman/listinfo/ftpapi
  10. http://www.scottklement.com/mailman/listinfo/ftpapi
  11. http://www.scottklement.com/mailman/listinfo/ftpapi
  12. http://www.scottklement.com/mailman/listinfo/ftpapi
  13. 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
-----------------------------------------------------------------------