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.
Nodes for Document Sections | |
| TidyNode TIDY_CALL | tidyGetRoot (TidyDoc tdoc) |
| Get the root node. More... | |
| TidyNode TIDY_CALL | tidyGetHtml (TidyDoc tdoc) |
| Get the HTML node. More... | |
| TidyNode TIDY_CALL | tidyGetHead (TidyDoc tdoc) |
| Get the HEAD node. More... | |
| TidyNode TIDY_CALL | tidyGetBody (TidyDoc tdoc) |
| Get the BODY node. More... | |
Relative Nodes | |
| TidyNode TIDY_CALL | tidyGetParent (TidyNode tnod) |
| Get the parent of the indicated node. More... | |
| TidyNode TIDY_CALL | tidyGetChild (TidyNode tnod) |
| Get the child of the indicated node. More... | |
| TidyNode TIDY_CALL | tidyGetNext (TidyNode tnod) |
| Get the next sibling node. More... | |
| TidyNode TIDY_CALL | tidyGetPrev (TidyNode tnod) |
| Get the previous sibling node. More... | |
Miscellaneous Node Functions | |
| TidyNode TIDY_CALL | tidyDiscardElement (TidyDoc tdoc, TidyNode tnod) |
| Remove the indicated node. More... | |
Node Attribute Functions | |
| TidyAttr TIDY_CALL | tidyAttrFirst (TidyNode tnod) |
| Get the first attribute. More... | |
| TidyAttr TIDY_CALL | tidyAttrNext (TidyAttr tattr) |
| Get the next attribute. More... | |
| ctmbstr TIDY_CALL | tidyAttrName (TidyAttr tattr) |
| Get the name of a TidyAttr instance. More... | |
| ctmbstr TIDY_CALL | tidyAttrValue (TidyAttr tattr) |
| Get the value of a TidyAttr instance. More... | |
| void TIDY_CALL | tidyAttrDiscard (TidyDoc itdoc, TidyNode tnod, TidyAttr tattr) |
| Discard an attribute. More... | |
| TidyAttrId TIDY_CALL | tidyAttrGetId (TidyAttr tattr) |
| Get the attribute ID given a tidy attribute. More... | |
| Bool TIDY_CALL | tidyAttrIsEvent (TidyAttr tattr) |
| Indicates whether or not a given attribute is an event attribute. More... | |
| TidyAttr TIDY_CALL | tidyAttrGetById (TidyNode tnod, TidyAttrId attId) |
| Get an instance of TidyAttr by specifying an attribute ID. More... | |
Additional Node Interrogation | |
| TidyNodeType TIDY_CALL | tidyNodeGetType (TidyNode tnod) |
| Get the type of node. More... | |
| ctmbstr TIDY_CALL | tidyNodeGetName (TidyNode tnod) |
| Get the name of the node. More... | |
| Bool TIDY_CALL | tidyNodeIsText (TidyNode tnod) |
| Indicates whether or not a node is a text node. More... | |
| Bool TIDY_CALL | tidyNodeIsProp (TidyDoc tdoc, TidyNode tnod) |
| Indicates whether or not the node is a propriety type. More... | |
| Bool TIDY_CALL | tidyNodeIsHeader (TidyNode tnod) |
| Indicates whether or not a node represents and HTML header element, such as h1, h2, etc. More... | |
| Bool TIDY_CALL | tidyNodeHasText (TidyDoc tdoc, TidyNode tnod) |
| Indicates whether or not the node has text. More... | |
| Bool TIDY_CALL | tidyNodeGetText (TidyDoc tdoc, TidyNode tnod, TidyBuffer *buf) |
| Gets the text of a node and places it into the given TidyBuffer. More... | |
| Bool TIDY_CALL | tidyNodeGetValue (TidyDoc tdoc, TidyNode tnod, TidyBuffer *buf) |
| Get the value of the node. More... | |
| TidyTagId TIDY_CALL | tidyNodeGetId (TidyNode tnod) |
| Get the tag ID of the node. More... | |
| uint TIDY_CALL | tidyNodeLine (TidyNode tnod) |
| Get the line number where the node occurs. More... | |
| uint TIDY_CALL | tidyNodeColumn (TidyNode tnod) |
| Get the column location of the node. More... | |
Discard an attribute.
| 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.
| tnod | The node for which to get attributes. |
| TidyAttr TIDY_CALL tidyAttrGetById | ( | TidyNode | tnod, |
| TidyAttrId | attId | ||
| ) |
| TidyAttrId TIDY_CALL tidyAttrGetId | ( | TidyAttr | tattr | ) |
Get the attribute ID given a tidy attribute.
| tattr | The attribute to query. |
Indicates whether or not a given attribute is an event attribute.
| tattr | The attribute to query. |
Get the name of a TidyAttr instance.
| tattr | The tidy attribute to query. |
Get the next attribute.
| tattr | The current attribute, so the next one can be returned. |
Get the value of a TidyAttr instance.
| tattr | The tidy attribute to query. |
Remove the indicated node.
| tdoc | The tidy document from which to remove the node. |
| tnod | The node to remove |
Get the BODY node.
| tdoc | The document to query. |
Get the child of the indicated node.
| tnod | The node to query. |
Get the HEAD node.
| tdoc | The document to query. |
Get the HTML node.
| tdoc | The document to query. |
Get the next sibling node.
| tnod | The node to query. |
Get the parent of the indicated node.
| tnod | The node to query. |
Get the previous sibling node.
| tnod | The node to query. |
Get the root node.
| tdoc | The document to query. |
Get the column location of the node.
| tnod | The node to query. |
Get the tag ID of the node.
| tnod | The node to query. |
Get the name of the node.
| tnod | The node to query. |
Gets the text of a node and places it into the given TidyBuffer.
The text will be terminated with a TidyNewline. If you want the raw utf-8 stream see tidyNodeGetValue().
| tdoc | The document to query. | |
| tnod | The node to query. | |
| [out] | buf | A TidyBuffer used to receive the node's text. |
| TidyNodeType TIDY_CALL tidyNodeGetType | ( | TidyNode | tnod | ) |
Get the type of node.
| tnod | The node to query. |
Get the value of the node.
This copies the unescaped value of this node into the given TidyBuffer at UTF-8.
| 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.
| 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.
| tnod | The node to query. |
Indicates whether or not the node is a propriety type.
| tdoc | The document to query. |
| tnod | The node to query |
Indicates whether or not a node is a text node.
| tnod | The node to query. |