MAF wrote:
[color=blue]
> Is there a quick way to convert all special characters to XML format for
> example '&' to & or '+' sign to ? ?[/color]
'&' needs to be escaped as & but the '+' sign does not need to be
escaped in XML.
How you do it depends on the .NET APIs you use, if you use an
XmlTextWriter to create XML then the WriteString method for instance
does the escaping for you.
If you use the DOM then CreateTextNode simply takes your string and if
the DOM is serialized (e.g. InnerXml, OuterXml, Save) the escaping is
done automatically.
Fraser Michael wrote:
[color=blue]
> It does in the XPATH I am getting the error on the following line:
>
> XMLErrorCollect ion =
> this.m_XMLDoc.S electSingleNode ("./PortfolioCollec tion/" +
> this.m_Portfoli oName + "/ErrorCollection ");
>
> Where m_PortfolioName = 'test + 1 day'[/color]
Well XPath does not have an XML syntax at all.
With the above you would get the XPath expression
./PortfolioCollec tion/test + 1 day/ErrorCollection
and that is not syntactically correct as an XPath expression so that is
why you get an error.
Escaping does not help to get the correct syntax.
Comment