Re: Convert String data from Web Service to XML




Hi Avinash,

why not return temp directly? the way i see would work is:

public XmlDocument VertexResponse(string VertexResponse)
{
XmlDocument temp= new XmlDocument();
temp.LoadXml(VertexResponse);
return temp;
}


"Avinash" wrote:

On Feb 12, 6:48 pm, Mark <mcole...@xxxxxxxxxxx> wrote:
On 12 Feb, 16:05, Avinash <avinashd...@xxxxxxxxx> wrote:

Hi
I am trying to Convert String data from Web Service to XML
My String data looks like
<String>My XML is inside this string tag </String>
I want to extract the XML inside the string tag in Orchestration, How
do i do it ??
Any help is appreciated.

Thanks-
Avinash

You could load it into a DOM using System.Xml.XmlDocument. If it is a
small piece of XML this shouldn't be too much of an overhead. If it's
a large amount of data this is not recommended as it will consume lots
of memory. Another option is to use an XmlTextReader (also in the
System.Xml namespace) to parse the document and use the
ReadElementContentAsString method to retrieve the value. Another quick
and dirty method is string parsing.
Thanks for the reply,

I tried using this method below and return an Xml document type back
to Orchestration, when i go thru the Orchestration Debugger it stops
at where it actually calls this method and gives me an error saying

Inner exception: Invalid cast from 'System.String' to
'System.Xml.XmlDocument'.
I double checked my variables and messages every thing is assigned
right and builds the project, but in run time in throws the above
error.

public XmlDocument VertexResponse(string VertexResponse)
{
XmlDocument temp= new XmlDocument();
string temp1;
temp.LoadXml(VertexResponse);
temp1= temp.DocumentElement.OuterXml;
XmlDocument temp2 = (XmlDocument)Convert.ChangeType(temp1,
typeof(XmlDocument));
return temp2;
}

.



Relevant Pages

  • RE: using myXslDoc.Transform
    ... One potential option for dynamically loading an XmlDocument from the ... retrieved as a string. ... Retrieve the XML content from the database ... Dim strXml As String ...
    (microsoft.public.dotnet.xml)
  • Re: Convert String data from Web Service to XML
    ... associated with a schema), you can just assign temp to this message in a ... why would you bother to load VertexResponse into a xml document? ... I am trying to Convert String data from Web Service to XML ... xmldocument & outerxml ...
    (microsoft.public.biztalk.general)
  • Re: Convert String data from Web Service to XML
    ... Are you using Xlang or external .net assembly to load xml? ... XmlDocument temp2 = ... why not use temp instead of temp2, ... I am trying to Convert String data from Web Service to XML ...
    (microsoft.public.biztalk.general)
  • Re: Convert String data from Web Service to XML
    ... if you only need to assign the VertexResponse string to a node of ... I am trying to Convert String data from Web Service to XML ... again to xmldocument by using loadxml and assign to xmldocument ...
    (microsoft.public.biztalk.general)
  • Re: Serialize XML is broken?
    ... The XmlDocument was supposed to be created to make it easier to insert into ... Then load it as xml when it is needed. ... the schema and .net class for NewsArticle: ... private string bodyField; ...
    (microsoft.public.dotnet.languages.csharp)

Loading