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 );
}
}
}
}
◆ tidyAttrDiscard()
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. |
◆ tidyAttrFirst()
Get the first attribute.
- Parameters
-
tnod | The node for which to get attributes. |
- Returns
- Returns an instance of TidyAttr.
◆ tidyAttrGetById()
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. |
◆ tidyAttrGetId()
Get the attribute ID given a tidy attribute.
- Parameters
-
tattr | The attribute to query. |
- Returns
- Returns the TidyAttrId of the given attribute.
◆ tidyAttrIsEvent()
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.
◆ tidyAttrName()
Get the name of a TidyAttr instance.
- Parameters
-
tattr | The tidy attribute to query. |
- Returns
- Returns a string indicating the name of the attribute.
◆ tidyAttrNext()
Get the next attribute.
- Parameters
-
tattr | The current attribute, so the next one can be returned. |
- Returns
- Returns and instance of TidyAttr.
◆ tidyAttrValue()
Get the value of a TidyAttr instance.
- Parameters
-
tattr | The tidy attribute to query. |
- Returns
- Returns a string indicating the value of the attribute.
◆ tidyDiscardElement()
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 |
◆ tidyGetBody()
Get the BODY node.
- Parameters
-
tdoc | The document to query. |
- Returns
- Returns a tidy node.
◆ tidyGetChild()
Get the child of the indicated node.
- Parameters
-
- Returns
- Returns a tidy node.
◆ tidyGetHead()
Get the HEAD node.
- Parameters
-
tdoc | The document to query. |
- Returns
- Returns a tidy node.
◆ tidyGetHtml()
Get the HTML node.
- Parameters
-
tdoc | The document to query. |
- Returns
- Returns a tidy node.
◆ tidyGetNext()
Get the next sibling node.
- Parameters
-
- Returns
- Returns a tidy node.
◆ tidyGetParent()
Get the parent of the indicated node.
- Parameters
-
- Returns
- Returns a tidy node.
◆ tidyGetPrev()
Get the previous sibling node.
- Parameters
-
- Returns
- Returns a tidy node.
◆ tidyGetRoot()
Get the root node.
- Parameters
-
tdoc | The document to query. |
- Returns
- Returns a tidy node.
◆ tidyNodeColumn()
Get the column location of the node.
- Parameters
-
- Returns
- Returns the column location of the node.
◆ tidyNodeGetId()
Get the tag ID of the node.
- Parameters
-
- Returns
- Returns the tag ID of the node as TidyTagId.
◆ tidyNodeGetName()
Get the name of the node.
- Parameters
-
- Returns
- Returns a string indicating the name of the node.
◆ tidyNodeGetText()
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 | [out] A TidyBuffer used to receive the node's text. |
◆ tidyNodeGetType()
Get the type of node.
- Parameters
-
- Returns
- Returns the type of node as TidyNodeType.
◆ tidyNodeGetValue()
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 | [out] A TidyBuffer used to receive the node's value. |
◆ tidyNodeHasText()
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. |
◆ tidyNodeIsHeader()
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.
◆ tidyNodeIsProp()
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 |
◆ tidyNodeIsText()
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.
◆ tidyNodeLine()
Get the line number where the node occurs.
- Parameters
-
- Returns
- Returns the line number.