@XMLHASXPATH[["filename",],xpath] : Returns 1 if the xpath exists in the XML file, or 0 if it doesn't.


If you do not specify a filename, @XMLHASXPATH will use the file previously opened by @XMLOPEN.


@XMLHASXPATH may be used to check if an xpath exists before setting it via @XMLXPATH.


The XML parser in TCC implements a subset of the XML XPath specification, allowing you to point to specific elements in the XML documents. The xpath is a series of one or more element accessors separated by '/'. The path can be absolute (starting with '/') or relative to the current XPath location.

The following are possible values for an element accessor:


A particular element name


The i-th subelement of the current element with the given name


The i-th subelement of the current element


The last subelement of the current element


The subelement located at the last location minus i in the current element


The subelement containing a particular value for a given attribute (supports single AND double quotes)


The parent of the current element



Bookstore.xml :


<?xml version="1.0" encoding="ISO-8859-1"?>



   <title lang="jap">Harry Potter</title>




   <title lang="eng">Learning XML</title>




   <title lang="ger">Day Watch</title>




   <title lang="eng">Winston Churchill: An Autobiography</title>





Return 1 if the XPath exists:


ECHO %@XMLHASXPATH["bookstore.xml",/bookstore]



XML Errors:


101 Invalid attribute index

102 No attributes available

103 Invalid namespace index

104 No namespaces available

105 Invalid element index

106 No elements available

107 Attribute does not exist

201 Unbalanced element tag

202 Unknown element prefix (can't find namespace)

203 Unknown attribute prefix (can't find namespace)

204 Invalid XML markup

205 Invalid end state for parser

206 Document contains unbalanced elements

207 Invalid XPath

208 No such child

209 Top element does not match start of path

210 DOM tree unavailable

302 Can't open file

401 Invalid XML would be generated

402 An invalid XML name has been specified