Click here to Skip to main content
16,004,854 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: MSXML 3 and escape sequences Pin
Philip Fitzsimons8-Apr-03 3:20
Philip Fitzsimons8-Apr-03 3:20 
GeneralI have a problem with streaming XML through ASPX Pin
zoltix7-Apr-03 3:00
zoltix7-Apr-03 3:00 
GeneralRe: I have a problem with streaming XML through ASPX Pin
Philip Fitzsimons8-Apr-03 3:41
Philip Fitzsimons8-Apr-03 3:41 
QuestionHow to escape " in XPATH Expression given to SelectSingleNode() of xmldocument class Pin
Ajith Kumar6-Apr-03 18:08
Ajith Kumar6-Apr-03 18:08 
GeneralXML contents for my previous question Pin
Ajith Kumar4-Apr-03 19:39
Ajith Kumar4-Apr-03 19:39 
GeneralRe: XML contents for my previous question Pin
Michael A. Barnhart5-Apr-03 0:34
Michael A. Barnhart5-Apr-03 0:34 
GeneralXML contents for my previous question Pin
Ajith Kumar4-Apr-03 19:38
Ajith Kumar4-Apr-03 19:38 
GeneralXPath Doubt Pin
Ajith Kumar4-Apr-03 19:12
Ajith Kumar4-Apr-03 19:12 
Hi all,
I have the following sample XML file
<root>
<string id="%s\" hello\'s="" world\""="">
<locale>Locale Equivalent of above id string



I load the xml document document using the XmDocument.Load( fileName) in C#.
Sample code
string idvalue = "%s\"Hello\'s World\"";
string path = "/ROOT?STRING[@id = \"" + idvalue + "\"]/LOCALE"; // so as to get the text between LOCALE tag
XmlDocument doc = new XmlDocument();
doc.Load(fileName);
string str = doc.DocumentElement.SelectSingleNode(path).InnerXml;

Howvever the the statement throws an exception because the quotes in the path string is not escaped in XML. SelectSingleNode() takes an XPATH expression. How to escape the quotes in an XPATH expression so that the last statement works correctly.

The last expression is a problem only when their is a " in id attribute, since the attribute value is enclosed in quotes in Xpath. for id attribute values with no quotes takes me correctly to the text betwen LOCALE tag

The XML is successfully validated internally aginst a DTD.
The XML file contains ", ', &, <, > in their encoded form.
Any solutions to offer


Regards,
Ajith
QuestionHow to do XML file modifications? Pin
Segal3-Apr-03 21:41
Segal3-Apr-03 21:41 
GeneralC# / XML attributes and values Pin
econner3-Apr-03 2:52
econner3-Apr-03 2:52 
QuestionXML parser generators? Pin
Jörgen Sigvardsson1-Apr-03 12:56
Jörgen Sigvardsson1-Apr-03 12:56 
AnswerRe: XML parser generators? Pin
Michael A. Barnhart1-Apr-03 14:40
Michael A. Barnhart1-Apr-03 14:40 
GeneralRe: XML parser generators? Pin
Jörgen Sigvardsson1-Apr-03 21:44
Jörgen Sigvardsson1-Apr-03 21:44 
GeneralRe: XML parser generators? Pin
Michael A. Barnhart2-Apr-03 0:32
Michael A. Barnhart2-Apr-03 0:32 
AnswerRe: XML parser generators? Pin
Stuart Dootson2-Apr-03 6:56
professionalStuart Dootson2-Apr-03 6:56 
GeneralRe: XML parser generators? Pin
Jörgen Sigvardsson2-Apr-03 7:42
Jörgen Sigvardsson2-Apr-03 7:42 
AnswerRe: XML parser generators? Pin
Anonymous16-Apr-03 1:55
Anonymous16-Apr-03 1:55 
QuestionIs there an "include" directive in XML? Pin
Marc Clifton29-Mar-03 4:52
mvaMarc Clifton29-Mar-03 4:52 
AnswerRe: Is there an "include" directive in XML? Pin
Michael A. Barnhart29-Mar-03 13:17
Michael A. Barnhart29-Mar-03 13:17 
AnswerRe: Is there an "include" directive in XML? Pin
Richard Deeming30-Mar-03 22:34
mveRichard Deeming30-Mar-03 22:34 
GeneralFind Element Pin
blink4me28-Mar-03 12:30
blink4me28-Mar-03 12:30 
GeneralRe: Find Element Pin
Richard Deeming30-Mar-03 22:38
mveRichard Deeming30-Mar-03 22:38 
GeneralDefining Schema Pin
chito27-Mar-03 22:46
chito27-Mar-03 22:46 
GeneralRe: Defining Schema Pin
Michael A. Barnhart28-Mar-03 1:22
Michael A. Barnhart28-Mar-03 1:22 
GeneralXML file in VC++ Pin
joyshiv27-Mar-03 18:50
joyshiv27-Mar-03 18:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.