Hi
I got really one frustrating problem and am struggling with it. I got an XML , I just want to read it in a String and need to insert in Database.
But the problem is I tried all ways but whenever I read XML into a String , I get \ inserted before every " . e.g. whereever attrib values r there .
So now when i tried to insert in Database it gives Error.
any idea how do i do ??
do i need any encoding ?
// Testing Begins
string strXMLMsg;
XmlDocument doc = new XmlDocument();
doc.Load("C:\\Temp\\Test.xml");
System.IO.StringWriter stream = new System.IO.StringWriter() ;
XmlTextWriter writer = new XmlTextWriter(stream) ;
writer.Formatting = Formatting.Indented;
doc.Save(writer);
strXMLMsg = stream.GetStringBuilder().ToString() ;
Sample XML
<Execution>
<SubWave>NoValue</SubWave>
<ExecRefID Source="ukagrq01">1316</ExecRefID>
<xftag Source="L">3084PKRJ04</xftag>
<SecurityID IDSource="RIC">OML.L</SecurityID>
<BookingDetails BookingService="FTS_UK"/>
<BargainConditions>
<AT/>
<RP/>
</BargainConditions>
</Execution>
In String Output am getting as
"<Execution>
<SubWave>NoValue</SubWave>\r\n <ExecRefID Source=\"ukagrq01\">1303</ExecRefID>\r\n <xftag Source=\"L\">2062KO8804</xftag>\r\n <SecurityID IDSource=\"RIC\">OML.L</SecurityID>\r\n <BookingDetails BookingService=\"FTS_UK\" />\r\n <BargainConditions>\r\n <AT />\r\n <RP />\r\n </BargainConditions>\r\n</Execution>"
Desired Ouput -
"<Execution><SubWave>NoValue</SubWave><ExecRefID Source="ukagrq01">1316</ExecRefID><xftag Source="L">3084PKRJ04</xftag>
<SecurityID IDSource="RIC">OML.L</SecurityID>
<BookingDetails BookingService="FTS_UK"/>
<BargainConditions><AT/><RP/>
</BargainConditions>
</Execution>"
I got really one frustrating problem and am struggling with it. I got an XML , I just want to read it in a String and need to insert in Database.
But the problem is I tried all ways but whenever I read XML into a String , I get \ inserted before every " . e.g. whereever attrib values r there .
So now when i tried to insert in Database it gives Error.
any idea how do i do ??
do i need any encoding ?
// Testing Begins
string strXMLMsg;
XmlDocument doc = new XmlDocument();
doc.Load("C:\\Temp\\Test.xml");
System.IO.StringWriter stream = new System.IO.StringWriter() ;
XmlTextWriter writer = new XmlTextWriter(stream) ;
writer.Formatting = Formatting.Indented;
doc.Save(writer);
strXMLMsg = stream.GetStringBuilder().ToString() ;
Sample XML
<Execution>
<SubWave>NoValue</SubWave>
<ExecRefID Source="ukagrq01">1316</ExecRefID>
<xftag Source="L">3084PKRJ04</xftag>
<SecurityID IDSource="RIC">OML.L</SecurityID>
<BookingDetails BookingService="FTS_UK"/>
<BargainConditions>
<AT/>
<RP/>
</BargainConditions>
</Execution>
In String Output am getting as
"<Execution>
<SubWave>NoValue</SubWave>\r\n <ExecRefID Source=\"ukagrq01\">1303</ExecRefID>\r\n <xftag Source=\"L\">2062KO8804</xftag>\r\n <SecurityID IDSource=\"RIC\">OML.L</SecurityID>\r\n <BookingDetails BookingService=\"FTS_UK\" />\r\n <BargainConditions>\r\n <AT />\r\n <RP />\r\n </BargainConditions>\r\n</Execution>"
Desired Ouput -
"<Execution><SubWave>NoValue</SubWave><ExecRefID Source="ukagrq01">1316</ExecRefID><xftag Source="L">3084PKRJ04</xftag>
<SecurityID IDSource="RIC">OML.L</SecurityID>
<BookingDetails BookingService="FTS_UK"/>
<BargainConditions><AT/><RP/>
</BargainConditions>
</Execution>"