[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: xml-sax issue
No, I copied that out of the debug session and displayed the value
> Just to check: Your example xml stream has the quotes('). Is this your
> problem?
>
> On Fri, Sep 4, 2015 at 6:34 PM, RPG List <[1]rpglist@xxxxxxxxxxx>
> wrote:
>
> Extra characters?
> > Not meaning to take this thread off topic but Expat would handle
> this
> > simple XML very straight forward.
> >
> > If you want to stay with native support, Jon Paris just wrote a
> nice
> > series of articles on XML-INTO that are pretty good places to
> understand
> > how XML will map to a data structure. First article was August 4:
> > [2]http://www.itjungle.com/fhg/fhgindex.html
> >
> > Final thought back on topic, your XML has a few extra characters
> on the
> > back side. Perhaps they are messing with the parser in some way?
> Are you
> > using a varchar for the XML?
> >
> > -----Original Message-----
> > From: [3]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:[4]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of RPG
> List
> > Sent: Friday, September 4, 2015 5:01 PM
> > To: HTTPAPI and FTPAPI Projects
> > Subject: Re: xml-sax issue
> >
> > 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][5]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][6]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][7]http://www.scottklement.com/mailman/listinfo/ftpapi
> >>>>Â Â Â >
> >>>>Â Â Â
> --------------------------------------------------------------------
> >>>>Â Â Â ---
> >>>>Â Â Â >
> >>>>Â Â Â
> --------------------------------------------------------------------
> >>>>Â Â Â ---
> >>>>Â Â Â This is the FTPAPI mailing list.ÃÂ To unsubscribe,
> please go to:
> >>>>Â Â Â
> [4][8]http://www.scottklement.com/mailman/listinfo/ftpapi
> >>>>Â Â Â
> --------------------------------------------------------------------
> >>>>Â Â Â ---
> >>>>
> >>>> References
> >>>>
> >>>>Â Â 1. mailto:[9]rpglist@xxxxxxxxxxx
> >>>>Â Â 2.
> >>>>
> [10]http://iprodeveloper.com/print/rpg-programming/rpgs-xml-sax-opco
> de
> >>>>Â Â 3. [11]http://www.scottklement.com/mailman/listinfo/ftpapi
> >>>>Â Â 4. [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
> >>>>
> --------------------------------------------------------------------
> >>>> ---
> >>>>
> >>>
> >>>
> >>>
> --------------------------------------------------------------------
> -
> >>> -- This is the FTPAPI mailing list. To unsubscribe, please go
> to:
> >>> [14]http://www.scottklement.com/mailman/listinfo/ftpapi
> >>>
> --------------------------------------------------------------------
> -
> >>> --
> >>>
> >>>
> >>
> >>
> >>
> --------------------------------------------------------------------
> --
> >> - This is the FTPAPI mailing list. To unsubscribe, please go
> to:
> >> [15]http://www.scottklement.com/mailman/listinfo/ftpapi
> >>
> --------------------------------------------------------------------
> --
> >> -
> >>
> >>
> >
> >
> >
> --------------------------------------------------------------------
> ---
> > This is the FTPAPI mailing list. To unsubscribe, please go to:
> > [16]http://www.scottklement.com/mailman/listinfo/ftpapi
> >
> --------------------------------------------------------------------
> ---
> >
> --------------------------------------------------------------------
> ---
> > This is the FTPAPI mailing list. To unsubscribe, please go to:
> > [17]http://www.scottklement.com/mailman/listinfo/ftpapi
> >
> --------------------------------------------------------------------
> ---
> >
> >
> --------------------------------------------------------------------
> ---
> This is the FTPAPI mailing list. To unsubscribe, please go to:
> [18]http://www.scottklement.com/mailman/listinfo/ftpapi
> --------------------------------------------------------------------
> ---
>
> --
> Lloyd Bailey
> Phone: 631-258-3198
>
> References
>
> 1. mailto:rpglist@xxxxxxxxxxx
> 2. http://www.itjungle.com/fhg/fhgindex.html
> 3. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> 4. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> 5. mailto:rpglist@xxxxxxxxxxx
> 6. http://iprodeveloper.com/print/rpg-programming/rpgs-xml-sax-opcod
> 7. http://www.scottklement.com/mailman/listinfo/ftpapi
> 8. http://www.scottklement.com/mailman/listinfo/ftpapi
> 9. mailto:rpglist@xxxxxxxxxxx
> 10. http://iprodeveloper.com/print/rpg-programming/rpgs-xml-sax-opcode
> 11. http://www.scottklement.com/mailman/listinfo/ftpapi
> 12. http://www.scottklement.com/mailman/listinfo/ftpapi
> 13. http://www.scottklement.com/mailman/listinfo/ftpapi
> 14. http://www.scottklement.com/mailman/listinfo/ftpapi
> 15. http://www.scottklement.com/mailman/listinfo/ftpapi
> 16. http://www.scottklement.com/mailman/listinfo/ftpapi
> 17. http://www.scottklement.com/mailman/listinfo/ftpapi
> 18. 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
-----------------------------------------------------------------------