User Tools

Site Tools




Method to check whether a token is an XML/XHTML tag. You can use this method as a replacement for the RoboHelp.TagType constant. The RoboHelp.TagType constant only supports a limited number of tags and is cumbersome to use. This method supports every possible tag. Especially useful for parsing XML files. This method is the equivalent of the function token_isTag()


To check whether a token is a tag, and not text:

if(token.isTag()) {
  //Do something if this is tag

To check for a specific tag:

if(token.isTag("p")) {
    //Do something if this is a paragraph start tag

To check for an array of specific tags:

//The second tag is an end paragraph tag: </p> in short.
var tags = new Array("p", "/p", "img");
if(token.isTag(tags)) {
   //Do something if this is one of the tags specified in the array tags

Note: When you check for a specific tag, specify only the name of the tag such as: p, img, etcetera. When you want to check for an end tag, specify only the backslash with the tag name: /p and /body.


Parameter Data type Required Description
tag array/string The name of a node ar an array with node names. If omitted the method only checks that the token is a tag
casesensitive boolean If set to true, the tag name comparison is case sensitive. Default is false

Return Values

Value String Value
true The token is one of the tags specified
false The token is not one of the tags specified
null The method encountered an error
token/istag.txt · Last modified: 2017/06/03 14:14 (external edit)