• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how to convert well format xml in coldfusion?

Explorer ,
May 29, 2010 May 29, 2010

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,

TOPICS
Advanced techniques

Views

900

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 29, 2010 May 29, 2010

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().

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2010 May 30, 2010

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 .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 30, 2010 May 30, 2010

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>.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 31, 2010 May 31, 2010

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation