brdrok
asked on
Need help with XML
Hi,
I have an xml element that looks like the following:
<SQLQuery>
<![CDATA[
SELECT
P.Name,
P.ID,
P.Address,
etc......
FROM
Person P
INNER JOIN Department D ON D.PersonID = P.ID
etc.....
WHERE
P.HireDate > { d '2002-01-01'})]]>
</SQLQuery>
When I attempt to parse the <SQLQuery> element, my text looks like the following:
"<![CDATA[\r\n\t\tSELECT\r \n\t\t P.Name,\r\n etc........."
this is how I attempt to extract the text of my SQLQuery element.
string sql = dsNode.SelectSingleNode("S QLQuery"). InnerXml.T rim();
thanks...
I have an xml element that looks like the following:
<SQLQuery>
<![CDATA[
SELECT
P.Name,
P.ID,
P.Address,
etc......
FROM
Person P
INNER JOIN Department D ON D.PersonID = P.ID
etc.....
WHERE
P.HireDate > { d '2002-01-01'})]]>
</SQLQuery>
When I attempt to parse the <SQLQuery> element, my text looks like the following:
"<![CDATA[\r\n\t\tSELECT\r
this is how I attempt to extract the text of my SQLQuery element.
string sql = dsNode.SelectSingleNode("S
thanks...
ASKER
Heya Jens,
the thing is that I am going to use it as part of a sql query, thus, characters such as "\t\r\n" or CDATA is invalid.
For the time being, I am using the Replace() function, but I was hoping that there is a better way of doing it.
thanks
the thing is that I am going to use it as part of a sql query, thus, characters such as "\t\r\n" or CDATA is invalid.
For the time being, I am using the Replace() function, but I was hoping that there is a better way of doing it.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you are worried about the \r \n\t characters in your string, those simply represent the carriage returns, linefeeds and tabs in the text you provided. That is as it should be. You can always replace those with spaces if you want everything on one line.