4 Replies Latest reply on May 31, 2010 11:54 AM by Adam Cameron.

    how to convert well format xml in coldfusion?

    chandra12345 Level 1

      Hi,

       

      I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.

      Please suggest me how to convert to well format xml.

       

       

       

      Advance Thanks,

        • 1. Re: how to convert well format xml in coldfusion?
          ilssac Level 5

          Use string manipulation, like find(), replace(), reFind(), reReplace(), mid(), len(), etc.  To fix the 'xml' text to make it well formed.  Then you can parse it into an xml obect with xmlParse().

          1 person found this helpful
          • 2. Re: how to convert well format xml in coldfusion?
            BKBK Adobe Community Professional & MVP

            chandra12345 wrote:

             

            I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.

            Please suggest me how to convert to well format xml.

             

            Technically speaking, a piece of text must be well-formed before it can be called an XML document. So you cannot yet say the returned text is XML.

             

            The first thing to do is to check whether it is. Use, for example, isXml(someString) to check whether someString is well-formed XML.

             

            There is no one standard way to convert text to well-formed XML. This is because there are infinitely many ways in which text can fail to be well-formed. The easiest solution for you will be to learn the rules for well-formed XML.

             

            Any elementary book on XML will teach you that. If you find books old-fashioned, then you could instead google well-formed xml .

            1 person found this helpful
            • 3. Re: how to convert well format xml in coldfusion?
              A*** Level 1

              At times, consuming a web service by passing parameters directly through url, gives the problem you have described.

              If this is the case, just pass in your parameters properly e.g. <cfhttpparam...> within <cfhttp>.

              • 4. Re: how to convert well format xml in coldfusion?
                Adam Cameron. Level 5

                I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.

                Please suggest me how to convert to well format xml.

                 

                 

                 

                You don't do anything.  You go back to whoever wrote the web service and tell them to sort it out.  As BKBK says... if it's not "well-formed XML", then it's not XML at all.  And if the expectation is that the web service should be returning XML and it isn't, then the fault lies with the web service.  You should be getting the problem fixed at its source, not trying to patch it up after the fact.  this isn't just blame-shifting, but if the web service is not returning what it's supposed to, then you have no idea whether any of what it is returning is valid, even if you can extract something useful out of whatever it's sending.

                 

                --

                Adam