Copy link to clipboard
Copied
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,
Copy link to clipboard
Copied
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().
Copy link to clipboard
Copied
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 .
Copy link to clipboard
Copied
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>.
Copy link to clipboard
Copied
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