libxml2 Reference Manual |
---|
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
#define HTML_COMMENT_NODE; #define HTML_ENTITY_REF_NODE; #define HTML_PI_NODE; #define HTML_PRESERVE_NODE; #define HTML_TEXT_NODE; void htmlDocContentDumpFormatOutput (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding,
int format); void htmlDocContentDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding); int htmlDocDump (FILE * f,
xmlDocPtr cur); void htmlDocDumpMemory (xmlDocPtr cur,
xmlChar ** mem,
int * size); void htmlDocDumpMemoryFormat (xmlDocPtr cur,
xmlChar ** mem,
int * size,
int format); const xmlChar * htmlGetMetaEncoding (htmlDocPtr doc); int htmlIsBooleanAttr (const xmlChar * name); htmlDocPtr htmlNewDoc (const xmlChar * URI,
const xmlChar * ExternalID); htmlDocPtr htmlNewDocNoDtD (const xmlChar * URI,
const xmlChar * ExternalID); int htmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur); void htmlNodeDumpFile (FILE * out,
xmlDocPtr doc,
xmlNodePtr cur); int htmlNodeDumpFileFormat (FILE * out,
xmlDocPtr doc,
xmlNodePtr cur,
const char * encoding,
int format); void htmlNodeDumpFormatOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char * encoding,
int format); void htmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char * encoding); int htmlSaveFile (const char * filename,
xmlDocPtr cur); int htmlSaveFileEnc (const char * filename,
xmlDocPtr cur,
const char * encoding); int htmlSaveFileFormat (const char * filename,
xmlDocPtr cur,
const char * encoding,
int format); int htmlSetMetaEncoding (htmlDocPtr doc,
const xmlChar * encoding);
#define HTML_COMMENT_NODE;
Macro. A comment in a HTML document is really implemented the same way as a comment in an XML document.
#define 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.
#define 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.
#define 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.
#define 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.
void htmlDocContentDumpFormatOutput (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding,
int format)
Dump an HTML document.
buf: | the HTML buffer output |
cur: | the document |
encoding: | the encoding string (unused) |
format: | should formatting spaces been added |
void htmlDocContentDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding)
Dump an HTML document. Formatting return/spaces are added.
buf: | the HTML buffer output |
cur: | the document |
encoding: | the encoding string (unused) |
int htmlDocDump (FILE * f,
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. |
void htmlDocDumpMemory (xmlDocPtr cur,
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 |
void htmlDocDumpMemoryFormat (xmlDocPtr cur,
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 |
const xmlChar * htmlGetMetaEncoding (htmlDocPtr doc)
Encoding definition lookup in the Meta tags
doc: | the document |
Returns: | the current encoding as flagged in the HTML source |
int htmlIsBooleanAttr (const xmlChar * name)
htmlDocPtr htmlNewDoc (const xmlChar * URI,
const 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 |
htmlDocPtr htmlNewDocNoDtD (const xmlChar * URI,
const 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 |
int htmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
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 |
void htmlNodeDumpFile (FILE * out,
xmlDocPtr doc,
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 |
int htmlNodeDumpFileFormat (FILE * out,
xmlDocPtr doc,
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. |
void htmlNodeDumpFormatOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
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 (unused) |
format: | should formatting spaces been added |
void htmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
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 (unused) |
int htmlSaveFile (const char * filename,
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. |
int htmlSaveFileEnc (const char * filename,
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. |
int htmlSaveFileFormat (const char * filename,
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. |
int htmlSetMetaEncoding (htmlDocPtr doc,
const 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 |