HTML Tidy 0.1

Functions
Document Tree

## Functions
TidyNode TIDY_CALL | tidyGetRoot (TidyDoc tdoc)
TidyNode TIDY_CALL | tidyGetHtml (TidyDoc tdoc)
TidyNode TIDY_CALL | tidyGetHead (TidyDoc tdoc)
TidyNode TIDY_CALL | tidyGetBody (TidyDoc tdoc)
TidyNode TIDY_CALL | tidyGetParent (TidyNode tnod)
TidyNode TIDY_CALL | tidyGetChild (TidyNode tnod)
TidyNode TIDY_CALL | tidyGetNext (TidyNode tnod)
TidyNode TIDY_CALL | tidyGetPrev (TidyNode tnod)
TidyAttr TIDY_CALL | tidyAttrFirst (TidyNode tnod)
TidyAttr TIDY_CALL | tidyAttrNext (TidyAttr tattr)
ctmbstr TIDY_CALL | tidyAttrName (TidyAttr tattr)
ctmbstr TIDY_CALL | tidyAttrValue (TidyAttr tattr)

## Detailed Description

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 )
    {
      TidyNode child;

      for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) )
      {
        ctmbstr name;
        switch ( tidyNodeGetType(child) )
        {
        case TidyNode_Root:       name = "Root";                    break;
        case TidyNode_DocType:    name = "DOCTYPE";                 break;
        case TidyNode_Comment:    name = "Comment";                 break;
        case TidyNode_ProcIns:    name = "Processing Instruction";  break;
        case TidyNode_Text:       name = "Text";                    break;
        case TidyNode_CDATA:      name = "CDATA";                   break;
        case TidyNode_Section:    name = "XML Section";             break;
        case TidyNode_Asp:        name = "ASP";                     break;
        case TidyNode_Jste:       name = "JSTE";                    break;
        case TidyNode_Php:        name = "PHP";                     break;
        case TidyNode_XmlDecl:    name = "XML Declaration";         break;

        case TidyNode_Start:
        case TidyNode_End:
        case TidyNode_StartEnd:
        default:
          name = tidyNodeGetName( child );
          break;
        }
        assert( name != NULL );
        printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name );
        dumpNode( child, indent + 4 );
      }
    }

    void dumpDoc( TidyDoc tdoc )
    {
      dumpNode( tidyGetRoot(tdoc), 0 );
    }

    void dumpBody( TidyDoc tdoc )
    {
      dumpNode( tidyGetBody(tdoc), 0 );
    }