Initializing help system before first use

getname

getname


Purpose
Get the name of a node.
Synopsis
function getname(doc:xmldoc, n:integer):string
Arguments
doc 
Document to use
Node number
Return value
The name of the node depending on the node type:
XML_ELT 
name of the element section
XML_TXT 
"#text"
XML_CDATA 
"#cdata-section"
XML_COM 
"#comment"
XML_DATA 
"#data"
XML_PINST 
processing instruction target
XML_ATTR 
name of the attribute
Example
The following example collects the names of all element nodes occurring in a document.
  declarations
    DB: xmldoc
    NodeList: list of integer
    NodeNames: set of string
  end-declarations

  getnodes(DB, "/descendant-or-self::node()", NodeList)
  NodeNames:= union(r in NodeList | gettype(DB,r)=XML_ELT) {getname(DB,r)}
  writeln("Names of element nodes: ", NodeNames) 
Further information
Only element, attribute and processing instruction nodes have a name, for all other node types the above listed constant name is returned.
Related topics
Module