Topic
  • 1 reply
  • Latest Post - ‏2013-07-16T07:45:16Z by HermannSW
nepomuk
nepomuk
151 Posts

Pinned topic Processing different format response types

‏2013-07-16T07:05:58Z |

I have a response rule which sometimes gets an XML message body and sometimes an HTML message body. The XML must be transformed by a transform action but the HTML should pass through. At the moment the XML works fine but the HTML gets an XML parser error. How can I let the HTML through without a parser error?

  • HermannSW
    HermannSW
    6065 Posts
    ACCEPTED ANSWER

    Re: Processing different format response types

    ‏2013-07-16T07:45:16Z  

    > How can I let the HTML through without a parser error?
    >
    In general you cannot, see "isXML?" posting:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/isxml29

    But perhaps the one or other approach described fits your needs.

    For your scenario, if you have a "reliable" string which distinguishes HTML from XML documents, then you can create a Non-XML response service that first looks for that string, and if present, treats backend response as HTML by conditional procesing. In the other case conditionally XML processing would happen.
     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

  • HermannSW
    HermannSW
    6065 Posts

    Re: Processing different format response types

    ‏2013-07-16T07:45:16Z  

    > How can I let the HTML through without a parser error?
    >
    In general you cannot, see "isXML?" posting:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/isxml29

    But perhaps the one or other approach described fits your needs.

    For your scenario, if you have a "reliable" string which distinguishes HTML from XML documents, then you can create a Non-XML response service that first looks for that string, and if present, treats backend response as HTML by conditional procesing. In the other case conditionally XML processing would happen.
     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>