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

Re: Parser Problems



   Hi Tom,

   the xmlReader in powerEXT Core (freeware) is very fault tolerant:

   out of this code:

   string = '<start><ShortDescription>' � � � � � � � � � � �   � � � � ��   �+ '"Children under 16 years stay free when sharing the' � � � �   � ��   �+ ' same cabin/site with paying
   adults</ShortDescription></start>';�   xmlReaderInz(%addr(string)+2:%len(string)); � � � � � � � � �   � � � �   dow 0 = xmlReader(); � � � � � � � � � � � � � � � �   � � � � � � � ��   � if xmlGetNode = 'ShortDescription'; � � � � � � � � � �   � � � � � �   � � dsp = xmlGetData; � � � � � � � � � � � � � � �   � � � � � � � � �   � � dsply dsp; � � � � � � � � � � � � � � � � � �   � � � � � � � � ��   � endif; � � � � � � � � � � � � � � � � � � � �   � � � � � � � � � ��   enddo;
   I get this result:
   DSPLY �"Children under 16 years stay free when sharing the ...
   �� � � � � � � � � � � � � � � � � � � � � � �   � � � � � � � ��   On Fri, Oct 7, 2011 at 7:34 PM, James Lampert
   <[1]jamesl@xxxxxxxxxxxxxxxxx> wrote:

   Tom Thomson wrote:
   > � Any help would be appreciated.

     It could be that the web service is producing defective XML
     I can say from experience that writing your own parser is *not*
     that
     difficult, even if you're having to parse notoriously difficult to
     parse
     data streams like XML. Assuming you are expecting a specific XML
     data
     stream, and you *don't* have to parse generalized XML, it's *not*
     as
     difficult as some would have you think, to write a parser that will
     understand the data stream, and tolerate malformed XML (in fact,
     for a
     "single data stream parser," it can actually be easier to tolerate
     malformed XML than to recognize it as being malformed!).
     I can also say, from direct experience, that ILE RPG is a
     sufficiently
     sophisticated language that you can write a recursive-descent
     parser
     (IMHO, the easiest kind of parser to hand-code) in it; I've done at
     least two such, and one of them *is* for a specialized XML stream.
     And
     I've never heard of a data stream that couldn't be parsed by
     recursive
     descent.
     --
     JHHL

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

   --
   Regards,
   Henrik Rützou
   �   [3]http://powerEXT.com
   �   [plogofull200.png]

References

   1. mailto:jamesl@xxxxxxxxxxxxxxxxx
   2. http://www.scottklement.com/mailman/listinfo/ftpapi
   3. http://powerext.com/
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------