A parsed (and optionally repaired) document is represented by Tidy as a tree, much like a W3C DOM.
This tree may be traversed using these functions. The following snippet gives a basic idea how these functions can be used.
void dumpNode(
TidyNode tnod,
int indent ) {
default:
break;
}
assert( name != NULL );
printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name );
dumpNode( child, indent + 4 );
}
}
}
}
Discard an attribute.
- Parameters
-
itdoc | The tidy document from which to discard the attribute. |
tnod | The node from which to discard the attribute. |
tattr | The attribute to discard. |
Get the first attribute.
- Parameters
-
tnod | The node for which to get attributes. |
- Returns
- Returns an instance of TidyAttr.
Get an instance of TidyAttr by specifying an attribute ID.
- Returns
- Returns a TidyAttr instance.
- Parameters
-
tnod | The node to query. |
attId | The attribute ID to find. |
Get the attribute ID given a tidy attribute.
- Parameters
-
tattr | The attribute to query. |
- Returns
- Returns the TidyAttrId of the given attribute.
Indicates whether or not a given attribute is an event attribute.
- Parameters
-
tattr | The attribute to query. |
- Returns
- Returns a bool indicating whether or not the attribute is an event.
Get the name of a TidyAttr instance.
- Parameters
-
tattr | The tidy attribute to query. |
- Returns
- Returns a string indicating the name of the attribute.
Get the next attribute.
- Parameters
-
tattr | The current attribute, so the next one can be returned. |
- Returns
- Returns and instance of TidyAttr.
Get the value of a TidyAttr instance.
- Parameters
-
tattr | The tidy attribute to query. |
- Returns
- Returns a string indicating the value of the attribute.
Remove the indicated node.
- Returns
- Returns the next tidy node.
- Parameters
-
tdoc | The tidy document from which to remove the node. |
tnod | The node to remove |
Get the BODY node.
- Parameters
-
tdoc | The document to query. |
- Returns
- Returns a tidy node.
Get the child of the indicated node.
- Parameters
-
- Returns
- Returns a tidy node.
Get the HEAD node.
- Parameters
-
tdoc | The document to query. |
- Returns
- Returns a tidy node.
Get the HTML node.
- Parameters
-
tdoc | The document to query. |
- Returns
- Returns a tidy node.
Get the next sibling node.
- Parameters
-
- Returns
- Returns a tidy node.
Get the parent of the indicated node.
- Parameters
-
- Returns
- Returns a tidy node.
Get the previous sibling node.
- Parameters
-
- Returns
- Returns a tidy node.
Get the root node.
- Parameters
-
tdoc | The document to query. |
- Returns
- Returns a tidy node.
Get the column location of the node.
- Parameters
-
- Returns
- Returns the column location of the node.
Get the tag ID of the node.
- Parameters
-
- Returns
- Returns the tag ID of the node as TidyTagId.
Get the name of the node.
- Parameters
-
- Returns
- Returns a string indicating the name of the node.
Gets the text of a node and places it into the given TidyBuffer.
- Returns
- Returns a bool indicating success or not.
- Parameters
-
| tdoc | The document to query. |
| tnod | The node to query. |
[out] | buf | A TidyBuffer used to receive the node's text. |
Get the type of node.
- Parameters
-
- Returns
- Returns the type of node as TidyNodeType.
Get the value of the node.
This copies the unescaped value of this node into the given TidyBuffer at UTF-8.
- Returns
- Returns a bool indicating success or not.
- Parameters
-
| tdoc | The document to query |
| tnod | The node to query |
[out] | buf | A TidyBuffer used to receive the node's value. |
Indicates whether or not the node has text.
- Returns
- Returns the type of node as TidyNodeType.
- Parameters
-
tdoc | The document to query. |
tnod | The node to query. |
Indicates whether or not a node represents and HTML header element, such as h1, h2, etc.
- Parameters
-
- Returns
- Returns a bool indicating whether or not the node is an HTML header.
Indicates whether or not the node is a propriety type.
- Returns
- Returns a bool indicating whether or not the node is a proprietary type.
- Parameters
-
tdoc | The document to query. |
tnod | The node to query |
Indicates whether or not a node is a text node.
- Parameters
-
- Returns
- Returns a bool indicating whether or not the node is a text node.
Get the line number where the node occurs.
- Parameters
-
- Returns
- Returns the line number.