XPath - 'Invalid token' exception for '«' and '»' characters

Hi all

I'm trying to use XPath to select a node in a Word document saved as XML.

I'm looking for a <w:t> node with the value '«test_Title»'.

Problem is, I get the 'Invalid token' exception because it doesn't like the chevron characters.

Anyone aware of how I might escape them?



9/24/2008 9:40:49 AM
asp.net.xml-datasource 7181 articles. 0 followers. Follow

7 Replies

Similar Articles

[PageSpeed] 10
Get it on Google Play
Get it on Apple App Store


    Can you please provide us the xPath expression used for selecting the nodes.

If this post was useful to you, please mark it as answer. Thank you!
9/24/2008 4:07:42 PM

Hi there




9/25/2008 11:29:04 AM

Can you please replace each "<" with &lt; and ">" with &gt; in the xPath expression.

If this post was useful to you, please mark it as answer. Thank you!
9/25/2008 12:31:22 PM

 Are you sure about this? The double chevron appears to be represented as a single character - just try selecting this one and you'll see what I mean:


9/26/2008 11:22:48 AM

Hi Dovdimus,

Works fine on my pc.


        XmlDocument doc = new XmlDocument();
       XmlNodeList lst = doc.SelectNodes("//abz/item[contains(.,'«aaa»')]");

Samu Zhang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
9/29/2008 8:46:49 AM


Maybe try escaping with &laquo;
If I was helpful, please mark "answered" so I can get credit. Thanks!
9/29/2008 10:33:16 AM


     I tried in my sample and it is working fine... Following is the xpath i used:

<xsl:value-of select="contains(//result/location,'location«0»')"/>

Can you please provide the xml, so that we can check it on that xml.

If this post was useful to you, please mark it as answer. Thank you!
9/29/2008 11:04:12 AM

Similar Artilces:

Cleaning Invalid characters in XML with .NET
I am creating an RSS feed from my jobs my company posts. From here I want to post my jobs on Google Base. I have the code working greate except that a alot of the jobs that are posted contain bullets in the job descriptions. When this goes to Google Base they balk on the job posting. Is there a way in .NET to put in the appropriate character replacement so I can post them with bullets appropriate to XML? I know I need something like a CDDATA tag but I wanted to know if there was a class in the System.XML namespace or String or something in .NET that can clean it up. If u are using xml...

Exception processing invalid character in XML file. How to skip and continue
Hello, I am having trouble processing an XML file that contains an error on one of the nodes. How can I instruct the .NET framework to skip the node and continue when it comes across a node that contains an error? Please advise. This is the error: Hexadecimal value 0x1C is an invalid character Line 5810, position 83 // Here is my code XmlDocument doc = new XmlDocument(); FileStream fs = new FileStream(strXmlFileName, FileMode.Open); doc.Load(fs); // Get the node list -- line below is where the error occurs XmlNodeList catalog = doc.GetElementsByTa...

Invalid Characters in RSS feed results in System.Xml.XmlException: Invalid character in the given encoding. Line 541, position 404
Hi, I'm writing a webpage that saves the articles from an RSS feed into a SQL database. However, if I try to load the Pocket-Link.co.uk news feed (http://www.pocket-lint.co.uk/rss.phtml?type=news) into a XMLDocument I get the following exception:  System.Xml.XmlException: Invalid character in the given encoding. Line 541, position 404. It fails when trying to do the following: rssDoc.Load(rssStream); If I use IE7 to look at the feed it also errors and doesn't display ... Internet Explorer cannot display this feed - This feed contains code errors. However, Firefox DOES displ...

It is showing invalid character "□" by the XML web services in .net framework
 Hi, I am developing an smart device application where I am taking some data through mobile device,encrypting it & finally trying to insert it to the Oracle database by using XML web services.But my problem is that after encrypting the data & taking ASCII encoding of that data,I am getting one special symbol "□" which is not taken by the XML web services by showing the error that its invalid character for the XML format.SO as a result I am not able to insert the encrypted data into the Oracle Database. Can anyone give any solution of this problem? Waiting for your r...

XPATH Invalid tokens
I Have an issue with XPATH  and im looking for some helpHere is my code behind on my aspx pageXmlNodeList codelist = bankdoc.SelectNodes("//bank[text() = '" + GetXPathString(strBank) + "'] and ..branch[text()= '" + GetXPathString(strBranch) + "'] "); GetXPathString is a fxn to concat the 2 string, here it is            public  static string GetXPathString(string input)            {         &n...

XML Error Token StartElement in state Epilog would result in an invalid XML document
Hello. I am getting a strange error. Token StartElement in state Epilog would result in an invalid XML document.This is my codeIf dt.Rows.Count > 0 Then            ' Write to a memory stream            xWriter = New XmlTextWriter(ms, System.Text.Encoding.GetEncoding("iso-8859-1"))            ' Write the beginning of the document including the document declaration. Standalone is true.     &...

XPath invalid token
Hi, I'm trying to run a XPath expression like: expr = nav.Compile("//account[@ type='hedge']/products/product[@ name_product='Options US']/volume.min"); The problem is that there is a space between 'Options US', so I'm getting an invalid token error. How can i make it run anyway? hm now i experienced something weird ... this expression gives me the invalid token error: expr = nav.Compile("//account[@ type='hedge']/products/product[@ name_product='US Futures (CME, CBOT)']/volume.min"); but this one works: expr = nav.Compile("//account[@ typ...

Editing Xml file: Token StartElement in state Epilog would result in an invalid XML document
hello, i am creating Test.xml file and after that i want to editing(updating) that Test.xml file. but i got following error, "Token StartElement in state Epilog would result in an invalid XML document." when i am creating Test.xml that time i used following code,Dim fileName As String = Server.MapPath("xmls/" & strWebName + ".xml")Dim objXmlTW As XmlTextWriter = New System.Xml.XmlTextWriter(fileName, Nothing) objXmlTW.Formatting = System.Xml.Formatting.Indented objXmlTW.WriteStartDocument()objXmlTW.WriteStartElement("website") ...

Invalid characters before xml header
 Hello,When I create an XML header using this code:Dim XmlDec As XmlDeclarationXmlDec = XmlDoc.CreateXmlDeclaration("1.0", "utf-8", "")XmlDoc.InsertBefore(XmlDec, XmlDoc.DocumentElement)It adds some invalid characters before the header itself, only viewable witha text editor (IE opens the XML ok). This causes some perl code I got, whichreads from the XML, to fail.This is the header:?»¿<?xml version="1.0" encoding="UTF-8"?>Plz it's urgentHow can I fix this ?Thanks. I vaguely remember having this once.. can't remember what ...

vb.net xml xpath
I am trying to use xpath to get a value from XML. My XML document looks like: <?xml version="1.0" ?> - <dispatch_data xmlns="http://www.uxxxx.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="www.uxxxx.com dispatch.xsd"> - <dispatch_record> - <dess_headers> <source_node>CICS</source_node> </dess_headers> - <dispatch_headers> </dispatch_record> </dispatch_data> My VB.NET code is as follows: Sub xmlpath() Dim nav As XPathNavigator Dim docNav As XPathDocum...

XML-RPC Invalid character error
We're using Delphi2010, XMLRPC and Indy10; we had, a couple years ago, gone through an exercise in adapting to Unicode (which seems to be missing from the threads now). We're using the XML-RPC calls to interact with a partner's web site. Just recently, we encountered an "Invalid character error", apparently triggered by a char #233, which is an 'e-acute', commonly used in French. Anybody had experience with similar problems, or hints at what's wrong? Thanks, Lane Campbell NW Software Lane wrote: > Just recently, we encountered an "Invalid c...

ADO.NET(XML) Datasource missing
Well something has transpired with the ADO.NET(XML) Datasource, it is disappearing off our machines! We’ve been messing around with .NET 2.0 but I’m not sure that this is related.  When we try to validate tables we get “The database DLL ‘crdb_adoplus.dll’ could not be loaded. Just to clarify we are using Crystal Reports 9 Developer Edition, with the cr90dbexwin_en.exe patch to fix issues with the crdb_adoplus.dll   We’ve tried completely uninstalling and reinstalling Crystal with no luck.. Any help would be greatly appreciated....

Find/search «Next» and «Previous» wrong order
Name: Paul Product: Firefox Summary: Find/search «Next» and «Previous» wrong order Comments: The convention for searching next is right and previous is left. If find it very difficult to get used to Firefox esp when switching to other programs that follow the convention. Browser Details: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/2009040820 Firefox/3.0.9 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the...

System.Xml.XmlException invalid character
I am randomly receiving this error:System.Xml.XmlException: '', hexadecimal value 0x10, is an invalid character. Line 1, position 475. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char invChar) at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars) at System.Xml.XmlTextReaderImpl.ParseText() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.LoadNo...

Invalid character in the given encoding with remote xml
 Hi:I am trying to create a mashup with google maps and I have the next problem.It seems that the xml that google returns is not well formed and the xmltextreader gives me the above error.I think the real problem is that the xml has accents in it and the encoding is not properly set. Can anyone help me?  Can you post some of the XML Response and the code you are using?My Bloghttp://Lspence.blogspot.com(Please MARK this post as ANSWERED, if you find it helpful) ...

Web resources about - XPath - 'Invalid token' exception for '«' and '»' characters - asp.net.xml-datasource

Resources last updated: 2/12/2016 1:07:02 AM