Back to Turicreate

HTMLtree: specific APIs to process HTML tree, especially serialization

deps/src/libxml2-2.9.1/doc/devhelp/libxml2-HTMLtree.html

6.4.111.9 KB
Original Source

| | | | | libxml2 Reference Manual |

HTMLtree

HTMLtree - specific APIs to process HTML tree, especially serialization

this module implements a few function needed to process tree in an HTML specific way.

Author(s): Daniel Veillard

Synopsis

#define[HTML\_ENTITY\_REF\_NODE](#HTML_ENTITY_REF_NODE);
#define[HTML\_COMMENT\_NODE](#HTML_COMMENT_NODE);
#define[HTML\_PRESERVE\_NODE](#HTML_PRESERVE_NODE);
#define[HTML\_TEXT\_NODE](#HTML_TEXT_NODE);
#define[HTML\_PI\_NODE](#HTML_PI_NODE);
int[htmlNodeDumpFileFormat](#htmlNodeDumpFileFormat)(FILE * out,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur,
const char * encoding,
int format);
void[htmlDocDumpMemory](#htmlDocDumpMemory)([xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
[xmlChar](libxml2-xmlstring.html#xmlChar)** mem,
int * size);
int[htmlSaveFile](#htmlSaveFile)(const char * filename,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur);
int[htmlDocDump](#htmlDocDump)(FILE * f,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur);
void[htmlDocDumpMemoryFormat](#htmlDocDumpMemoryFormat)([xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
[xmlChar](libxml2-xmlstring.html#xmlChar)** mem,
int * size,
int format);
int[htmlIsBooleanAttr](#htmlIsBooleanAttr)(const[xmlChar](libxml2-xmlstring.html#xmlChar)* name);
int[htmlSaveFileFormat](#htmlSaveFileFormat)(const char * filename,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
const char * encoding,
int format);
void[htmlNodeDumpFormatOutput](#htmlNodeDumpFormatOutput)([xmlOutputBufferPtr](libxml2-tree.html#xmlOutputBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur,
const char * encoding,
int format);
int[htmlSetMetaEncoding](#htmlSetMetaEncoding)([htmlDocPtr](libxml2-HTMLparser.html#htmlDocPtr)doc,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* encoding);
int[htmlSaveFileEnc](#htmlSaveFileEnc)(const char * filename,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
const char * encoding);
void[htmlNodeDumpOutput](#htmlNodeDumpOutput)([xmlOutputBufferPtr](libxml2-tree.html#xmlOutputBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur,
const char * encoding);
int[htmlNodeDump](#htmlNodeDump)([xmlBufferPtr](libxml2-tree.html#xmlBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur);[htmlDocPtr](libxml2-HTMLparser.html#htmlDocPtr)[htmlNewDoc](#htmlNewDoc)(const[xmlChar](libxml2-xmlstring.html#xmlChar)* URI,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* ExternalID);
const[xmlChar](libxml2-xmlstring.html#xmlChar)*[htmlGetMetaEncoding](#htmlGetMetaEncoding)([htmlDocPtr](libxml2-HTMLparser.html#htmlDocPtr)doc);
void[htmlNodeDumpFile](#htmlNodeDumpFile)(FILE * out,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur);
void[htmlDocContentDumpFormatOutput](#htmlDocContentDumpFormatOutput)([xmlOutputBufferPtr](libxml2-tree.html#xmlOutputBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
const char * encoding,
int format);[htmlDocPtr](libxml2-HTMLparser.html#htmlDocPtr)[htmlNewDocNoDtD](#htmlNewDocNoDtD)(const[xmlChar](libxml2-xmlstring.html#xmlChar)* URI,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* ExternalID);
void[htmlDocContentDumpOutput](#htmlDocContentDumpOutput)([xmlOutputBufferPtr](libxml2-tree.html#xmlOutputBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
const char * encoding);

Description

Details

Macro HTML_COMMENT_NODE

#define[HTML\_COMMENT\_NODE](#HTML_COMMENT_NODE);

Macro. A comment in a HTML document is really implemented the same way as a comment in an XML document.


Macro HTML_ENTITY_REF_NODE

#define[HTML\_ENTITY\_REF\_NODE](#HTML_ENTITY_REF_NODE);

Macro. An entity reference in a HTML document is really implemented the same way as an entity reference in an XML document.


Macro HTML_PI_NODE

#define[HTML\_PI\_NODE](#HTML_PI_NODE);

Macro. A processing instruction in a HTML document is really implemented the same way as a processing instruction in an XML document.


Macro HTML_PRESERVE_NODE

#define[HTML\_PRESERVE\_NODE](#HTML_PRESERVE_NODE);

Macro. A preserved node in a HTML document is really implemented the same way as a CDATA section in an XML document.


Macro HTML_TEXT_NODE

#define[HTML\_TEXT\_NODE](#HTML_TEXT_NODE);

Macro. A text node in a HTML document is really implemented the same way as a text node in an XML document.


htmlDocContentDumpFormatOutput ()

void	htmlDocContentDumpFormatOutput	([xmlOutputBufferPtr](libxml2-tree.html#xmlOutputBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
const char * encoding,
int format)

Dump an HTML document.

| buf: | the HTML buffer output | | cur: | the document | | encoding: | the encoding string | | format: | should formatting spaces been added |


htmlDocContentDumpOutput ()

void	htmlDocContentDumpOutput	([xmlOutputBufferPtr](libxml2-tree.html#xmlOutputBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
const char * encoding)

Dump an HTML document. Formating return/spaces are added.

| buf: | the HTML buffer output | | cur: | the document | | encoding: | the encoding string |


htmlDocDump ()

int	htmlDocDump (FILE * f,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur)

Dump an HTML document to an open FILE.

| f: | the FILE* | | cur: | the document | | Returns: | the number of byte written or -1 in case of failure. |


htmlDocDumpMemory ()

void	htmlDocDumpMemory ([xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
[xmlChar](libxml2-xmlstring.html#xmlChar)** mem,
int * size)

Dump an HTML document in memory and return the xmlChar * and it's size. It's up to the caller to free the memory.

| cur: | the document | | mem: | OUT: the memory pointer | | size: | OUT: the memory length |


htmlDocDumpMemoryFormat ()

void	htmlDocDumpMemoryFormat ([xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
[xmlChar](libxml2-xmlstring.html#xmlChar)** mem,
int * size,
int format)

Dump an HTML document in memory and return the xmlChar * and it's size. It's up to the caller to free the memory.

| cur: | the document | | mem: | OUT: the memory pointer | | size: | OUT: the memory length | | format: | should formatting spaces been added |


htmlGetMetaEncoding ()

const[xmlChar](libxml2-xmlstring.html#xmlChar)*	htmlGetMetaEncoding	([htmlDocPtr](libxml2-HTMLparser.html#htmlDocPtr)doc)

Encoding definition lookup in the Meta tags

| doc: | the document | | Returns: | the current encoding as flagged in the HTML source |


htmlIsBooleanAttr ()

int	htmlIsBooleanAttr (const[xmlChar](libxml2-xmlstring.html#xmlChar)* name)

Determine if a given attribute is a boolean attribute.

| name: | the name of the attribute to check | | Returns: | false if the attribute is not boolean, true otherwise. |


htmlNewDoc ()

[htmlDocPtr](libxml2-HTMLparser.html#htmlDocPtr)htmlNewDoc (const[xmlChar](libxml2-xmlstring.html#xmlChar)* URI,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* ExternalID)

Creates a new HTML document

| URI: | URI for the dtd, or NULL | | ExternalID: | the external ID of the DTD, or NULL | | Returns: | a new document |


htmlNewDocNoDtD ()

[htmlDocPtr](libxml2-HTMLparser.html#htmlDocPtr)htmlNewDocNoDtD (const[xmlChar](libxml2-xmlstring.html#xmlChar)* URI,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* ExternalID)

Creates a new HTML document without a DTD node if @URI and @ExternalID are NULL

| URI: | URI for the dtd, or NULL | | ExternalID: | the external ID of the DTD, or NULL | | Returns: | a new document, do not initialize the DTD if not provided |


htmlNodeDump ()

int	htmlNodeDump ([xmlBufferPtr](libxml2-tree.html#xmlBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur)

Dump an HTML node, recursive behaviour,children are printed too, and formatting returns are added.

| buf: | the HTML buffer output | | doc: | the document | | cur: | the current node | | Returns: | the number of byte written or -1 in case of error |


htmlNodeDumpFile ()

void	htmlNodeDumpFile (FILE * out,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur)

Dump an HTML node, recursive behaviour,children are printed too, and formatting returns are added.

| out: | the FILE pointer | | doc: | the document | | cur: | the current node |


htmlNodeDumpFileFormat ()

int	htmlNodeDumpFileFormat (FILE * out,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur,
const char * encoding,
int format)

Dump an HTML node, recursive behaviour,children are printed too. TODO: if encoding == NULL try to save in the doc encoding

| out: | the FILE pointer | | doc: | the document | | cur: | the current node | | encoding: | the document encoding | | format: | should formatting spaces been added | | Returns: | the number of byte written or -1 in case of failure. |


htmlNodeDumpFormatOutput ()

void	htmlNodeDumpFormatOutput	([xmlOutputBufferPtr](libxml2-tree.html#xmlOutputBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur,
const char * encoding,
int format)

Dump an HTML node, recursive behaviour,children are printed too.

| buf: | the HTML buffer output | | doc: | the document | | cur: | the current node | | encoding: | the encoding string | | format: | should formatting spaces been added |


htmlNodeDumpOutput ()

void	htmlNodeDumpOutput ([xmlOutputBufferPtr](libxml2-tree.html#xmlOutputBufferPtr)buf,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)doc,
[xmlNodePtr](libxml2-tree.html#xmlNodePtr)cur,
const char * encoding)

Dump an HTML node, recursive behaviour,children are printed too, and formatting returns/spaces are added.

| buf: | the HTML buffer output | | doc: | the document | | cur: | the current node | | encoding: | the encoding string |


htmlSaveFile ()

int	htmlSaveFile (const char * filename,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur)

Dump an HTML document to a file. If @filename is "-" the stdout file is used.

| filename: | the filename (or URL) | | cur: | the document | | Returns: | the number of byte written or -1 in case of failure. |


htmlSaveFileEnc ()

int	htmlSaveFileEnc (const char * filename,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
const char * encoding)

Dump an HTML document to a file using a given encoding and formatting returns/spaces are added.

| filename: | the filename | | cur: | the document | | encoding: | the document encoding | | Returns: | the number of byte written or -1 in case of failure. |


htmlSaveFileFormat ()

int	htmlSaveFileFormat (const char * filename,
[xmlDocPtr](libxml2-tree.html#xmlDocPtr)cur,
const char * encoding,
int format)

Dump an HTML document to a file using a given encoding.

| filename: | the filename | | cur: | the document | | encoding: | the document encoding | | format: | should formatting spaces been added | | Returns: | the number of byte written or -1 in case of failure. |


htmlSetMetaEncoding ()

int	htmlSetMetaEncoding ([htmlDocPtr](libxml2-HTMLparser.html#htmlDocPtr)doc,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* encoding)

Sets the current encoding in the Meta tags NOTE: this will not change the document content encoding, just the META flag associated.

| doc: | the document | | encoding: | the encoding string | | Returns: | 0 in case of success and -1 in case of error |