webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Iterating over invalid XML file

  • 1.  Iterating over invalid XML file

    Posted Thu August 22, 2013 07:55 AM

    Hi,

    I have an XML file which contains details as shown below

    ASGBGA
    3135


    aaagdg
    3174


    oyoyoy
    3135

    I am iterating over the tag using getXMLNodeIterator. Each document i am writing into separate file.In this case 2nd document is invalid XML so converting xmlNodeToDocument is throwing error Expecting tag and it is coming out of the service without iterating over other tags. Can anybody help me i want to write 2nd to invalid file and should continue iterating over further nodes ??


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: Iterating over invalid XML file

    Posted Thu August 22, 2013 08:01 AM

    Name don’t have ending tag in second XML


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: Iterating over invalid XML file

    Posted Thu August 22, 2013 08:08 AM

    Ya. I want

    aaagdg
    3174
    This to be written into one file.and continue processing 3rd

    Process should not abort if it encounters invalid

    Can you pls help this out…


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Iterating over invalid XML file

    Posted Thu August 22, 2013 08:17 AM

    Try to use try/catch mechanisum after initializing iterator. when ever an invalid XML come cursor wil go to catch block and in catch block do noting.

    i never tried above senario but remeber someone has posted in forum earlier


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 5.  RE: Iterating over invalid XML file

    Posted Thu August 22, 2013 09:11 AM

    Hi Thanks for the suggestion.In Catch block i can write into a file.But after coming out of the Catch block,for next iteration the service getNextXMLNode service is throwing an exception resulting which it is not processing the further nodes.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 6.  RE: Iterating over invalid XML file

    Posted Thu August 22, 2013 02:30 PM

    What is the error you are seeing? node not exist or available for next iteration?


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: Iterating over invalid XML file

    Posted Thu August 22, 2013 06:29 PM

    I think, in your case, instead of using xml operations, you should just use String, search for

    then,

    get the substring of each record, regardless it’s valid xml or no.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 8.  RE: Iterating over invalid XML file

    Posted Fri August 23, 2013 03:49 AM

    If i use node iterator am getting the below error

    [ISC.0042.9327]
    Expecting got

    Can’t i use node iterator to iterate over invalid XML nodes…??


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 9.  RE: Iterating over invalid XML file

    Posted Fri August 23, 2013 01:39 PM

    OK it seems to me either your XML has some spl chars or tags are not right in place…can you scan your XML file and check it?

    HTH,
    RMG


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 10.  RE: Iterating over invalid XML file

    Posted Tue August 27, 2013 05:01 AM

    My XML file is not correct because it is missing some tags. How can i iterate over this xml file having missing tags , using xml node iterator…?


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 11.  RE: Iterating over invalid XML file

    Posted Tue August 27, 2013 12:18 PM

    I believe it won’t work as expect if the XML is not correct with some tags missing…so please make sure all the XML data is present in the loaded file:

    HTH,
    RMG


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB