�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!html/libxml2/index.html 0000644 00000010341 15252527635 0011071 0 ustar 00
|
|
|
libxml2 Reference Manual |
|---|
Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), it is free software available under the MIT License. XML itself is a metalanguage to design markup languages, i.e. text language where semantic and structure are added to the content using extra "markup" information enclosed between angle brackets. HTML is the most well-known markup language. Though the library is written in C a variety of language bindings make it available in other environments.
Libxml2 implements a number of existing standards related to markup languages:
As a result the libxml2 API is very large. If you get lost searching for some specific API use the online search engine hosted on xmlsoft.org the libxml2 and libxslt project page.
html/libxml2/libxml2-list.html 0000644 00000061742 15252527635 0012317 0 ustar 00|
|
|
|
|
libxml2 Reference Manual |
|---|
list - lists interfaces
this module implement the list support used in various place in the library.
Author(s): Gary Pennington <Gary.Pennington@uk.sun.com>
typedef struct _xmlLink xmlLink; typedef xmlLink * xmlLinkPtr; typedef struct _xmlList xmlList; typedef xmlList * xmlListPtr; int xmlListInsert (xmlListPtr l,
void * data); int xmlListEmpty (xmlListPtr l); void xmlListSort (xmlListPtr l); typedef void xmlListDeallocator (xmlLinkPtr lk); void xmlListMerge (xmlListPtr l1,
xmlListPtr l2); xmlListPtr xmlListCreate (xmlListDeallocator deallocator,
xmlListDataCompare compare); xmlListPtr xmlListDup (const xmlListPtr old); int xmlListRemoveLast (xmlListPtr l,
void * data); void xmlListWalk (xmlListPtr l,
xmlListWalker walker,
const void * user); int xmlListRemoveAll (xmlListPtr l,
void * data); int xmlListCopy (xmlListPtr cur,
const xmlListPtr old); void xmlListPopFront (xmlListPtr l); void * xmlListSearch (xmlListPtr l,
void * data); typedef int xmlListWalker (const void * data,
const void * user); int xmlListRemoveFirst (xmlListPtr l,
void * data); void xmlListReverseWalk (xmlListPtr l,
xmlListWalker walker,
const void * user); void * xmlLinkGetData (xmlLinkPtr lk); void xmlListClear (xmlListPtr l); int xmlListAppend (xmlListPtr l,
void * data); void xmlListReverse (xmlListPtr l); typedef int xmlListDataCompare (const void * data0,
const void * data1); int xmlListSize (xmlListPtr l); int xmlListPushFront (xmlListPtr l,
void * data); xmlLinkPtr xmlListEnd (xmlListPtr l); void xmlListPopBack (xmlListPtr l); void * xmlListReverseSearch (xmlListPtr l,
void * data); int xmlListPushBack (xmlListPtr l,
void * data); xmlLinkPtr xmlListFront (xmlListPtr l); void xmlListDelete (xmlListPtr l);
struct _xmlLink {
The content of this structure is not made public by the API.
} xmlLink;
struct _xmlList {
The content of this structure is not made public by the API.
} xmlList;
int xmlListDataCompare (const void * data0,
const void * data1)
Callback function used to compare 2 data.
| data0: | the first data |
| data1: | the second data |
| Returns: | 0 is equality, -1 or 1 otherwise depending on the ordering. |
void xmlListDeallocator (xmlLinkPtr lk)
Callback function used to free data from a list.
| lk: | the data to deallocate |
int xmlListWalker (const void * data,
const void * user)
Callback function used when walking a list with xmlListWalk().
| data: | the data found in the list |
| user: | extra user provided data to the walker |
| Returns: | 0 to stop walking the list, 1 otherwise. |
void * xmlLinkGetData (xmlLinkPtr lk)
See Returns.
| lk: | a link |
| Returns: | a pointer to the data referenced from this link |
int xmlListAppend (xmlListPtr l,
void * data)
Insert data in the ordered list at the end for this value
| l: | a list |
| data: | the data |
| Returns: | 0 in case of success, 1 in case of failure |
int xmlListCopy (xmlListPtr cur,
const xmlListPtr old)
Move all the element from the old list in the new list
| cur: | the new list |
| old: | the old list |
| Returns: | 0 in case of success 1 in case of error |
xmlListPtr xmlListCreate (xmlListDeallocator deallocator,
xmlListDataCompare compare)
Create a new list
| deallocator: | an optional deallocator function |
| compare: | an optional comparison function |
| Returns: | the new list or NULL in case of error |
xmlListPtr xmlListDup (const xmlListPtr old)
Duplicate the list
| old: | the list |
| Returns: | a new copy of the list or NULL in case of error |
int xmlListEmpty (xmlListPtr l)
Is the list empty ?
| l: | a list |
| Returns: | 1 if the list is empty, 0 if not empty and -1 in case of error |
xmlLinkPtr xmlListEnd (xmlListPtr l)
Get the last element in the list
| l: | a list |
| Returns: | the last element in the list, or NULL |
xmlLinkPtr xmlListFront (xmlListPtr l)
Get the first element in the list
| l: | a list |
| Returns: | the first element in the list, or NULL |
int xmlListInsert (xmlListPtr l,
void * data)
Insert data in the ordered list at the beginning for this value
| l: | a list |
| data: | the data |
| Returns: | 0 in case of success, 1 in case of failure |
void xmlListMerge (xmlListPtr l1,
xmlListPtr l2)
include all the elements of the second list in the first one and clear the second list
| l1: | the original list |
| l2: | the new list |
void xmlListPopFront (xmlListPtr l)
Removes the first element in the list
| l: | a list |
int xmlListPushBack (xmlListPtr l,
void * data)
add the new data at the end of the list
| l: | a list |
| data: | new data |
| Returns: | 1 if successful, 0 otherwise |
int xmlListPushFront (xmlListPtr l,
void * data)
add the new data at the beginning of the list
| l: | a list |
| data: | new data |
| Returns: | 1 if successful, 0 otherwise |
int xmlListRemoveAll (xmlListPtr l,
void * data)
Remove the all instance associated to data in the list
| l: | a list |
| data: | list data |
| Returns: | the number of deallocation, or 0 if not found |
int xmlListRemoveFirst (xmlListPtr l,
void * data)
Remove the first instance associated to data in the list
| l: | a list |
| data: | list data |
| Returns: | 1 if a deallocation occurred, or 0 if not found |
int xmlListRemoveLast (xmlListPtr l,
void * data)
Remove the last instance associated to data in the list
| l: | a list |
| data: | list data |
| Returns: | 1 if a deallocation occurred, or 0 if not found |
void xmlListReverse (xmlListPtr l)
Reverse the order of the elements in the list
| l: | a list |
void * xmlListReverseSearch (xmlListPtr l,
void * data)
Search the list in reverse order for an existing value of @data
| l: | a list |
| data: | a search value |
| Returns: | the value associated to @data or NULL in case of error |
void xmlListReverseWalk (xmlListPtr l,
xmlListWalker walker,
const void * user)
Walk all the element of the list in reverse order and apply the walker function to it
| l: | a list |
| walker: | a processing function |
| user: | a user parameter passed to the walker function |
void * xmlListSearch (xmlListPtr l,
void * data)
Search the list for an existing value of @data
| l: | a list |
| data: | a search value |
| Returns: | the value associated to @data or NULL in case of error |
int xmlListSize (xmlListPtr l)
Get the number of elements in the list
| l: | a list |
| Returns: | the number of elements in the list or -1 in case of error |
void xmlListWalk (xmlListPtr l,
xmlListWalker walker,
const void * user)
Walk all the element of the first from first to last and apply the walker function to it
| l: | a list |
| walker: | a processing function |
| user: | a user parameter passed to the walker function |
|
|
|
|
|
libxml2 Reference Manual |
|---|
hash - Chained hash tables
This module implements the hash table support used in various places in the library.
Author(s): Bjorn Reese <bjorn.reese@systematic.dk>
#define XML_CAST_FPTR(fptr); typedef struct _xmlHashTable xmlHashTable; typedef xmlHashTable * xmlHashTablePtr; void xmlHashScanFull (xmlHashTablePtr table,
xmlHashScannerFull f,
void * data); void xmlHashScan (xmlHashTablePtr table,
xmlHashScanner f,
void * data); typedef void xmlHashScannerFull (void * payload,
void * data,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3); xmlHashTablePtr xmlHashCreateDict (int size,
xmlDictPtr dict); int xmlHashAddEntry (xmlHashTablePtr table,
const xmlChar * name,
void * userdata); int xmlHashUpdateEntry (xmlHashTablePtr table,
const xmlChar * name,
void * userdata,
xmlHashDeallocator f); void * xmlHashQLookup3 (xmlHashTablePtr table,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * prefix2,
const xmlChar * name2,
const xmlChar * prefix3,
const xmlChar * name3); void * xmlHashQLookup2 (xmlHashTablePtr table,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * prefix2,
const xmlChar * name2); void xmlHashScan3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
xmlHashScanner f,
void * data); typedef void xmlHashScanner (void * payload,
void * data,
xmlChar * name); typedef void xmlHashDeallocator (void * payload,
xmlChar * name); xmlHashTablePtr xmlHashCreate (int size); void xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f); void * xmlHashLookup (xmlHashTablePtr table,
const xmlChar * name); void * xmlHashQLookup (xmlHashTablePtr table,
const xmlChar * prefix,
const xmlChar * name); int xmlHashUpdateEntry2 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
void * userdata,
xmlHashDeallocator f); int xmlHashRemoveEntry2 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
xmlHashDeallocator f); int xmlHashRemoveEntry3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
xmlHashDeallocator f); xmlHashTablePtr xmlHashCopy (xmlHashTablePtr table,
xmlHashCopier f); void xmlHashScanFull3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
xmlHashScannerFull f,
void * data); int xmlHashUpdateEntry3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
void * userdata,
xmlHashDeallocator f); void * xmlHashLookup3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3); void * xmlHashLookup2 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2); int xmlHashRemoveEntry (xmlHashTablePtr table,
const xmlChar * name,
xmlHashDeallocator f); typedef void * xmlHashCopier (void * payload,
xmlChar * name); int xmlHashAddEntry2 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
void * userdata); int xmlHashAddEntry3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
void * userdata); int xmlHashSize (xmlHashTablePtr table);
#define XML_CAST_FPTR(fptr);
Macro to do a casting from an object pointer to a function pointer without encountering a warning from gcc #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) This macro violated ISO C aliasing rules (gcc4 on s390 broke) so it is disabled now
| fptr: | pointer to a function |
struct _xmlHashTable {
The content of this structure is not made public by the API.
} xmlHashTable;
xmlHashTable * xmlHashTablePtr;
void * xmlHashCopier (void * payload,
xmlChar * name)
Callback to copy data from a hash.
| payload: | the data in the hash |
| name: | the name associated |
| Returns: | a copy of the data or NULL in case of error. |
void xmlHashDeallocator (void * payload,
xmlChar * name)
Callback to free data from a hash.
| payload: | the data in the hash |
| name: | the name associated |
void xmlHashScanner (void * payload,
void * data,
xmlChar * name)
Callback when scanning data in a hash with the simple scanner.
| payload: | the data in the hash |
| data: | extra scannner data |
| name: | the name associated |
void xmlHashScannerFull (void * payload,
void * data,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3)
Callback when scanning data in a hash with the full scanner.
| payload: | the data in the hash |
| data: | extra scannner data |
| name: | the name associated |
| name2: | the second name associated |
| name3: | the third name associated |
int xmlHashAddEntry (xmlHashTablePtr table,
const xmlChar * name,
void * userdata)
Add the @userdata to the hash @table. This can later be retrieved by using the @name. Duplicate names generate errors.
| table: | the hash table |
| name: | the name of the userdata |
| userdata: | a pointer to the userdata |
| Returns: | 0 the addition succeeded and -1 in case of error. |
int xmlHashAddEntry2 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
void * userdata)
Add the @userdata to the hash @table. This can later be retrieved by using the (@name, @name2) tuple. Duplicate tuples generate errors.
| table: | the hash table |
| name: | the name of the userdata |
| name2: | a second name of the userdata |
| userdata: | a pointer to the userdata |
| Returns: | 0 the addition succeeded and -1 in case of error. |
int xmlHashAddEntry3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
void * userdata)
Add the @userdata to the hash @table. This can later be retrieved by using the tuple (@name, @name2, @name3). Duplicate entries generate errors.
| table: | the hash table |
| name: | the name of the userdata |
| name2: | a second name of the userdata |
| name3: | a third name of the userdata |
| userdata: | a pointer to the userdata |
| Returns: | 0 the addition succeeded and -1 in case of error. |
xmlHashTablePtr xmlHashCopy (xmlHashTablePtr table,
xmlHashCopier f)
Scan the hash @table and applied @f to each value.
| table: | the hash table |
| f: | the copier function for items in the hash |
| Returns: | the new table or NULL in case of error. |
xmlHashTablePtr xmlHashCreate (int size)
Create a new xmlHashTablePtr.
| size: | the size of the hash table |
| Returns: | the newly created object, or NULL if an error occurred. |
xmlHashTablePtr xmlHashCreateDict (int size,
xmlDictPtr dict)
Create a new xmlHashTablePtr which will use @dict as the internal dictionary
| size: | the size of the hash table |
| dict: | a dictionary to use for the hash |
| Returns: | the newly created object, or NULL if an error occurred. |
void xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f)
Free the hash @table and its contents. The userdata is deallocated with @f if provided.
| table: | the hash table |
| f: | the deallocator function for items in the hash |
void * xmlHashLookup (xmlHashTablePtr table,
const xmlChar * name)
Find the userdata specified by the @name.
| table: | the hash table |
| name: | the name of the userdata |
| Returns: | the pointer to the userdata |
void * xmlHashLookup2 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2)
Find the userdata specified by the (@name, @name2) tuple.
| table: | the hash table |
| name: | the name of the userdata |
| name2: | a second name of the userdata |
| Returns: | the pointer to the userdata |
void * xmlHashLookup3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3)
Find the userdata specified by the (@name, @name2, @name3) tuple.
| table: | the hash table |
| name: | the name of the userdata |
| name2: | a second name of the userdata |
| name3: | a third name of the userdata |
| Returns: | the a pointer to the userdata |
void * xmlHashQLookup (xmlHashTablePtr table,
const xmlChar * prefix,
const xmlChar * name)
Find the userdata specified by the QName @prefix:@name/@name.
| table: | the hash table |
| prefix: | the prefix of the userdata |
| name: | the name of the userdata |
| Returns: | the pointer to the userdata |
void * xmlHashQLookup2 (xmlHashTablePtr table,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * prefix2,
const xmlChar * name2)
Find the userdata specified by the QNames tuple
| table: | the hash table |
| prefix: | the prefix of the userdata |
| name: | the name of the userdata |
| prefix2: | the second prefix of the userdata |
| name2: | a second name of the userdata |
| Returns: | the pointer to the userdata |
void * xmlHashQLookup3 (xmlHashTablePtr table,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * prefix2,
const xmlChar * name2,
const xmlChar * prefix3,
const xmlChar * name3)
Find the userdata specified by the (@name, @name2, @name3) tuple.
| table: | the hash table |
| prefix: | the prefix of the userdata |
| name: | the name of the userdata |
| prefix2: | the second prefix of the userdata |
| name2: | a second name of the userdata |
| prefix3: | the third prefix of the userdata |
| name3: | a third name of the userdata |
| Returns: | the a pointer to the userdata |
int xmlHashRemoveEntry (xmlHashTablePtr table,
const xmlChar * name,
xmlHashDeallocator f)
Find the userdata specified by the @name and remove it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.
| table: | the hash table |
| name: | the name of the userdata |
| f: | the deallocator function for removed item (if any) |
| Returns: | 0 if the removal succeeded and -1 in case of error or not found. |
int xmlHashRemoveEntry2 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
xmlHashDeallocator f)
Find the userdata specified by the (@name, @name2) tuple and remove it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.
| table: | the hash table |
| name: | the name of the userdata |
| name2: | a second name of the userdata |
| f: | the deallocator function for removed item (if any) |
| Returns: | 0 if the removal succeeded and -1 in case of error or not found. |
int xmlHashRemoveEntry3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
xmlHashDeallocator f)
Find the userdata specified by the (@name, @name2, @name3) tuple and remove it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.
| table: | the hash table |
| name: | the name of the userdata |
| name2: | a second name of the userdata |
| name3: | a third name of the userdata |
| f: | the deallocator function for removed item (if any) |
| Returns: | 0 if the removal succeeded and -1 in case of error or not found. |
void xmlHashScan (xmlHashTablePtr table,
xmlHashScanner f,
void * data)
Scan the hash @table and applied @f to each value.
| table: | the hash table |
| f: | the scanner function for items in the hash |
| data: | extra data passed to f |
void xmlHashScan3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
xmlHashScanner f,
void * data)
Scan the hash @table and applied @f to each value matching (@name, @name2, @name3) tuple. If one of the names is null, the comparison is considered to match.
| table: | the hash table |
| name: | the name of the userdata or NULL |
| name2: | a second name of the userdata or NULL |
| name3: | a third name of the userdata or NULL |
| f: | the scanner function for items in the hash |
| data: | extra data passed to f |
void xmlHashScanFull (xmlHashTablePtr table,
xmlHashScannerFull f,
void * data)
Scan the hash @table and applied @f to each value.
| table: | the hash table |
| f: | the scanner function for items in the hash |
| data: | extra data passed to f |
void xmlHashScanFull3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
xmlHashScannerFull f,
void * data)
Scan the hash @table and applied @f to each value matching (@name, @name2, @name3) tuple. If one of the names is null, the comparison is considered to match.
| table: | the hash table |
| name: | the name of the userdata or NULL |
| name2: | a second name of the userdata or NULL |
| name3: | a third name of the userdata or NULL |
| f: | the scanner function for items in the hash |
| data: | extra data passed to f |
int xmlHashSize (xmlHashTablePtr table)
Query the number of elements installed in the hash @table.
| table: | the hash table |
| Returns: | the number of elements in the hash table or -1 in case of error |
int xmlHashUpdateEntry (xmlHashTablePtr table,
const xmlChar * name,
void * userdata,
xmlHashDeallocator f)
Add the @userdata to the hash @table. This can later be retrieved by using the @name. Existing entry for this @name will be removed and freed with @f if found.
| table: | the hash table |
| name: | the name of the userdata |
| userdata: | a pointer to the userdata |
| f: | the deallocator function for replaced item (if any) |
| Returns: | 0 the addition succeeded and -1 in case of error. |
int xmlHashUpdateEntry2 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
void * userdata,
xmlHashDeallocator f)
Add the @userdata to the hash @table. This can later be retrieved by using the (@name, @name2) tuple. Existing entry for this tuple will be removed and freed with @f if found.
| table: | the hash table |
| name: | the name of the userdata |
| name2: | a second name of the userdata |
| userdata: | a pointer to the userdata |
| f: | the deallocator function for replaced item (if any) |
| Returns: | 0 the addition succeeded and -1 in case of error. |
int xmlHashUpdateEntry3 (xmlHashTablePtr table,
const xmlChar * name,
const xmlChar * name2,
const xmlChar * name3,
void * userdata,
xmlHashDeallocator f)
Add the @userdata to the hash @table. This can later be retrieved by using the tuple (@name, @name2, @name3). Existing entry for this tuple will be removed and freed with @f if found.
| table: | the hash table |
| name: | the name of the userdata |
| name2: | a second name of the userdata |
| name3: | a third name of the userdata |
| userdata: | a pointer to the userdata |
| f: | the deallocator function for replaced item (if any) |
| Returns: | 0 the addition succeeded and -1 in case of error. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlversion - compile-time version informations
compile-time version informations for the XML library
Author(s): Daniel Veillard
#define LIBXML_VERSION_EXTRA; #define LIBXML_MODULES_ENABLED; #define LIBXML_LEGACY_ENABLED; #define LIBXML_LZMA_ENABLED; #define LIBXML_READER_ENABLED; #define LIBXML_THREAD_ENABLED; #define LIBXML_DOTTED_VERSION; #define LIBXML_ISO8859X_ENABLED; #define LIBXML_DEBUG_ENABLED; #define LIBXML_XINCLUDE_ENABLED; #define ATTRIBUTE_UNUSED; #define LIBXML_DOCB_ENABLED; #define LIBXML_PUSH_ENABLED; #define LIBXML_SAX1_ENABLED; #define WITHOUT_TRIO; #define LIBXML_SCHEMATRON_ENABLED; #define LIBXML_HTTP_ENABLED; #define LIBXML_OUTPUT_ENABLED; #define WITH_TRIO; #define LIBXML_DEBUG_RUNTIME; #define LIBXML_VERSION; #define LIBXML_XPTR_ENABLED; #define LIBXML_VERSION_STRING; #define LIBXML_CATALOG_ENABLED; #define LIBXML_ATTR_ALLOC_SIZE; #define LIBXML_REGEXP_ENABLED; #define LIBXML_ICU_ENABLED; #define LIBXML_MODULE_EXTENSION; #define LIBXML_ICONV_ENABLED; #define LIBXML_HTML_ENABLED; #define LIBXML_UNICODE_ENABLED; #define LIBXML_FTP_ENABLED; #define LIBXML_AUTOMATA_ENABLED; #define LIBXML_ZLIB_ENABLED; #define LIBXML_WRITER_ENABLED; #define LIBXML_C14N_ENABLED; #define LIBXML_SCHEMAS_ENABLED; #define DEBUG_MEMORY_LOCATION; #define LIBXML_ATTR_FORMAT; #define LIBXML_TEST_VERSION; #define LIBXML_THREAD_ALLOC_ENABLED; #define LIBXML_XPATH_ENABLED; #define LIBXML_PATTERN_ENABLED; #define LIBXML_VALID_ENABLED; #define LIBXML_TREE_ENABLED; #define LIBXML_EXPR_ENABLED; void xmlCheckVersion (int version);
#define ATTRIBUTE_UNUSED;
Macro used to signal to GCC unused function parameters
#define DEBUG_MEMORY_LOCATION;
Whether the memory debugging is configured in
#define LIBXML_ATTR_ALLOC_SIZE;
Macro used to indicate to GCC this is an allocator function
#define LIBXML_ATTR_FORMAT;
Macro used to indicate to GCC the parameter are printf like
#define LIBXML_AUTOMATA_ENABLED;
Whether the automata interfaces are compiled in
#define LIBXML_C14N_ENABLED;
Whether the Canonicalization support is configured in
#define LIBXML_CATALOG_ENABLED;
Whether the Catalog support is configured in
#define LIBXML_DEBUG_RUNTIME;
Whether the runtime debugging is configured in
#define LIBXML_DOCB_ENABLED;
Whether the SGML Docbook support is configured in
#define LIBXML_EXPR_ENABLED;
Whether the formal expressions interfaces are compiled in
#define LIBXML_ISO8859X_ENABLED;
Whether ISO-8859-* support is made available in case iconv is not
#define LIBXML_LEGACY_ENABLED;
Whether the deprecated APIs are compiled in for compatibility
#define LIBXML_MODULES_ENABLED;
Whether the module interfaces are compiled in
#define LIBXML_MODULE_EXTENSION;
the string suffix used by dynamic modules (usually shared libraries)
#define LIBXML_OUTPUT_ENABLED;
Whether the serialization/saving support is configured in
#define LIBXML_PATTERN_ENABLED;
Whether the xmlPattern node selection interface is configured in
#define LIBXML_PUSH_ENABLED;
Whether the push parsing interfaces are configured in
#define LIBXML_READER_ENABLED;
Whether the xmlReader parsing interface is configured in
#define LIBXML_REGEXP_ENABLED;
Whether the regular expressions interfaces are compiled in
#define LIBXML_SAX1_ENABLED;
Whether the older SAX1 interface is configured in
#define LIBXML_SCHEMAS_ENABLED;
Whether the Schemas validation interfaces are compiled in
#define LIBXML_SCHEMATRON_ENABLED;
Whether the Schematron validation interfaces are compiled in
#define LIBXML_TEST_VERSION;
Macro to check that the libxml version in use is compatible with the version the software has been compiled against
#define LIBXML_THREAD_ALLOC_ENABLED;
Whether the allocation hooks are per-thread
#define LIBXML_THREAD_ENABLED;
Whether the thread support is configured in
#define LIBXML_TREE_ENABLED;
Whether the DOM like tree manipulation API support is configured in
#define LIBXML_UNICODE_ENABLED;
Whether the Unicode related interfaces are compiled in
#define LIBXML_VALID_ENABLED;
Whether the DTD validation support is configured in
#define LIBXML_VERSION_EXTRA;
extra version information, used to show a CVS compilation
#define LIBXML_VERSION_STRING;
the version number string, 1.2.3 value is "10203"
#define LIBXML_WRITER_ENABLED;
Whether the xmlWriter saving interface is configured in
void xmlCheckVersion (int version)
check the compiled lib version against the include one. This can warn or immediately kill the application
| version: | the include version number |
|
|
|
|
libxml2 Reference Manual |
|---|
DOCBparser - old DocBook SGML parser
HTMLparser - interface for an HTML 4.0 non-verifying parser
HTMLtree - specific APIs to process HTML tree, especially serialization
SAX - Old SAX version 1 handler, deprecated
SAX2 - SAX2 parser interface used to build the DOM tree
c14n - Provide Canonical XML and Exclusive XML Canonicalization
catalog - interfaces to the Catalog handling system
chvalid - Unicode character range checking
debugXML - Tree debugging APIs
dict - string dictionary
encoding - interface for the encoding conversion functions
entities - interface for the XML entities handling
globals - interface for all global variables of the library
hash - Chained hash tables
list - lists interfaces
nanoftp - minimal FTP implementation
nanohttp - minimal HTTP implementation
parser - the core parser module
parserInternals - internals routines and limits exported by the parser.
pattern - pattern expression handling
relaxng - implementation of the Relax-NG validation
schemasInternals - internal interfaces for XML Schemas
schematron - XML Schemastron implementation
threads - interfaces for thread handling
tree - interfaces for tree manipulation
uri - library of generic URI related routines
valid - The DTD validation
xinclude - implementation of XInclude
xlink - unfinished XLink detection module
xmlIO - interface for the I/O interfaces used by the parser
xmlautomata - API to build regexp automata
xmlerror - error handling
xmlexports - macros for marking symbols as exportable/importable.
xmlmemory - interface for the memory allocator
xmlmodule - dynamic module loading
xmlreader - the XMLReader implementation
xmlregexp - regular expressions handling
xmlsave - the XML document serializer
xmlschemas - incomplete XML Schemas structure implementation
xmlschemastypes - implementation of XML Schema Datatypes
xmlstring - set of routines to process strings
xmlunicode - Unicode character APIs
xmlversion - compile-time version informations
xmlwriter - text writing API for XML
xpath - XML Path Language implementation
xpathInternals - internal interfaces for XML Path Language implementation
xpointer - API to handle XML Pointers
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlmemory - interface for the memory allocator
provides interfaces for the memory allocator, including debugging capabilities.
Author(s): Daniel Veillard
#define xmlRealloc; #define xmlMalloc; #define xmlMallocAtomic; #define DEBUG_MEMORY; #define xmlMemStrdup; void * xmlMemRealloc (void * ptr,
size_t size); int xmlInitMemory (void); void xmlMemFree (void * ptr); void * xmlMemMalloc (size_t size); void xmlMemDisplayLast (FILE * fp,
long nbBytes); int xmlMemGet (xmlFreeFunc * freeFunc,
xmlMallocFunc * mallocFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc); void xmlMemoryDump (void); void * xmlMallocLoc (size_t size,
const char * file,
int line); void xmlMemDisplay (FILE * fp); int xmlMemBlocks (void); int xmlGcMemGet (xmlFreeFunc * freeFunc,
xmlMallocFunc * mallocFunc,
xmlMallocFunc * mallocAtomicFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc); typedef char * xmlStrdupFunc (const char * str); typedef void xmlFreeFunc (void * mem); void xmlMemShow (FILE * fp,
int nr); void * xmlMallocAtomicLoc (size_t size,
const char * file,
int line); void * xmlReallocLoc (void * ptr,
size_t size,
const char * file,
int line); void xmlCleanupMemory (void); int xmlMemUsed (void); int xmlMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc); typedef void * xmlReallocFunc (void * mem,
size_t size); typedef void * xmlMallocFunc (size_t size); int xmlGcMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc); char * xmlMemoryStrdup (const char * str); char * xmlMemStrdupLoc (const char * str,
const char * file,
int line);
#define DEBUG_MEMORY;
DEBUG_MEMORY replaces the allocator with a collect and debug shell to the libc allocator. DEBUG_MEMORY should only be activated when debugging libxml i.e. if libxml has been configured with --with-debug-mem too. #define DEBUG_MEMORY_FREED #define DEBUG_MEMORY_LOCATION
void xmlFreeFunc (void * mem)
Signature for a free() implementation.
| mem: | an already allocated block of memory |
void * xmlMallocFunc (size_t size)
Signature for a malloc() implementation.
| size: | the size requested in bytes |
| Returns: | a pointer to the newly allocated block or NULL in case of error. |
void * xmlReallocFunc (void * mem,
size_t size)
Signature for a realloc() implementation.
| mem: | an already allocated block of memory |
| size: | the new size requested in bytes |
| Returns: | a pointer to the newly reallocated block or NULL in case of error. |
char * xmlStrdupFunc (const char * str)
Signature for an strdup() implementation.
| str: | a zero terminated string |
| Returns: | the copy of the string or NULL in case of error. |
void xmlCleanupMemory (void)
Free up all the memory allocated by the library for its own use. This should not be called by user level code.
int xmlGcMemGet (xmlFreeFunc * freeFunc,
xmlMallocFunc * mallocFunc,
xmlMallocFunc * mallocAtomicFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc)
Provides the memory access functions set currently in use The mallocAtomicFunc is specialized for atomic block allocations (i.e. of areas useful for garbage collected memory allocators
| freeFunc: | place to save the free() function in use |
| mallocFunc: | place to save the malloc() function in use |
| mallocAtomicFunc: | place to save the atomic malloc() function in use |
| reallocFunc: | place to save the realloc() function in use |
| strdupFunc: | place to save the strdup() function in use |
| Returns: | 0 on success |
int xmlGcMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc)
Override the default memory access functions with a new set This has to be called before any other libxml routines ! The mallocAtomicFunc is specialized for atomic block allocations (i.e. of areas useful for garbage collected memory allocators Should this be blocked if there was already some allocations done ?
| freeFunc: | the free() function to use |
| mallocFunc: | the malloc() function to use |
| mallocAtomicFunc: | the malloc() function to use for atomic allocations |
| reallocFunc: | the realloc() function to use |
| strdupFunc: | the strdup() function to use |
| Returns: | 0 on success |
void * xmlMallocAtomicLoc (size_t size,
const char * file,
int line)
a malloc() equivalent, with logging of the allocation info.
| size: | an unsigned int specifying the size in byte to allocate. |
| file: | the file name or NULL |
| line: | the line number |
| Returns: | a pointer to the allocated area or NULL in case of lack of memory. |
void * xmlMallocLoc (size_t size,
const char * file,
int line)
a malloc() equivalent, with logging of the allocation info.
| size: | an int specifying the size in byte to allocate. |
| file: | the file name or NULL |
| line: | the line number |
| Returns: | a pointer to the allocated area or NULL in case of lack of memory. |
int xmlMemBlocks (void)
Provides the number of memory areas currently allocated
| Returns: | an int representing the number of blocks |
void xmlMemDisplay (FILE * fp)
show in-extenso the memory blocks allocated
| fp: | a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist |
void xmlMemDisplayLast (FILE * fp,
long nbBytes)
the last nbBytes of memory allocated and not freed, useful for dumping the memory left allocated between two places at runtime.
| fp: | a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist |
| nbBytes: | the amount of memory to dump |
void xmlMemFree (void * ptr)
a free() equivalent, with error checking.
| ptr: | the memory block pointer |
int xmlMemGet (xmlFreeFunc * freeFunc,
xmlMallocFunc * mallocFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc)
Provides the memory access functions set currently in use
| freeFunc: | place to save the free() function in use |
| mallocFunc: | place to save the malloc() function in use |
| reallocFunc: | place to save the realloc() function in use |
| strdupFunc: | place to save the strdup() function in use |
| Returns: | 0 on success |
void * xmlMemMalloc (size_t size)
a malloc() equivalent, with logging of the allocation info.
| size: | an int specifying the size in byte to allocate. |
| Returns: | a pointer to the allocated area or NULL in case of lack of memory. |
void * xmlMemRealloc (void * ptr,
size_t size)
a realloc() equivalent, with logging of the allocation info.
| ptr: | the initial memory block pointer |
| size: | an int specifying the size in byte to allocate. |
| Returns: | a pointer to the allocated area or NULL in case of lack of memory. |
int xmlMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc)
Override the default memory access functions with a new set This has to be called before any other libxml routines ! Should this be blocked if there was already some allocations done ?
| freeFunc: | the free() function to use |
| mallocFunc: | the malloc() function to use |
| reallocFunc: | the realloc() function to use |
| strdupFunc: | the strdup() function to use |
| Returns: | 0 on success |
void xmlMemShow (FILE * fp,
int nr)
show a show display of the memory allocated, and dump the @nr last allocated areas which were not freed
| fp: | a FILE descriptor used as the output file |
| nr: | number of entries to dump |
char * xmlMemStrdupLoc (const char * str,
const char * file,
int line)
a strdup() equivalent, with logging of the allocation info.
| str: | the initial string pointer |
| file: | the file name or NULL |
| line: | the line number |
| Returns: | a pointer to the new string or NULL if allocation error occurred. |
int xmlMemUsed (void)
Provides the amount of memory currently allocated
| Returns: | an int representing the amount of memory allocated. |
void xmlMemoryDump (void)
Dump in-extenso the memory blocks allocated to the file .memorylist
char * xmlMemoryStrdup (const char * str)
a strdup() equivalent, with logging of the allocation info.
| str: | the initial string pointer |
| Returns: | a pointer to the new string or NULL if allocation error occurred. |
void * xmlReallocLoc (void * ptr,
size_t size,
const char * file,
int line)
a realloc() equivalent, with logging of the allocation info.
| ptr: | the initial memory block pointer |
| size: | an int specifying the size in byte to allocate. |
| file: | the file name or NULL |
| line: | the line number |
| Returns: | a pointer to the allocated area or NULL in case of lack of memory. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
catalog - interfaces to the Catalog handling system
the catalog module implements the support for XML Catalogs and SGML catalogs
Author(s): Daniel Veillard
#define XML_CATALOG_PI; #define XML_CATALOGS_NAMESPACE; typedef enum xmlCatalogAllow; typedef enum xmlCatalogPrefer; typedef struct _xmlCatalog xmlCatalog; typedef xmlCatalog * xmlCatalogPtr; void xmlFreeCatalog (xmlCatalogPtr catal); void xmlLoadCatalogs (const char * pathss); xmlChar * xmlCatalogLocalResolve (void * catalogs,
const xmlChar * pubID,
const xmlChar * sysID); int xmlACatalogAdd (xmlCatalogPtr catal,
const xmlChar * type,
const xmlChar * orig,
const xmlChar * replace); xmlChar * xmlACatalogResolvePublic (xmlCatalogPtr catal,
const xmlChar * pubID); xmlCatalogAllow xmlCatalogGetDefaults (void); int xmlACatalogRemove (xmlCatalogPtr catal,
const xmlChar * value); xmlCatalogPrefer xmlCatalogSetDefaultPrefer (xmlCatalogPrefer prefer); xmlChar * xmlACatalogResolveURI (xmlCatalogPtr catal,
const xmlChar * URI); int xmlCatalogAdd (const xmlChar * type,
const xmlChar * orig,
const xmlChar * replace); xmlChar * xmlCatalogResolvePublic (const xmlChar * pubID); const xmlChar * xmlCatalogGetSystem (const xmlChar * sysID); void xmlInitializeCatalog (void); int xmlLoadCatalog (const char * filename); int xmlCatalogRemove (const xmlChar * value); int xmlCatalogIsEmpty (xmlCatalogPtr catal); void xmlACatalogDump (xmlCatalogPtr catal,
FILE * out); void xmlCatalogFreeLocal (void * catalogs); xmlChar * xmlACatalogResolve (xmlCatalogPtr catal,
const xmlChar * pubID,
const xmlChar * sysID); xmlChar * xmlCatalogResolveSystem (const xmlChar * sysID); xmlCatalogPtr xmlLoadSGMLSuperCatalog (const char * filename); int xmlCatalogConvert (void); const xmlChar * xmlCatalogGetPublic (const xmlChar * pubID); xmlCatalogPtr xmlLoadACatalog (const char * filename); xmlChar * xmlACatalogResolveSystem (xmlCatalogPtr catal,
const xmlChar * sysID); xmlChar * xmlCatalogLocalResolveURI (void * catalogs,
const xmlChar * URI); int xmlConvertSGMLCatalog (xmlCatalogPtr catal); void * xmlCatalogAddLocal (void * catalogs,
const xmlChar * URL); xmlCatalogPtr xmlNewCatalog (int sgml); xmlDocPtr xmlParseCatalogFile (const char * filename); int xmlCatalogSetDebug (int level); xmlChar * xmlCatalogResolve (const xmlChar * pubID,
const xmlChar * sysID); void xmlCatalogSetDefaults (xmlCatalogAllow allow); void xmlCatalogDump (FILE * out); void xmlCatalogCleanup (void); xmlChar * xmlCatalogResolveURI (const xmlChar * URI);
#define XML_CATALOGS_NAMESPACE;
The namespace for the XML Catalogs elements.
struct _xmlCatalog {
The content of this structure is not made public by the API.
} xmlCatalog;
enum xmlCatalogAllow { XML_CATA_ALLOW_NONE = 0 XML_CATA_ALLOW_GLOBAL = 1 XML_CATA_ALLOW_DOCUMENT = 2 XML_CATA_ALLOW_ALL = 3 };
enum xmlCatalogPrefer { XML_CATA_PREFER_NONE = 0 XML_CATA_PREFER_PUBLIC = 1 XML_CATA_PREFER_SYSTEM = 2 };
xmlCatalog * xmlCatalogPtr;
int xmlACatalogAdd (xmlCatalogPtr catal,
const xmlChar * type,
const xmlChar * orig,
const xmlChar * replace)
Add an entry in the catalog, it may overwrite existing but different entries.
| catal: | a Catalog |
| type: | the type of record to add to the catalog |
| orig: | the system, public or prefix to match |
| replace: | the replacement value for the match |
| Returns: | 0 if successful, -1 otherwise |
void xmlACatalogDump (xmlCatalogPtr catal,
FILE * out)
Dump the given catalog to the given file.
| catal: | a Catalog |
| out: | the file. |
int xmlACatalogRemove (xmlCatalogPtr catal,
const xmlChar * value)
Remove an entry from the catalog
| catal: | a Catalog |
| value: | the value to remove |
| Returns: | the number of entries removed if successful, -1 otherwise |
xmlChar * xmlACatalogResolve (xmlCatalogPtr catal,
const xmlChar * pubID,
const xmlChar * sysID)
Do a complete resolution lookup of an External Identifier
| catal: | a Catalog |
| pubID: | the public ID string |
| sysID: | the system ID string |
| Returns: | the URI of the resource or NULL if not found, it must be freed by the caller. |
xmlChar * xmlACatalogResolvePublic (xmlCatalogPtr catal,
const xmlChar * pubID)
Try to lookup the catalog local reference associated to a public ID in that catalog
| catal: | a Catalog |
| pubID: | the public ID string |
| Returns: | the local resource if found or NULL otherwise, the value returned must be freed by the caller. |
xmlChar * xmlACatalogResolveSystem (xmlCatalogPtr catal,
const xmlChar * sysID)
Try to lookup the catalog resource for a system ID
| catal: | a Catalog |
| sysID: | the system ID string |
| Returns: | the resource if found or NULL otherwise, the value returned must be freed by the caller. |
xmlChar * xmlACatalogResolveURI (xmlCatalogPtr catal,
const xmlChar * URI)
Do a complete resolution lookup of an URI
| catal: | a Catalog |
| URI: | the URI |
| Returns: | the URI of the resource or NULL if not found, it must be freed by the caller. |
int xmlCatalogAdd (const xmlChar * type,
const xmlChar * orig,
const xmlChar * replace)
Add an entry in the catalog, it may overwrite existing but different entries. If called before any other catalog routine, allows to override the default shared catalog put in place by xmlInitializeCatalog();
| type: | the type of record to add to the catalog |
| orig: | the system, public or prefix to match |
| replace: | the replacement value for the match |
| Returns: | 0 if successful, -1 otherwise |
void * xmlCatalogAddLocal (void * catalogs,
const xmlChar * URL)
Add the new entry to the catalog list
| catalogs: | a document's list of catalogs |
| URL: | the URL to a new local catalog |
| Returns: | the updated list |
int xmlCatalogConvert (void)
Convert all the SGML catalog entries as XML ones
| Returns: | the number of entries converted if successful, -1 otherwise |
void xmlCatalogDump (FILE * out)
Dump all the global catalog content to the given file.
| out: | the file. |
void xmlCatalogFreeLocal (void * catalogs)
Free up the memory associated to the catalog list
| catalogs: | a document's list of catalogs |
xmlCatalogAllow xmlCatalogGetDefaults (void)
Used to get the user preference w.r.t. to what catalogs should be accepted
| Returns: | the current xmlCatalogAllow value |
const xmlChar * xmlCatalogGetPublic (const xmlChar * pubID)
Try to lookup the catalog reference associated to a public ID DEPRECATED, use xmlCatalogResolvePublic()
| pubID: | the public ID string |
| Returns: | the resource if found or NULL otherwise. |
const xmlChar * xmlCatalogGetSystem (const xmlChar * sysID)
Try to lookup the catalog reference associated to a system ID DEPRECATED, use xmlCatalogResolveSystem()
| sysID: | the system ID string |
| Returns: | the resource if found or NULL otherwise. |
int xmlCatalogIsEmpty (xmlCatalogPtr catal)
Check is a catalog is empty
| catal: | should this create an SGML catalog |
| Returns: | 1 if the catalog is empty, 0 if not, amd -1 in case of error. |
xmlChar * xmlCatalogLocalResolve (void * catalogs,
const xmlChar * pubID,
const xmlChar * sysID)
Do a complete resolution lookup of an External Identifier using a document's private catalog list
| catalogs: | a document's list of catalogs |
| pubID: | the public ID string |
| sysID: | the system ID string |
| Returns: | the URI of the resource or NULL if not found, it must be freed by the caller. |
xmlChar * xmlCatalogLocalResolveURI (void * catalogs,
const xmlChar * URI)
Do a complete resolution lookup of an URI using a document's private catalog list
| catalogs: | a document's list of catalogs |
| URI: | the URI |
| Returns: | the URI of the resource or NULL if not found, it must be freed by the caller. |
int xmlCatalogRemove (const xmlChar * value)
Remove an entry from the catalog
| value: | the value to remove |
| Returns: | the number of entries removed if successful, -1 otherwise |
xmlChar * xmlCatalogResolve (const xmlChar * pubID,
const xmlChar * sysID)
Do a complete resolution lookup of an External Identifier
| pubID: | the public ID string |
| sysID: | the system ID string |
| Returns: | the URI of the resource or NULL if not found, it must be freed by the caller. |
xmlChar * xmlCatalogResolvePublic (const xmlChar * pubID)
Try to lookup the catalog reference associated to a public ID
| pubID: | the public ID string |
| Returns: | the resource if found or NULL otherwise, the value returned must be freed by the caller. |
xmlChar * xmlCatalogResolveSystem (const xmlChar * sysID)
Try to lookup the catalog resource for a system ID
| sysID: | the system ID string |
| Returns: | the resource if found or NULL otherwise, the value returned must be freed by the caller. |
xmlChar * xmlCatalogResolveURI (const xmlChar * URI)
Do a complete resolution lookup of an URI
| URI: | the URI |
| Returns: | the URI of the resource or NULL if not found, it must be freed by the caller. |
int xmlCatalogSetDebug (int level)
Used to set the debug level for catalog operation, 0 disable debugging, 1 enable it
| level: | the debug level of catalogs required |
| Returns: | the previous value of the catalog debugging level |
xmlCatalogPrefer xmlCatalogSetDefaultPrefer (xmlCatalogPrefer prefer)
Allows to set the preference between public and system for deletion in XML Catalog resolution. C.f. section 4.1.1 of the spec Values accepted are XML_CATA_PREFER_PUBLIC or XML_CATA_PREFER_SYSTEM
| prefer: | the default preference for delegation |
| Returns: | the previous value of the default preference for delegation |
void xmlCatalogSetDefaults (xmlCatalogAllow allow)
Used to set the user preference w.r.t. to what catalogs should be accepted
| allow: | what catalogs should be accepted |
int xmlConvertSGMLCatalog (xmlCatalogPtr catal)
Convert all the SGML catalog entries as XML ones
| catal: | the catalog |
| Returns: | the number of entries converted if successful, -1 otherwise |
void xmlFreeCatalog (xmlCatalogPtr catal)
Free the memory allocated to a Catalog
| catal: | a Catalog |
void xmlInitializeCatalog (void)
Do the catalog initialization. this function is not thread safe, catalog initialization should preferably be done once at startup
xmlCatalogPtr xmlLoadACatalog (const char * filename)
Load the catalog and build the associated data structures. This can be either an XML Catalog or an SGML Catalog It will recurse in SGML CATALOG entries. On the other hand XML Catalogs are not handled recursively.
| filename: | a file path |
| Returns: | the catalog parsed or NULL in case of error |
int xmlLoadCatalog (const char * filename)
Load the catalog and makes its definitions effective for the default external entity loader. It will recurse in SGML CATALOG entries. this function is not thread safe, catalog initialization should preferably be done once at startup
| filename: | a file path |
| Returns: | 0 in case of success -1 in case of error |
void xmlLoadCatalogs (const char * pathss)
Load the catalogs and makes their definitions effective for the default external entity loader. this function is not thread safe, catalog initialization should preferably be done once at startup
| pathss: | a list of directories separated by a colon or a space. |
xmlCatalogPtr xmlLoadSGMLSuperCatalog (const char * filename)
Load an SGML super catalog. It won't expand CATALOG or DELEGATE references. This is only needed for manipulating SGML Super Catalogs like adding and removing CATALOG or DELEGATE entries.
| filename: | a file path |
| Returns: | the catalog parsed or NULL in case of error |
xmlCatalogPtr xmlNewCatalog (int sgml)
create a new Catalog.
| sgml: | should this create an SGML catalog |
| Returns: | the xmlCatalogPtr or NULL in case of error |
xmlDocPtr xmlParseCatalogFile (const char * filename)
parse an XML file and build a tree. It's like xmlParseFile() except it bypass all catalog lookups.
| filename: | the filename |
| Returns: | the resulting document tree or NULL in case of error |
|
|
|
|
|
libxml2 Reference Manual |
|---|
nanohttp - minimal HTTP implementation
minimal HTTP implementation allowing to fetch resources like external subset.
Author(s): Daniel Veillard
int xmlNanoHTTPRead (void * ctx,
void * dest,
int len); int xmlNanoHTTPSave (void * ctxt,
const char * filename); const char * xmlNanoHTTPRedir (void * ctx); const char * xmlNanoHTTPAuthHeader (void * ctx); int xmlNanoHTTPFetch (const char * URL,
const char * filename,
char ** contentType); int xmlNanoHTTPContentLength (void * ctx); const char * xmlNanoHTTPMimeType (void * ctx); void xmlNanoHTTPClose (void * ctx); void xmlNanoHTTPCleanup (void); void * xmlNanoHTTPMethod (const char * URL,
const char * method,
const char * input,
char ** contentType,
const char * headers,
int ilen); void xmlNanoHTTPInit (void); void * xmlNanoHTTPOpen (const char * URL,
char ** contentType); void * xmlNanoHTTPOpenRedir (const char * URL,
char ** contentType,
char ** redir); void * xmlNanoHTTPMethodRedir (const char * URL,
const char * method,
const char * input,
char ** contentType,
char ** redir,
const char * headers,
int ilen); void xmlNanoHTTPScanProxy (const char * URL); const char * xmlNanoHTTPEncoding (void * ctx); int xmlNanoHTTPReturnCode (void * ctx);
const char * xmlNanoHTTPAuthHeader (void * ctx)
Get the authentication header of an HTTP context
| ctx: | the HTTP context |
| Returns: | the stashed value of the WWW-Authenticate or Proxy-Authenticate header. |
void xmlNanoHTTPClose (void * ctx)
This function closes an HTTP context, it ends up the connection and free all data related to it.
| ctx: | the HTTP context |
int xmlNanoHTTPContentLength (void * ctx)
Provides the specified content length from the HTTP header.
| ctx: | the HTTP context |
| Returns: | the specified content length from the HTTP header. Note that a value of -1 indicates that the content length element was not included in the response header. |
const char * xmlNanoHTTPEncoding (void * ctx)
Provides the specified encoding if specified in the HTTP headers.
| ctx: | the HTTP context |
| Returns: | the specified encoding or NULL if not available |
int xmlNanoHTTPFetch (const char * URL,
const char * filename,
char ** contentType)
This function try to fetch the indicated resource via HTTP GET and save it's content in the file.
| URL: | The URL to load |
| filename: | the filename where the content should be saved |
| contentType: | if available the Content-Type information will be returned at that location |
| Returns: | -1 in case of failure, 0 incase of success. The contentType, if provided must be freed by the caller |
void xmlNanoHTTPInit (void)
Initialize the HTTP protocol layer. Currently it just checks for proxy informations
void * xmlNanoHTTPMethod (const char * URL,
const char * method,
const char * input,
char ** contentType,
const char * headers,
int ilen)
This function try to open a connection to the indicated resource via HTTP using the given @method, adding the given extra headers and the input buffer for the request content.
| URL: | The URL to load |
| method: | the HTTP method to use |
| input: | the input string if any |
| contentType: | the Content-Type information IN and OUT |
| headers: | the extra headers |
| ilen: | input length |
| Returns: | NULL in case of failure, otherwise a request handler. The contentType, if provided must be freed by the caller |
void * xmlNanoHTTPMethodRedir (const char * URL,
const char * method,
const char * input,
char ** contentType,
char ** redir,
const char * headers,
int ilen)
This function try to open a connection to the indicated resource via HTTP using the given @method, adding the given extra headers and the input buffer for the request content.
| URL: | The URL to load |
| method: | the HTTP method to use |
| input: | the input string if any |
| contentType: | the Content-Type information IN and OUT |
| redir: | the redirected URL OUT |
| headers: | the extra headers |
| ilen: | input length |
| Returns: | NULL in case of failure, otherwise a request handler. The contentType, or redir, if provided must be freed by the caller |
const char * xmlNanoHTTPMimeType (void * ctx)
Provides the specified Mime-Type if specified in the HTTP headers.
| ctx: | the HTTP context |
| Returns: | the specified Mime-Type or NULL if not available |
void * xmlNanoHTTPOpen (const char * URL,
char ** contentType)
This function try to open a connection to the indicated resource via HTTP GET.
| URL: | The URL to load |
| contentType: | if available the Content-Type information will be returned at that location |
| Returns: | NULL in case of failure, otherwise a request handler. The contentType, if provided must be freed by the caller |
void * xmlNanoHTTPOpenRedir (const char * URL,
char ** contentType,
char ** redir)
This function try to open a connection to the indicated resource via HTTP GET.
| URL: | The URL to load |
| contentType: | if available the Content-Type information will be returned at that location |
| redir: | if available the redirected URL will be returned |
| Returns: | NULL in case of failure, otherwise a request handler. The contentType, if provided must be freed by the caller |
int xmlNanoHTTPRead (void * ctx,
void * dest,
int len)
This function tries to read @len bytes from the existing HTTP connection and saves them in @dest. This is a blocking call.
| ctx: | the HTTP context |
| dest: | a buffer |
| len: | the buffer length |
| Returns: | the number of byte read. 0 is an indication of an end of connection. -1 indicates a parameter error. |
const char * xmlNanoHTTPRedir (void * ctx)
Provides the specified redirection URL if available from the HTTP header.
| ctx: | the HTTP context |
| Returns: | the specified redirection URL or NULL if not redirected. |
int xmlNanoHTTPReturnCode (void * ctx)
Get the latest HTTP return code received
| ctx: | the HTTP context |
| Returns: | the HTTP return code for the request. |
int xmlNanoHTTPSave (void * ctxt,
const char * filename)
This function saves the output of the HTTP transaction to a file It closes and free the context at the end
| ctxt: | the HTTP context |
| filename: | the filename where the content should be saved |
| Returns: | -1 in case of failure, 0 incase of success. |
void xmlNanoHTTPScanProxy (const char * URL)
(Re)Initialize the HTTP Proxy context by parsing the URL and finding the protocol host port it indicates. Should be like http://myproxy/ or http://myproxy:3128/ A NULL URL cleans up proxy informations.
| URL: | The proxy URL used to initialize the proxy context |
|
|
|
|
|
libxml2 Reference Manual |
|---|
nanoftp - minimal FTP implementation
minimal FTP implementation allowing to fetch resources like external subset.
Author(s): Daniel Veillard
#define INVALID_SOCKET; #define SOCKET; int xmlNanoFTPQuit (void * ctx); int xmlNanoFTPClose (void * ctx); typedef void ftpListCallback (void * userData,
const char * filename,
const char * attrib,
const char * owner,
const char * group,
unsigned long size,
int links,
int year,
const char * month,
int day,
int hour,
int minute); int xmlNanoFTPCloseConnection (void * ctx); void xmlNanoFTPProxy (const char * host,
int port,
const char * user,
const char * passwd,
int type); int xmlNanoFTPUpdateURL (void * ctx,
const char * URL); SOCKET xmlNanoFTPGetConnection (void * ctx); int xmlNanoFTPDele (void * ctx,
const char * file); void * xmlNanoFTPNewCtxt (const char * URL); int xmlNanoFTPCheckResponse (void * ctx); void xmlNanoFTPScanProxy (const char * URL); typedef void ftpDataCallback (void * userData,
const char * data,
int len); int xmlNanoFTPGetResponse (void * ctx); int xmlNanoFTPCwd (void * ctx,
const char * directory); void xmlNanoFTPInit (void); void * xmlNanoFTPConnectTo (const char * server,
int port); int xmlNanoFTPList (void * ctx,
ftpListCallback callback,
void * userData,
const char * filename); void * xmlNanoFTPOpen (const char * URL); int xmlNanoFTPConnect (void * ctx); SOCKET xmlNanoFTPGetSocket (void * ctx,
const char * filename); int xmlNanoFTPGet (void * ctx,
ftpDataCallback callback,
void * userData,
const char * filename); int xmlNanoFTPRead (void * ctx,
void * dest,
int len); void xmlNanoFTPFreeCtxt (void * ctx); void xmlNanoFTPCleanup (void);
#define INVALID_SOCKET;
macro used to provide portability of code to windows sockets the value to be used when the socket is not valid
void ftpDataCallback (void * userData,
const char * data,
int len)
A callback for the xmlNanoFTPGet command.
| userData: | the user provided context |
| data: | the data received |
| len: | its size in bytes |
void ftpListCallback (void * userData,
const char * filename,
const char * attrib,
const char * owner,
const char * group,
unsigned long size,
int links,
int year,
const char * month,
int day,
int hour,
int minute)
A callback for the xmlNanoFTPList command. Note that only one of year and day:minute are specified.
| userData: | user provided data for the callback |
| filename: | the file name (including "->" when links are shown) |
| attrib: | the attribute string |
| owner: | the owner string |
| group: | the group string |
| size: | the file size |
| links: | the link count |
| year: | the year |
| month: | the month |
| day: | the day |
| hour: | the hour |
| minute: | the minute |
int xmlNanoFTPCheckResponse (void * ctx)
Check if there is a response from the FTP server after a command.
| ctx: | an FTP context |
| Returns: | the code number, or 0 |
void xmlNanoFTPCleanup (void)
Cleanup the FTP protocol layer. This cleanup proxy informations.
int xmlNanoFTPClose (void * ctx)
Close the connection and both control and transport
| ctx: | an FTP context |
| Returns: | -1 incase of error, 0 otherwise |
int xmlNanoFTPCloseConnection (void * ctx)
Close the data connection from the server
| ctx: | an FTP context |
| Returns: | -1 incase of error, 0 otherwise |
int xmlNanoFTPConnect (void * ctx)
Tries to open a control connection
| ctx: | an FTP context |
| Returns: | -1 in case of error, 0 otherwise |
void * xmlNanoFTPConnectTo (const char * server,
int port)
Tries to open a control connection to the given server/port
| server: | an FTP server name |
| port: | the port (use 21 if 0) |
| Returns: | an fTP context or NULL if it failed |
int xmlNanoFTPCwd (void * ctx,
const char * directory)
Tries to change the remote directory
| ctx: | an FTP context |
| directory: | a directory on the server |
| Returns: | -1 incase of error, 1 if CWD worked, 0 if it failed |
int xmlNanoFTPDele (void * ctx,
const char * file)
Tries to delete an item (file or directory) from server
| ctx: | an FTP context |
| file: | a file or directory on the server |
| Returns: | -1 incase of error, 1 if DELE worked, 0 if it failed |
void xmlNanoFTPFreeCtxt (void * ctx)
Frees the context after closing the connection.
| ctx: | an FTP context |
int xmlNanoFTPGet (void * ctx,
ftpDataCallback callback,
void * userData,
const char * filename)
Fetch the given file from the server. All data are passed back in the callbacks. The last callback has a size of 0 block.
| ctx: | an FTP context |
| callback: | the user callback |
| userData: | the user callback data |
| filename: | the file to retrieve |
| Returns: | -1 incase of error, 0 otherwise |
SOCKET xmlNanoFTPGetConnection (void * ctx)
Try to open a data connection to the server. Currently only passive mode is supported.
| ctx: | an FTP context |
| Returns: | -1 incase of error, 0 otherwise |
int xmlNanoFTPGetResponse (void * ctx)
Get the response from the FTP server after a command.
| ctx: | an FTP context |
| Returns: | the code number |
SOCKET xmlNanoFTPGetSocket (void * ctx,
const char * filename)
Initiate fetch of the given file from the server.
| ctx: | an FTP context |
| filename: | the file to retrieve (or NULL if path is in context). |
| Returns: | the socket for the data connection, or <0 in case of error |
void xmlNanoFTPInit (void)
Initialize the FTP protocol layer. Currently it just checks for proxy informations, and get the hostname
int xmlNanoFTPList (void * ctx,
ftpListCallback callback,
void * userData,
const char * filename)
Do a listing on the server. All files info are passed back in the callbacks.
| ctx: | an FTP context |
| callback: | the user callback |
| userData: | the user callback data |
| filename: | optional files to list |
| Returns: | -1 incase of error, 0 otherwise |
void * xmlNanoFTPNewCtxt (const char * URL)
Allocate and initialize a new FTP context.
| URL: | The URL used to initialize the context |
| Returns: | an FTP context or NULL in case of error. |
void * xmlNanoFTPOpen (const char * URL)
Start to fetch the given ftp:// resource
| URL: | the URL to the resource |
| Returns: | an FTP context, or NULL |
void xmlNanoFTPProxy (const char * host,
int port,
const char * user,
const char * passwd,
int type)
Setup the FTP proxy informations. This can also be done by using ftp_proxy ftp_proxy_user and ftp_proxy_password environment variables.
| host: | the proxy host name |
| port: | the proxy port |
| user: | the proxy user name |
| passwd: | the proxy password |
| type: | the type of proxy 1 for using SITE, 2 for USER a@b |
int xmlNanoFTPQuit (void * ctx)
Send a QUIT command to the server
| ctx: | an FTP context |
| Returns: | -1 in case of error, 0 otherwise |
int xmlNanoFTPRead (void * ctx,
void * dest,
int len)
This function tries to read @len bytes from the existing FTP connection and saves them in @dest. This is a blocking call.
| ctx: | the FTP context |
| dest: | a buffer |
| len: | the buffer length |
| Returns: | the number of byte read. 0 is an indication of an end of connection. -1 indicates a parameter error. |
void xmlNanoFTPScanProxy (const char * URL)
(Re)Initialize the FTP Proxy context by parsing the URL and finding the protocol host port it indicates. Should be like ftp://myproxy/ or ftp://myproxy:3128/ A NULL URL cleans up proxy informations.
| URL: | The proxy URL used to initialize the proxy context |
int xmlNanoFTPUpdateURL (void * ctx,
const char * URL)
Update an FTP context by parsing the URL and finding new path it indicates. If there is an error in the protocol, hostname, port or other information, the error is raised. It indicates a new connection has to be established.
| ctx: | an FTP context |
| URL: | The URL used to update the context |
| Returns: | 0 if Ok, -1 in case of error (other host). |
|
|
|
|
|
libxml2 Reference Manual |
|---|
SAX2 - SAX2 parser interface used to build the DOM tree
those are the default SAX2 interfaces used by the library when building DOM tree.
Author(s): Daniel Veillard
void xmlSAX2EndElementNs (void * ctx,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI); void xmlSAX2Reference (void * ctx,
const xmlChar * name); void xmlSAX2ElementDecl (void * ctx,
const xmlChar * name,
int type,
xmlElementContentPtr content); void xmlSAX2AttributeDecl (void * ctx,
const xmlChar * elem,
const xmlChar * fullname,
int type,
int def,
const xmlChar * defaultValue,
xmlEnumerationPtr tree); void xmlSAX2Comment (void * ctx,
const xmlChar * value); int xmlSAX2GetColumnNumber (void * ctx); xmlEntityPtr xmlSAX2GetEntity (void * ctx,
const xmlChar * name); void xmlSAX2UnparsedEntityDecl (void * ctx,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId,
const xmlChar * notationName); void xmlSAX2InitDocbDefaultSAXHandler (xmlSAXHandler * hdlr); int xmlSAXVersion (xmlSAXHandler * hdlr,
int version); void xmlSAX2IgnorableWhitespace (void * ctx,
const xmlChar * ch,
int len); void xmlSAX2NotationDecl (void * ctx,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId); void xmlSAX2StartDocument (void * ctx); void xmlSAX2EndElement (void * ctx,
const xmlChar * name); xmlParserInputPtr xmlSAX2ResolveEntity (void * ctx,
const xmlChar * publicId,
const xmlChar * systemId); void xmlSAX2ExternalSubset (void * ctx,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID); const xmlChar * xmlSAX2GetPublicId (void * ctx); int xmlSAX2IsStandalone (void * ctx); void xmlSAX2EndDocument (void * ctx); void xmlSAX2ProcessingInstruction (void * ctx,
const xmlChar * target,
const xmlChar * data); void xmlSAX2InternalSubset (void * ctx,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID); void xmlSAX2Characters (void * ctx,
const xmlChar * ch,
int len); int xmlSAXDefaultVersion (int version); void xmlSAX2StartElement (void * ctx,
const xmlChar * fullname,
const xmlChar ** atts); void xmlSAX2SetDocumentLocator (void * ctx,
xmlSAXLocatorPtr loc); void xmlSAX2CDataBlock (void * ctx,
const xmlChar * value,
int len); void xmlSAX2StartElementNs (void * ctx,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI,
int nb_namespaces,
const xmlChar ** namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar ** attributes); int xmlSAX2HasExternalSubset (void * ctx); void htmlDefaultSAXHandlerInit (void); int xmlSAX2GetLineNumber (void * ctx); int xmlSAX2HasInternalSubset (void * ctx); void xmlSAX2InitHtmlDefaultSAXHandler (xmlSAXHandler * hdlr); void docbDefaultSAXHandlerInit (void); void xmlDefaultSAXHandlerInit (void); void xmlSAX2InitDefaultSAXHandler (xmlSAXHandler * hdlr,
int warning); xmlEntityPtr xmlSAX2GetParameterEntity (void * ctx,
const xmlChar * name); const xmlChar * xmlSAX2GetSystemId (void * ctx); void xmlSAX2EntityDecl (void * ctx,
const xmlChar * name,
int type,
const xmlChar * publicId,
const xmlChar * systemId,
xmlChar * content);
void docbDefaultSAXHandlerInit (void)
Initialize the default SAX handler
void htmlDefaultSAXHandlerInit (void)
Initialize the default SAX handler
void xmlSAX2AttributeDecl (void * ctx,
const xmlChar * elem,
const xmlChar * fullname,
int type,
int def,
const xmlChar * defaultValue,
xmlEnumerationPtr tree)
An attribute definition has been parsed
void xmlSAX2CDataBlock (void * ctx,
const xmlChar * value,
int len)
called when a pcdata block has been parsed
| ctx: | the user data (XML parser context) |
| value: | The pcdata content |
| len: | the block length |
void xmlSAX2Characters (void * ctx,
const xmlChar * ch,
int len)
receiving some chars from the parser.
void xmlSAX2Comment (void * ctx,
const xmlChar * value)
A xmlSAX2Comment has been parsed.
| ctx: | the user data (XML parser context) |
| value: | the xmlSAX2Comment content |
void xmlSAX2ElementDecl (void * ctx,
const xmlChar * name,
int type,
xmlElementContentPtr content)
An element definition has been parsed
| ctx: | the user data (XML parser context) |
| name: | the element name |
| type: | the element type |
| content: | the element value tree |
void xmlSAX2EndDocument (void * ctx)
called when the document end has been detected.
| ctx: | the user data (XML parser context) |
void xmlSAX2EndElement (void * ctx,
const xmlChar * name)
called when the end of an element has been detected.
| ctx: | the user data (XML parser context) |
| name: | The element name |
void xmlSAX2EndElementNs (void * ctx,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI)
SAX2 callback when an element end has been detected by the parser. It provides the namespace informations for the element.
| ctx: | the user data (XML parser context) |
| localname: | the local name of the element |
| prefix: | the element namespace prefix if available |
| URI: | the element namespace name if available |
void xmlSAX2EntityDecl (void * ctx,
const xmlChar * name,
int type,
const xmlChar * publicId,
const xmlChar * systemId,
xmlChar * content)
An entity definition has been parsed
| ctx: | the user data (XML parser context) |
| name: | the entity name |
| type: | the entity type |
| publicId: | The public ID of the entity |
| systemId: | The system ID of the entity |
| content: | the entity value (without processing). |
void xmlSAX2ExternalSubset (void * ctx,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID)
Callback on external subset declaration.
| ctx: | the user data (XML parser context) |
| name: | the root element name |
| ExternalID: | the external ID |
| SystemID: | the SYSTEM ID (e.g. filename or URL) |
int xmlSAX2GetColumnNumber (void * ctx)
Provide the column number of the current parsing point.
| ctx: | the user data (XML parser context) |
| Returns: | an int |
xmlEntityPtr xmlSAX2GetEntity (void * ctx,
const xmlChar * name)
Get an entity by name
| ctx: | the user data (XML parser context) |
| name: | The entity name |
| Returns: | the xmlEntityPtr if found. |
int xmlSAX2GetLineNumber (void * ctx)
Provide the line number of the current parsing point.
| ctx: | the user data (XML parser context) |
| Returns: | an int |
xmlEntityPtr xmlSAX2GetParameterEntity (void * ctx,
const xmlChar * name)
Get a parameter entity by name
| ctx: | the user data (XML parser context) |
| name: | The entity name |
| Returns: | the xmlEntityPtr if found. |
const xmlChar * xmlSAX2GetPublicId (void * ctx)
Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"
| ctx: | the user data (XML parser context) |
| Returns: | a xmlChar * |
const xmlChar * xmlSAX2GetSystemId (void * ctx)
Provides the system ID, basically URL or filename e.g. http://www.sgmlsource.com/dtds/memo.dtd
| ctx: | the user data (XML parser context) |
| Returns: | a xmlChar * |
int xmlSAX2HasExternalSubset (void * ctx)
Does this document has an external subset
| ctx: | the user data (XML parser context) |
| Returns: | 1 if true |
int xmlSAX2HasInternalSubset (void * ctx)
Does this document has an internal subset
| ctx: | the user data (XML parser context) |
| Returns: | 1 if true |
void xmlSAX2IgnorableWhitespace (void * ctx,
const xmlChar * ch,
int len)
receiving some ignorable whitespaces from the parser. UNUSED: by default the DOM building will use xmlSAX2Characters
void xmlSAX2InitDefaultSAXHandler (xmlSAXHandler * hdlr,
int warning)
Initialize the default XML SAX2 handler
| hdlr: | the SAX handler |
| warning: | flag if non-zero sets the handler warning procedure |
void xmlSAX2InitDocbDefaultSAXHandler (xmlSAXHandler * hdlr)
Initialize the default DocBook SAX2 handler
| hdlr: | the SAX handler |
void xmlSAX2InitHtmlDefaultSAXHandler (xmlSAXHandler * hdlr)
Initialize the default HTML SAX2 handler
| hdlr: | the SAX handler |
void xmlSAX2InternalSubset (void * ctx,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID)
Callback on internal subset declaration.
| ctx: | the user data (XML parser context) |
| name: | the root element name |
| ExternalID: | the external ID |
| SystemID: | the SYSTEM ID (e.g. filename or URL) |
int xmlSAX2IsStandalone (void * ctx)
Is this document tagged standalone ?
| ctx: | the user data (XML parser context) |
| Returns: | 1 if true |
void xmlSAX2NotationDecl (void * ctx,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId)
What to do when a notation declaration has been parsed.
| ctx: | the user data (XML parser context) |
| name: | The name of the notation |
| publicId: | The public ID of the entity |
| systemId: | The system ID of the entity |
void xmlSAX2ProcessingInstruction (void * ctx,
const xmlChar * target,
const xmlChar * data)
A processing instruction has been parsed.
| ctx: | the user data (XML parser context) |
| target: | the target name |
| data: | the PI data's |
void xmlSAX2Reference (void * ctx,
const xmlChar * name)
called when an entity xmlSAX2Reference is detected.
| ctx: | the user data (XML parser context) |
| name: | The entity name |
xmlParserInputPtr xmlSAX2ResolveEntity (void * ctx,
const xmlChar * publicId,
const xmlChar * systemId)
The entity loader, to control the loading of external entities, the application can either: - override this xmlSAX2ResolveEntity() callback in the SAX block - or better use the xmlSetExternalEntityLoader() function to set up it's own entity resolution routine
| ctx: | the user data (XML parser context) |
| publicId: | The public ID of the entity |
| systemId: | The system ID of the entity |
| Returns: | the xmlParserInputPtr if inlined or NULL for DOM behaviour. |
void xmlSAX2SetDocumentLocator (void * ctx,
xmlSAXLocatorPtr loc)
Receive the document locator at startup, actually xmlDefaultSAXLocator Everything is available on the context, so this is useless in our case.
| ctx: | the user data (XML parser context) |
| loc: | A SAX Locator |
void xmlSAX2StartDocument (void * ctx)
called when the document start being processed.
| ctx: | the user data (XML parser context) |
void xmlSAX2StartElement (void * ctx,
const xmlChar * fullname,
const xmlChar ** atts)
called when an opening tag has been processed.
| ctx: | the user data (XML parser context) |
| fullname: | The element name, including namespace prefix |
| atts: | An array of name/value attributes pairs, NULL terminated |
void xmlSAX2StartElementNs (void * ctx,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI,
int nb_namespaces,
const xmlChar ** namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar ** attributes)
SAX2 callback when an element start has been detected by the parser. It provides the namespace informations for the element, as well as the new namespace declarations on the element.
| ctx: | the user data (XML parser context) |
| localname: | the local name of the element |
| prefix: | the element namespace prefix if available |
| URI: | the element namespace name if available |
| nb_namespaces: | number of namespace definitions on that node |
| namespaces: | pointer to the array of prefix/URI pairs namespace definitions |
| nb_attributes: | the number of attributes on that node |
| nb_defaulted: | the number of defaulted attributes. |
| attributes: | pointer to the array of (localname/prefix/URI/value/end) attribute values. |
void xmlSAX2UnparsedEntityDecl (void * ctx,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId,
const xmlChar * notationName)
What to do when an unparsed entity declaration is parsed
| ctx: | the user data (XML parser context) |
| name: | The name of the entity |
| publicId: | The public ID of the entity |
| systemId: | The system ID of the entity |
| notationName: | the name of the notation |
int xmlSAXDefaultVersion (int version)
Set the default version of SAX used globally by the library. By default, during initialization the default is set to 2. Note that it is generally a better coding style to use xmlSAXVersion() to set up the version explicitly for a given parsing context.
| version: | the version, 1 or 2 |
| Returns: | the previous value in case of success and -1 in case of error. |
int xmlSAXVersion (xmlSAXHandler * hdlr,
int version)
Initialize the default XML SAX handler according to the version
| hdlr: | the SAX handler |
| version: | the version, 1 or 2 |
| Returns: | 0 in case of success and -1 in case of error. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
parserInternals - internals routines and limits exported by the parser.
this module exports a number of internal parsing routines they are not really all intended for applications but can prove useful doing low level processing.
Author(s): Daniel Veillard
#define XML_SUBSTITUTE_REF; #define IS_BLANK(c); #define IS_BYTE_CHAR(c); #define IS_PUBIDCHAR(c); #define IS_DIGIT_CH(c); #define IS_EXTENDER(c); #define IS_ASCII_DIGIT(c); #define IS_COMBINING_CH(c); #define IS_CHAR(c); #define IS_LETTER(c); #define IS_IDEOGRAPHIC(c); #define MOVETO_STARTTAG(p); #define XML_MAX_NAME_LENGTH; #define IS_ASCII_LETTER(c); #define IS_DIGIT(c); #define XML_MAX_DICTIONARY_LIMIT; #define XML_SUBSTITUTE_PEREF; #define MOVETO_ENDTAG(p); #define SKIP_EOL(p); #define IS_EXTENDER_CH(c); #define IS_BLANK_CH(c); #define IS_LETTER_CH(c); #define XML_MAX_LOOKUP_LIMIT; #define XML_MAX_TEXT_LENGTH; #define XML_SUBSTITUTE_NONE; #define IS_COMBINING(c); #define XML_MAX_NAMELEN; #define IS_BASECHAR(c); #define INPUT_CHUNK; #define IS_PUBIDCHAR_CH(c); #define IS_CHAR_CH(c); #define XML_SUBSTITUTE_BOTH; xmlNodePtr nodePop (xmlParserCtxtPtr ctxt); void xmlParseNotationDecl (xmlParserCtxtPtr ctxt); void xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
const xmlChar * ExternalID,
const xmlChar * SystemID); void xmlParseMisc (xmlParserCtxtPtr ctxt); int xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler); xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
const xmlChar * buffer); xmlChar * xmlParseExternalID (xmlParserCtxtPtr ctxt,
xmlChar ** publicID,
int strict); xmlChar * xmlScanName (xmlParserCtxtPtr ctxt); int xmlParseElementDecl (xmlParserCtxtPtr ctxt); void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); htmlParserCtxtPtr htmlCreateFileParserCtxt (const char * filename,
const char * encoding); int inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value); xmlChar * xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar * str,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3); const xmlChar * namePop (xmlParserCtxtPtr ctxt); void xmlParseContent (xmlParserCtxtPtr ctxt); xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt); xmlChar * xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
xmlChar ** prefix); xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char * filename); void xmlParserHandlePEReference (xmlParserCtxtPtr ctxt); xmlChar * xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar * str,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3); xmlParserCtxtPtr xmlCreateFileParserCtxt (const char * filename); int xmlParseCharRef (xmlParserCtxtPtr ctxt); void xmlParseElement (xmlParserCtxtPtr ctxt); void xmlParseTextDecl (xmlParserCtxtPtr ctxt); xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity); int xmlCopyCharMultiByte (xmlChar * out,
int val); xmlElementContentPtr xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt,
int inputchk); void xmlParseCharData (xmlParserCtxtPtr ctxt,
int cdata); xmlChar * xmlParseVersionInfo (xmlParserCtxtPtr ctxt); int xmlParseSDDecl (xmlParserCtxtPtr ctxt); int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr * tree); void xmlHandleEntity (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity); int xmlCurrentChar (xmlParserCtxtPtr ctxt,
int * len); int xmlSkipBlankChars (xmlParserCtxtPtr ctxt); xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt); void xmlParserInputShrink (xmlParserInputPtr in); void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); void xmlFreeInputStream (xmlParserInputPtr input); void xmlParsePEReference (xmlParserCtxtPtr ctxt); xmlParserCtxtPtr xmlCreateURLParserCtxt (const char * filename,
int options); int xmlIsLetter (int c); int xmlCheckLanguageID (const xmlChar * lang); void xmlNextChar (xmlParserCtxtPtr ctxt); xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt); int xmlParseAttributeType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr * tree); int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
xmlChar ** value); xmlChar * xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); xmlChar * xmlParseAttValue (xmlParserCtxtPtr ctxt); xmlParserCtxtPtr xmlCreateMemoryParserCtxt (const char * buffer,
int size); void xmlParseAttributeListDecl (xmlParserCtxtPtr ctxt); const xmlChar * xmlParseName (xmlParserCtxtPtr ctxt); xmlChar * xmlParseEncName (xmlParserCtxtPtr ctxt); int nodePush (xmlParserCtxtPtr ctxt,
xmlNodePtr value); int xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncoding enc); int xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler); xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt); const xmlChar * xmlParseAttribute (xmlParserCtxtPtr ctxt,
xmlChar ** value); void xmlParseEndTag (xmlParserCtxtPtr ctxt); const xmlChar * xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); void htmlInitAutoClose (void); xmlParserCtxtPtr xmlCreateEntityParserCtxt (const xmlChar * URL,
const xmlChar * ID,
const xmlChar * base); xmlChar * xmlSplitQName (xmlParserCtxtPtr ctxt,
const xmlChar * name,
xmlChar ** prefix); void xmlParserHandleReference (xmlParserCtxtPtr ctxt); const xmlChar * xmlParsePITarget (xmlParserCtxtPtr ctxt); int xmlParseElementContentDecl (xmlParserCtxtPtr ctxt,
const xmlChar * name,
xmlElementContentPtr * result); xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt); xmlChar xmlPopInput (xmlParserCtxtPtr ctxt); xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); int xmlPushInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input); xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt,
xmlChar ** orig); xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3); xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt); void xmlParseXMLDecl (xmlParserCtxtPtr ctxt); typedef void xmlEntityReferenceFunc (xmlEntityPtr ent,
xmlNodePtr firstNode,
xmlNodePtr lastNode); xmlElementContentPtr xmlParseElementMixedContentDecl (xmlParserCtxtPtr ctxt,
int inputchk); xmlChar * xmlParseQuotedString (xmlParserCtxtPtr ctxt); xmlChar * xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); void xmlParseCDSect (xmlParserCtxtPtr ctxt); int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
const xmlChar * cur,
int * len); void xmlParseComment (xmlParserCtxtPtr ctxt); void xmlErrMemory (xmlParserCtxtPtr ctxt,
const char * extra); xmlChar * xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); xmlChar * xmlParseNmtoken (xmlParserCtxtPtr ctxt); void xmlParseReference (xmlParserCtxtPtr ctxt); int namePush (xmlParserCtxtPtr ctxt,
const xmlChar * value); void xmlParseNamespace (xmlParserCtxtPtr ctxt); int xmlCopyChar (int len,
xmlChar * out,
int val); void xmlParsePI (xmlParserCtxtPtr ctxt); void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); const xmlChar * xmlParseStartTag (xmlParserCtxtPtr ctxt); void xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
#define INPUT_CHUNK;
The parser tries to always have that amount of input ready. One of the point is providing context when reporting errors.
#define IS_BASECHAR(c);
Macro to check the following production in the XML spec: [85] BaseChar ::= ... long list see REC ...
| c: | an UNICODE value (int) |
#define IS_BLANK(c);
Macro to check the following production in the XML spec: [3] S ::= (#x20 | #x9 | #xD | #xA)+
| c: | an UNICODE value (int) |
#define IS_BLANK_CH(c);
Behaviour same as IS_BLANK
| c: | an xmlChar value (normally unsigned char) |
#define IS_BYTE_CHAR(c);
Macro to check the following production in the XML spec: [2] Char ::= #x9 | #xA | #xD | [#x20...] any byte character in the accepted range
| c: | an byte value (int) |
#define IS_CHAR(c);
Macro to check the following production in the XML spec: [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
| c: | an UNICODE value (int) |
#define IS_CHAR_CH(c);
Behaves like IS_CHAR on single-byte value
| c: | an xmlChar (usually an unsigned char) |
#define IS_COMBINING(c);
Macro to check the following production in the XML spec: [87] CombiningChar ::= ... long list see REC ...
| c: | an UNICODE value (int) |
#define IS_COMBINING_CH(c);
Always false (all combining chars > 0xff)
| c: | an xmlChar (usually an unsigned char) |
#define IS_DIGIT(c);
Macro to check the following production in the XML spec: [88] Digit ::= ... long list see REC ...
| c: | an UNICODE value (int) |
#define IS_DIGIT_CH(c);
Behaves like IS_DIGIT but with a single byte argument
| c: | an xmlChar value (usually an unsigned char) |
#define IS_EXTENDER(c);
Macro to check the following production in the XML spec: [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]
| c: | an UNICODE value (int) |
#define IS_EXTENDER_CH(c);
Behaves like IS_EXTENDER but with a single-byte argument
| c: | an xmlChar value (usually an unsigned char) |
#define IS_IDEOGRAPHIC(c);
Macro to check the following production in the XML spec: [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
| c: | an UNICODE value (int) |
#define IS_LETTER(c);
Macro to check the following production in the XML spec: [84] Letter ::= BaseChar | Ideographic
| c: | an UNICODE value (int) |
#define IS_LETTER_CH(c);
Macro behaves like IS_LETTER, but only check base chars
| c: | an xmlChar value (normally unsigned char) |
#define IS_PUBIDCHAR(c);
Macro to check the following production in the XML spec: [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
| c: | an UNICODE value (int) |
#define IS_PUBIDCHAR_CH(c);
Same as IS_PUBIDCHAR but for single-byte value
| c: | an xmlChar value (normally unsigned char) |
#define MOVETO_STARTTAG(p);
Skips to the next '<' char.
| p: | and UTF8 string pointer |
#define XML_MAX_DICTIONARY_LIMIT;
Maximum size allowed by the parser for a dictionary by default This is not a limitation of the parser but a safety boundary feature, use XML_PARSE_HUGE option to override it. Introduced in 2.9.0
#define XML_MAX_LOOKUP_LIMIT;
Maximum size allowed by the parser for ahead lookup This is an upper boundary enforced by the parser to avoid bad behaviour on "unfriendly' content Introduced in 2.9.0
#define XML_MAX_NAMELEN;
Identifiers can be longer, but this will be more costly at runtime.
#define XML_MAX_NAME_LENGTH;
Maximum size allowed for a markup identitier This is not a limitation of the parser but a safety boundary feature, use XML_PARSE_HUGE option to override it. Note that with the use of parsing dictionaries overriding the limit may result in more runtime memory usage in face of "unfriendly' content Introduced in 2.9.0
#define XML_MAX_TEXT_LENGTH;
Maximum size allowed for a single text node when building a tree. This is not a limitation of the parser but a safety boundary feature, use XML_PARSE_HUGE option to override it. Introduced in 2.9.0
#define XML_SUBSTITUTE_BOTH;
Both general and parameter entities need to be substituted.
#define XML_SUBSTITUTE_PEREF;
Whether parameter entities need to be substituted.
#define XML_SUBSTITUTE_REF;
Whether general entities need to be substituted.
void xmlEntityReferenceFunc (xmlEntityPtr ent,
xmlNodePtr firstNode,
xmlNodePtr lastNode)
Callback function used when one needs to be able to track back the provenance of a chunk of nodes inherited from an entity replacement.
| ent: | the entity |
| firstNode: | the fist node in the chunk |
| lastNode: | the last nod in the chunk |
unsigned int xmlParserMaxDepth;
const xmlCharxmlStringComment[] xmlStringComment;
const xmlCharxmlStringText[] xmlStringText;
const xmlCharxmlStringTextNoenc[] xmlStringTextNoenc;
htmlParserCtxtPtr htmlCreateFileParserCtxt (const char * filename,
const char * encoding)
Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.
| filename: | the filename |
| encoding: | a free form C string describing the HTML document encoding, or NULL |
| Returns: | the new parser context or NULL |
void htmlInitAutoClose (void)
Initialize the htmlStartCloseIndex for fast lookup of closing tags names. This is not reentrant. Call xmlInitParser() once before processing in case of use in multithreaded programs.
xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt)
Pops the top parser input from the input stack
| ctxt: | an XML parser context |
| Returns: | the input just removed |
int inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value)
Pushes a new parser input on top of the input stack
| ctxt: | an XML parser context |
| value: | the parser input |
| Returns: | -1 in case of error, the index in the stack otherwise |
const xmlChar * namePop (xmlParserCtxtPtr ctxt)
Pops the top element name from the name stack
| ctxt: | an XML parser context |
| Returns: | the name just removed |
int namePush (xmlParserCtxtPtr ctxt,
const xmlChar * value)
Pushes a new element name on top of the name stack
| ctxt: | an XML parser context |
| value: | the element name |
| Returns: | -1 in case of error, the index in the stack otherwise |
xmlNodePtr nodePop (xmlParserCtxtPtr ctxt)
Pops the top element node from the node stack
| ctxt: | an XML parser context |
| Returns: | the node just removed |
int nodePush (xmlParserCtxtPtr ctxt,
xmlNodePtr value)
Pushes a new element node on top of the node stack
| ctxt: | an XML parser context |
| value: | the element node |
| Returns: | -1 in case of error, the index in the stack otherwise |
int xmlCheckLanguageID (const xmlChar * lang)
Checks that the value conforms to the LanguageID production: NOTE: this is somewhat deprecated, those productions were removed from the XML Second edition. [33] LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::= ISO639Code | IanaCode | UserCode [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+ The current REC reference the sucessors of RFC 1766, currently 5646 http://www.rfc-editor.org/rfc/rfc5646.txt langtag = language ["-" script] ["-" region] *("-" variant) *("-" extension) ["-" privateuse] language = 2*3ALPHA ; shortest ISO 639 code ["-" extlang] ; sometimes followed by ; extended language subtags / 4ALPHA ; or reserved for future use / 5*8ALPHA ; or registered language subtag extlang = 3ALPHA ; selected ISO 639 codes *2("-" 3ALPHA) ; permanently reserved script = 4ALPHA ; ISO 15924 code region = 2ALPHA ; ISO 3166-1 code / 3DIGIT ; UN M.49 code variant = 5*8alphanum ; registered variants / (DIGIT 3alphanum) extension = singleton 1*("-" (2*8alphanum)) ; Single alphanumerics ; "x" reserved for private use singleton = DIGIT ; 0 - 9 / %x41-57 ; A - W / %x59-5A ; Y - Z / %x61-77 ; a - w / %x79-7A ; y - z it sounds right to still allow Irregular i-xxx IANA and user codes too The parser below doesn't try to cope with extension or privateuse that could be added but that's not interoperable anyway
| lang: | pointer to the string value |
| Returns: | 1 if correct 0 otherwise |
int xmlCopyCharMultiByte (xmlChar * out,
int val)
append the char value in the array
xmlParserCtxtPtr xmlCreateEntityParserCtxt (const xmlChar * URL,
const xmlChar * ID,
const xmlChar * base)
Create a parser context for an external entity Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.
| URL: | the entity URL |
| ID: | the entity PUBLIC ID |
| base: | a possible base for the target URI |
| Returns: | the new parser context or NULL |
xmlParserCtxtPtr xmlCreateFileParserCtxt (const char * filename)
Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.
| filename: | the filename |
| Returns: | the new parser context or NULL |
xmlParserCtxtPtr xmlCreateMemoryParserCtxt (const char * buffer,
int size)
Create a parser context for an XML in-memory document.
| buffer: | a pointer to a char array |
| size: | the size of the array |
| Returns: | the new parser context or NULL |
xmlParserCtxtPtr xmlCreateURLParserCtxt (const char * filename,
int options)
Create a parser context for a file or URL content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time and for file accesses
| filename: | the filename or URL |
| options: | a combination of xmlParserOption |
| Returns: | the new parser context or NULL |
int xmlCurrentChar (xmlParserCtxtPtr ctxt,
int * len)
The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer. Implement the end of line normalization: 2.11 End-of-Line Handling Wherever an external parsed entity or the literal entity value of an internal parsed entity contains either the literal two-character sequence "#xD#xA" or a standalone literal #xD, an XML processor must pass to the application the single character #xA. This behavior can conveniently be produced by normalizing all line breaks to #xA on input, before parsing.)
| ctxt: | the XML parser context |
| len: | pointer to the length of the char read |
| Returns: | the current char value and its length |
xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3)
This function is deprecated, we now always process entities content through xmlStringDecodeEntities TODO: remove it in next major release. [67] Reference ::= EntityRef | CharRef [69] PEReference ::= '%' Name ';'
| ctxt: | the parser context |
| len: | the len to decode (in bytes !), -1 for no size limit |
| what: | combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF |
| end: | an end marker xmlChar, 0 if none |
| end2: | an end marker xmlChar, 0 if none |
| end3: | an end marker xmlChar, 0 if none |
| Returns: | A newly allocated string with the substitution done. The caller must deallocate it ! |
void xmlErrMemory (xmlParserCtxtPtr ctxt,
const char * extra)
Handle a redefinition of attribute error
| ctxt: | an XML parser context |
| extra: | extra informations |
void xmlFreeInputStream (xmlParserInputPtr input)
Free up an input stream.
| input: | an xmlParserInputPtr |
void xmlHandleEntity (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity)
Default handling of defined entities, when should we define a new input stream ? When do we just handle that as a set of chars ? OBSOLETE: to be removed at some point.
| ctxt: | an XML parser context |
| entity: | an XML entity pointer. |
int xmlIsLetter (int c)
Check whether the character is allowed by the production [84] Letter ::= BaseChar | Ideographic
| c: | an unicode character (int) |
| Returns: | 0 if not, non-zero otherwise |
xmlChar * xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt)
parse an XML namespace name. TODO: this seems not in use anymore, the namespace handling is done on top of the SAX interfaces, i.e. not on raw input. [NS 3] NCName ::= (Letter | '_') (NCNameChar)* [NS 4] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
| ctxt: | an XML parser context |
| Returns: | the namespace name or NULL |
xmlChar * xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt)
parse a namespace prefix declaration TODO: this seems not in use anymore, the namespace handling is done on top of the SAX interfaces, i.e. not on raw input. [NS 1] NSDef ::= PrefixDef Eq SystemLiteral [NS 2] PrefixDef ::= 'xmlns' (':' NCName)?
| ctxt: | an XML parser context |
| Returns: | the namespace name |
xmlChar * xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
xmlChar ** prefix)
TODO: this seems not in use anymore, the namespace handling is done on top of the SAX interfaces, i.e. not on raw input. parse an XML qualified name [NS 5] QName ::= (Prefix ':')? LocalPart [NS 6] Prefix ::= NCName [NS 7] LocalPart ::= NCName
| ctxt: | an XML parser context |
| prefix: | a xmlChar ** |
| Returns: | the local part, and prefix is updated to get the Prefix if any. |
xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity)
Create a new input stream based on an xmlEntityPtr
| ctxt: | an XML parser context |
| entity: | an Entity pointer |
| Returns: | the new input stream or NULL |
xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char * filename)
Create a new input stream based on a file or an URL.
| ctxt: | an XML parser context |
| filename: | the filename to use as entity |
| Returns: | the new input stream or NULL in case of error |
xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt)
Create a new input stream structure.
| ctxt: | an XML parser context |
| Returns: | the new input stream or NULL |
xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
const xmlChar * buffer)
Create a new input stream based on a memory buffer.
| ctxt: | an XML parser context |
| buffer: | an memory buffer |
| Returns: | the new input stream |
void xmlNextChar (xmlParserCtxtPtr ctxt)
Skip to the next char input char.
| ctxt: | the XML parser context |
xmlChar * xmlParseAttValue (xmlParserCtxtPtr ctxt)
parse a value for an attribute Note: the parser won't do substitution of entities here, this will be handled later in xmlStringGetNodeList [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" 3.3.3 Attribute-Value Normalization: Before the value of an attribute is passed to the application or checked for validity, the XML processor must normalize it as follows: - a character reference is processed by appending the referenced character to the attribute value - an entity reference is processed by recursively processing the replacement text of the entity - a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, except that only a single #x20 is appended for a "#xD#xA" sequence that is part of an external parsed entity or the literal entity value of an internal parsed entity - other characters are processed by appending them to the normalized value If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by a single space (#x20) character. All attributes for which no declaration has been read should be treated by a non-validating parser as if declared CDATA.
| ctxt: | an XML parser context |
| Returns: | the AttValue parsed or NULL. The value has to be freed by the caller. |
const xmlChar * xmlParseAttribute (xmlParserCtxtPtr ctxt,
xmlChar ** value)
parse an attribute [41] Attribute ::= Name Eq AttValue [ WFC: No External Entity References ] Attribute values cannot contain direct or indirect entity references to external entities. [ WFC: No < in Attribute Values ] The replacement text of any entity referred to directly or indirectly in an attribute value (other than "<") must not contain a <. [ VC: Attribute Value Type ] The attribute must have been declared; the value must be of the type declared for it. [25] Eq ::= S? '=' S? With namespace: [NS 11] Attribute ::= QName Eq AttValue Also the case QName == xmlns:??? is handled independently as a namespace definition.
void xmlParseAttributeListDecl (xmlParserCtxtPtr ctxt)
: parse the Attribute list def for an element [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' [53] AttDef ::= S Name S AttType S DefaultDecl
| ctxt: | an XML parser context |
int xmlParseAttributeType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr * tree)
parse the Attribute list def for an element [54] AttType ::= StringType | TokenizedType | EnumeratedType [55] StringType ::= 'CDATA' [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' Validity constraints for attribute values syntax are checked in xmlValidateAttributeValue() [ VC: ID ] Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them. [ VC: One ID per Element Type ] No element type may have more than one ID attribute specified. [ VC: ID Attribute Default ] An ID attribute must have a declared default of #IMPLIED or #REQUIRED. [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each IDREF Name must match the value of an ID attribute on some element in the XML document; i.e. IDREF values must match the value of some ID attribute. [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Entity Name must match the name of an unparsed entity declared in the DTD. [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.
| ctxt: | an XML parser context |
| tree: | the enumeration tree built while parsing |
| Returns: | the attribute type |
void xmlParseCDSect (xmlParserCtxtPtr ctxt)
Parse escaped pure raw content. [18] CDSect ::= CDStart CData CDEnd [19] CDStart ::= '<![CDATA[' [20] Data ::= (Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>'
| ctxt: | an XML parser context |
void xmlParseCharData (xmlParserCtxtPtr ctxt,
int cdata)
parse a CharData section. if we are within a CDATA section ']]>' marks an end of section. The right angle bracket (>) may be represented using the string ">", and must, for compatibility, be escaped using ">" or a character reference when it appears in the string "]]>" in content, when that string is not marking the end of a CDATA section. [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
| ctxt: | an XML parser context |
| cdata: | int indicating whether we are within a CDATA section |
int xmlParseCharRef (xmlParserCtxtPtr ctxt)
parse Reference declarations [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' [ WFC: Legal Character ] Characters referred to using character references must match the production for Char.
| ctxt: | an XML parser context |
| Returns: | the value parsed (as an int), 0 in case of error |
void xmlParseComment (xmlParserCtxtPtr ctxt)
Skip an XML (SGML) comment <!-- .... --> The spec says that "For compatibility, the string "--" (double-hyphen) must not occur within comments. " [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
| ctxt: | an XML parser context |
void xmlParseContent (xmlParserCtxtPtr ctxt)
Parse a content: [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
| ctxt: | an XML parser context |
int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
xmlChar ** value)
Parse an attribute default declaration [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) [ VC: Required Attribute ] if the default declaration is the keyword #REQUIRED, then the attribute must be specified for all elements of the type in the attribute-list declaration. [ VC: Attribute Default Legal ] The declared default value must meet the lexical constraints of the declared attribute type c.f. xmlValidateAttributeDecl() [ VC: Fixed Attribute Default ] if an attribute has a default value declared with the #FIXED keyword, instances of that attribute must match the default value. [ WFC: No < in Attribute Values ] handled in xmlParseAttValue()
| ctxt: | an XML parser context |
| value: | Receive a possible fixed default value for the attribute |
| Returns: | XML_ATTRIBUTE_NONE, XML_ATTRIBUTE_REQUIRED, XML_ATTRIBUTE_IMPLIED or XML_ATTRIBUTE_FIXED. |
void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt)
parse a DOCTYPE declaration [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | PEReference | S)* ']' S?)? '>' [ VC: Root Element Type ] The Name in the document type declaration must match the element type of the root element.
| ctxt: | an XML parser context |
void xmlParseElement (xmlParserCtxtPtr ctxt)
parse an XML element, this is highly recursive [39] element ::= EmptyElemTag | STag content ETag [ WFC: Element Type Match ] The Name in an element's end-tag must match the element type in the start-tag.
| ctxt: | an XML parser context |
xmlElementContentPtr xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt,
int inputchk)
parse the declaration for a Mixed Element content The leading '(' and spaces have been skipped in xmlParseElementContentDecl [47] children ::= (choice | seq) ('?' | '*' | '+')? [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? [49] choice ::= '(' S? cp ( S? '|' S? cp )* S? ')' [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' [ VC: Proper Group/PE Nesting ] applies to [49] and [50] TODO Parameter-entity replacement text must be properly nested with parenthesized groups. That is to say, if either of the opening or closing parentheses in a choice, seq, or Mixed construct is contained in the replacement text for a parameter entity, both must be contained in the same replacement text. For interoperability, if a parameter-entity reference appears in a choice, seq, or Mixed construct, its replacement text should not be empty, and neither the first nor last non-blank character of the replacement text should be a connector (| or ,).
| ctxt: | an XML parser context |
| inputchk: | the input used for the current entity, needed for boundary checks |
| Returns: | the tree of xmlElementContentPtr describing the element hierarchy. |
int xmlParseElementContentDecl (xmlParserCtxtPtr ctxt,
const xmlChar * name,
xmlElementContentPtr * result)
parse the declaration for an Element content either Mixed or Children, the cases EMPTY and ANY are handled directly in xmlParseElementDecl [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children
| ctxt: | an XML parser context |
| name: | the name of the element being defined. |
| result: | the Element Content pointer will be stored here if any |
| Returns: | the type of element content XML_ELEMENT_TYPE_xxx |
int xmlParseElementDecl (xmlParserCtxtPtr ctxt)
parse an Element declaration. [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>' [ VC: Unique Element Type Declaration ] No element type may be declared more than once
| ctxt: | an XML parser context |
| Returns: | the type of the element, or -1 in case of error |
xmlElementContentPtr xmlParseElementMixedContentDecl (xmlParserCtxtPtr ctxt,
int inputchk)
parse the declaration for a Mixed Element content The leading '(' and spaces have been skipped in xmlParseElementContentDecl [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')' [ VC: Proper Group/PE Nesting ] applies to [51] too (see [49]) [ VC: No Duplicate Types ] The same name must not appear more than once in a single mixed-content declaration.
| ctxt: | an XML parser context |
| inputchk: | the input used for the current entity, needed for boundary checks |
| Returns: | the list of the xmlElementContentPtr describing the element choices |
xmlChar * xmlParseEncName (xmlParserCtxtPtr ctxt)
parse the XML encoding name [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
| ctxt: | an XML parser context |
| Returns: | the encoding name value or NULL |
const xmlChar * xmlParseEncodingDecl (xmlParserCtxtPtr ctxt)
parse the XML encoding declaration [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'") this setups the conversion filters.
| ctxt: | an XML parser context |
| Returns: | the encoding value or NULL |
void xmlParseEndTag (xmlParserCtxtPtr ctxt)
parse an end of tag [42] ETag ::= '</' Name S? '>' With namespace [NS 9] ETag ::= '</' QName S? '>'
| ctxt: | an XML parser context |
void xmlParseEntityDecl (xmlParserCtxtPtr ctxt)
parse <!ENTITY declarations [70] EntityDecl ::= GEDecl | PEDecl [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>' [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>' [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) [74] PEDef ::= EntityValue | ExternalID [76] NDataDecl ::= S 'NDATA' S Name [ VC: Notation Declared ] The Name must match the declared name of a notation.
| ctxt: | an XML parser context |
xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt)
parse ENTITY references declarations [68] EntityRef ::= '&' Name ';' [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", the Name given in the entity reference must match that in an entity declaration, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. The declaration of a parameter entity must precede any reference to it. Similarly, the declaration of a general entity must precede any reference to it which appears in a default value in an attribute-list declaration. Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone='yes'. [ WFC: Parsed Entity ] An entity reference must not contain the name of an unparsed entity
| ctxt: | an XML parser context |
| Returns: | the xmlEntityPtr if found, or NULL otherwise. |
xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt,
xmlChar ** orig)
parse a value for ENTITY declarations [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'"
| ctxt: | an XML parser context |
| orig: | if non-NULL store a copy of the original entity value |
| Returns: | the EntityValue parsed with reference substituted or NULL |
int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr * tree)
parse an Enumerated attribute type. [57] EnumeratedType ::= NotationType | Enumeration [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
| ctxt: | an XML parser context |
| tree: | the enumeration tree built while parsing |
| Returns: | XML_ATTRIBUTE_ENUMERATION or XML_ATTRIBUTE_NOTATION |
xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt)
parse an Enumeration attribute type. [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' [ VC: Enumeration ] Values of this type must match one of the Nmtoken tokens in the declaration
| ctxt: | an XML parser context |
| Returns: | the enumeration attribute tree built while parsing |
xmlChar * xmlParseExternalID (xmlParserCtxtPtr ctxt,
xmlChar ** publicID,
int strict)
Parse an External ID or a Public ID NOTE: Productions [75] and [83] interact badly since [75] can generate 'PUBLIC' S PubidLiteral S SystemLiteral [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral [83] PublicID ::= 'PUBLIC' S PubidLiteral
| ctxt: | an XML parser context |
| publicID: | a xmlChar** receiving PubidLiteral |
| strict: | indicate whether we should restrict parsing to only production [75], see NOTE below |
| Returns: | the function returns SystemLiteral and in the second case publicID receives PubidLiteral, is strict is off it is possible to return NULL and have publicID set. |
void xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
const xmlChar * ExternalID,
const xmlChar * SystemID)
parse Markup declarations from an external subset [30] extSubset ::= textDecl? extSubsetDecl [31] extSubsetDecl ::= (markupdecl | conditionalSect | PEReference | S) *
| ctxt: | an XML parser context |
| ExternalID: | the external identifier |
| SystemID: | the system identifier (or URL) |
void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt)
parse Markup declarations [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment [ VC: Proper Declaration/PE Nesting ] Parameter-entity replacement text must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration (markupdecl above) is contained in the replacement text for a parameter-entity reference, both must be contained in the same replacement text. [ WFC: PEs in Internal Subset ] In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.)
| ctxt: | an XML parser context |
void xmlParseMisc (xmlParserCtxtPtr ctxt)
parse an XML Misc* optional field. [27] Misc ::= Comment | PI | S
| ctxt: | an XML parser context |
const xmlChar * xmlParseName (xmlParserCtxtPtr ctxt)
parse an XML name. [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::= (Letter | '_' | ':') (NameChar)* [6] Names ::= Name (#x20 Name)*
| ctxt: | an XML parser context |
| Returns: | the Name parsed or NULL |
void xmlParseNamespace (xmlParserCtxtPtr ctxt)
xmlParseNamespace: parse specific PI '<?namespace ...' constructs. This is what the older xml-name Working Draft specified, a bunch of other stuff may still rely on it, so support is still here as if it was declared on the root of the Tree:-( TODO: remove from library To be removed at next drop of binary compatibility
| ctxt: | an XML parser context |
xmlChar * xmlParseNmtoken (xmlParserCtxtPtr ctxt)
parse an XML Nmtoken. [7] Nmtoken ::= (NameChar)+ [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*
| ctxt: | an XML parser context |
| Returns: | the Nmtoken parsed or NULL |
void xmlParseNotationDecl (xmlParserCtxtPtr ctxt)
parse a notation declaration [82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>' Hence there is actually 3 choices: 'PUBLIC' S PubidLiteral 'PUBLIC' S PubidLiteral S SystemLiteral and 'SYSTEM' S SystemLiteral See the NOTE on xmlParseExternalID().
| ctxt: | an XML parser context |
xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt)
parse an Notation attribute type. Note: the leading 'NOTATION' S part has already being parsed... [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' [ VC: Notation Attributes ] Values of this type must match one of the notation names included in the declaration; all notation names in the declaration must be declared.
| ctxt: | an XML parser context |
| Returns: | the notation attribute tree built while parsing |
void xmlParsePEReference (xmlParserCtxtPtr ctxt)
parse PEReference declarations The entity content is handled directly by pushing it's content as a new input stream. [69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A parsed entity must not contain a recursive reference to itself, either directly or indirectly. [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", ... ... The declaration of a parameter entity must precede any reference to it... [ VC: Entity Declared ] In a document with an external subset or external parameter entities with "standalone='no'", ... ... The declaration of a parameter entity must precede any reference to it... [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.
| ctxt: | an XML parser context |
void xmlParsePI (xmlParserCtxtPtr ctxt)
parse an XML Processing Instruction. [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' The processing is transfered to SAX once parsed.
| ctxt: | an XML parser context |
const xmlChar * xmlParsePITarget (xmlParserCtxtPtr ctxt)
parse the name of a PI [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
| ctxt: | an XML parser context |
| Returns: | the PITarget name or NULL |
xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt)
parse an XML public literal [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
| ctxt: | an XML parser context |
| Returns: | the PubidLiteral parsed or NULL. |
xmlChar * xmlParseQuotedString (xmlParserCtxtPtr ctxt)
Parse and return a string between quotes or doublequotes TODO: Deprecated, to be removed at next drop of binary compatibility
| ctxt: | an XML parser context |
| Returns: | the string parser or NULL. |
void xmlParseReference (xmlParserCtxtPtr ctxt)
parse and handle entity references in content, depending on the SAX interface, this may end-up in a call to character() if this is a CharRef, a predefined entity, if there is no reference() callback. or if the parser was asked to switch to that mode. [67] Reference ::= EntityRef | CharRef
| ctxt: | an XML parser context |
int xmlParseSDDecl (xmlParserCtxtPtr ctxt)
parse the XML standalone declaration [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no')'"')) [ VC: Standalone Document Declaration ] TODO The standalone document declaration must have the value "no" if any external markup declarations contain declarations of: - attributes with default values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or - entities (other than amp, lt, gt, apos, quot), if references to those entities appear in the document, or - attributes with values subject to normalization, where the attribute appears in the document with a value which will change as a result of normalization, or - element types with element content, if white space occurs directly within any instance of those types.
| ctxt: | an XML parser context |
| Returns: | 1 if standalone="yes" 0 if standalone="no" -2 if standalone attribute is missing or invalid (A standalone value of -2 means that the XML declaration was found, but no value was specified for the standalone attribute). |
const xmlChar * xmlParseStartTag (xmlParserCtxtPtr ctxt)
parse a start of tag either for rule element or EmptyElement. In both case we don't parse the tag closing chars. [40] STag ::= '<' Name (S Attribute)* S? '>' [ WFC: Unique Att Spec ] No attribute name may appear more than once in the same start-tag or empty-element tag. [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [ WFC: Unique Att Spec ] No attribute name may appear more than once in the same start-tag or empty-element tag. With namespace: [NS 8] STag ::= '<' QName (S Attribute)* S? '>' [NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>'
| ctxt: | an XML parser context |
| Returns: | the element name parsed |
xmlChar * xmlParseSystemLiteral (xmlParserCtxtPtr ctxt)
parse an XML Literal [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
| ctxt: | an XML parser context |
| Returns: | the SystemLiteral parsed or NULL |
void xmlParseTextDecl (xmlParserCtxtPtr ctxt)
parse an XML declaration header for external entities [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
| ctxt: | an XML parser context |
xmlChar * xmlParseVersionInfo (xmlParserCtxtPtr ctxt)
parse the XML version. [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ") [25] Eq ::= S? '=' S?
| ctxt: | an XML parser context |
| Returns: | the version string, e.g. "1.0" |
xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt)
parse the XML version value. [26] VersionNum ::= '1.' [0-9]+ In practice allow [0-9].[0-9]+ at that level
| ctxt: | an XML parser context |
| Returns: | the string giving the XML version number, or NULL |
void xmlParseXMLDecl (xmlParserCtxtPtr ctxt)
parse an XML declaration header [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
| ctxt: | an XML parser context |
void xmlParserHandlePEReference (xmlParserCtxtPtr ctxt)
[69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A parsed entity must not contain a recursive reference to itself, either directly or indirectly. [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", ... ... The declaration of a parameter entity must precede any reference to it... [ VC: Entity Declared ] In a document with an external subset or external parameter entities with "standalone='no'", ... ... The declaration of a parameter entity must precede any reference to it... [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled. A PEReference may have been detected in the current input stream the handling is done accordingly to http://www.w3.org/TR/REC-xml#entproc i.e. - Included in literal in entity values - Included as Parameter Entity reference within DTDs
| ctxt: | the parser context |
void xmlParserHandleReference (xmlParserCtxtPtr ctxt)
TODO: Remove, now deprecated ... the test is done directly in the content parsing routines. [67] Reference ::= EntityRef | CharRef [68] EntityRef ::= '&' Name ';' [ WFC: Entity Declared ] the Name given in the entity reference must match that in an entity declaration, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. [ WFC: Parsed Entity ] An entity reference must not contain the name of an unparsed entity [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' A PEReference may have been detected in the current input stream the handling is done accordingly to http://www.w3.org/TR/REC-xml#entproc
| ctxt: | the parser context |
void xmlParserInputShrink (xmlParserInputPtr in)
This function removes used input for the parser.
| in: | an XML parser input |
xmlChar xmlPopInput (xmlParserCtxtPtr ctxt)
xmlPopInput: the current input pointed by ctxt->input came to an end pop it and return the next char.
| ctxt: | an XML parser context |
| Returns: | the current xmlChar in the parser context |
int xmlPushInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input)
xmlPushInput: switch to a new input stream which is stacked on top of the previous one(s).
| ctxt: | an XML parser context |
| input: | an XML parser input fragment (entity, XML fragment ...). |
| Returns: | -1 in case of error or the index in the input stack |
xmlChar * xmlScanName (xmlParserCtxtPtr ctxt)
Trickery: parse an XML name but without consuming the input flow Needed for rollback cases. Used only when parsing entities references. TODO: seems deprecated now, only used in the default part of xmlParserHandleReference [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::= (Letter | '_' | ':') (NameChar)* [6] Names ::= Name (S Name)*
| ctxt: | an XML parser context |
| Returns: | the Name parsed or NULL |
void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func)
Set the function to call call back when a xml reference has been made
| func: | A valid function |
int xmlSkipBlankChars (xmlParserCtxtPtr ctxt)
skip all blanks character found at that point in the input streams. It pops up finished entities in the process if allowable at that point.
| ctxt: | the XML parser context |
| Returns: | the number of space chars skipped |
xmlChar * xmlSplitQName (xmlParserCtxtPtr ctxt,
const xmlChar * name,
xmlChar ** prefix)
parse an UTF8 encoded XML qualified name string [NS 5] QName ::= (Prefix ':')? LocalPart [NS 6] Prefix ::= NCName [NS 7] LocalPart ::= NCName
| ctxt: | an XML parser context |
| name: | an XML parser context |
| prefix: | a xmlChar ** |
| Returns: | the local part, and prefix is updated to get the Prefix if any. |
int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
const xmlChar * cur,
int * len)
The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer.
| ctxt: | the XML parser context |
| cur: | pointer to the beginning of the char |
| len: | pointer to the length of the char read |
| Returns: | the current char value and its length |
xmlChar * xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar * str,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3)
Takes a entity string content and process to do the adequate substitutions. [67] Reference ::= EntityRef | CharRef [69] PEReference ::= '%' Name ';'
| ctxt: | the parser context |
| str: | the input string |
| what: | combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF |
| end: | an end marker xmlChar, 0 if none |
| end2: | an end marker xmlChar, 0 if none |
| end3: | an end marker xmlChar, 0 if none |
| Returns: | A newly allocated string with the substitution done. The caller must deallocate it ! |
xmlChar * xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar * str,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3)
Takes a entity string content and process to do the adequate substitutions. [67] Reference ::= EntityRef | CharRef [69] PEReference ::= '%' Name ';'
| ctxt: | the parser context |
| str: | the input string |
| len: | the string length |
| what: | combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF |
| end: | an end marker xmlChar, 0 if none |
| end2: | an end marker xmlChar, 0 if none |
| end3: | an end marker xmlChar, 0 if none |
| Returns: | A newly allocated string with the substitution done. The caller must deallocate it ! |
int xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncoding enc)
change the input functions when discovering the character encoding of a given entity.
| ctxt: | the parser context |
| enc: | the encoding value (number) |
| Returns: | 0 in case of success, -1 otherwise |
int xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler)
change the input functions when discovering the character encoding of a given entity.
| ctxt: | the parser context |
| input: | the input stream |
| handler: | the encoding handler |
| Returns: | 0 in case of success, -1 otherwise |
int xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler)
change the input functions when discovering the character encoding of a given entity.
| ctxt: | the parser context |
| handler: | the encoding handler |
| Returns: | 0 in case of success, -1 otherwise |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlsave - the XML document serializer
API to save document or subtree of document
Author(s): Daniel Veillard
typedef enum xmlSaveOption; typedef struct _xmlSaveCtxt xmlSaveCtxt; typedef xmlSaveCtxt * xmlSaveCtxtPtr; xmlSaveCtxtPtr xmlSaveToIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void * ioctx,
const char * encoding,
int options); xmlSaveCtxtPtr xmlSaveToFd (int fd,
const char * encoding,
int options); int xmlSaveClose (xmlSaveCtxtPtr ctxt); int xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape); xmlSaveCtxtPtr xmlSaveToBuffer (xmlBufferPtr buffer,
const char * encoding,
int options); xmlSaveCtxtPtr xmlSaveToFilename (const char * filename,
const char * encoding,
int options); int xmlSaveFlush (xmlSaveCtxtPtr ctxt); long xmlSaveDoc (xmlSaveCtxtPtr ctxt,
xmlDocPtr doc); int xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape); long xmlSaveTree (xmlSaveCtxtPtr ctxt,
xmlNodePtr node);
struct _xmlSaveCtxt {
The content of this structure is not made public by the API.
} xmlSaveCtxt;
xmlSaveCtxt * xmlSaveCtxtPtr;
enum xmlSaveOption { XML_SAVE_FORMAT = 1 /* format save output */ XML_SAVE_NO_DECL = 2 /* drop the xml declaration */ XML_SAVE_NO_EMPTY = 4 /* no empty tags */ XML_SAVE_NO_XHTML = 8 /* disable XHTML1 specific rules */ XML_SAVE_XHTML = 16 /* force XHTML1 specific rules */ XML_SAVE_AS_XML = 32 /* force XML serialization on HTML doc */ XML_SAVE_AS_HTML = 64 /* force HTML serialization on XML doc */ XML_SAVE_WSNONSIG = 128 /* format with non-significant whitespace */ };
int xmlSaveClose (xmlSaveCtxtPtr ctxt)
Close a document saving context, i.e. make sure that all bytes have been output and free the associated data.
| ctxt: | a document saving context |
| Returns: | the number of byte written or -1 in case of error. |
long xmlSaveDoc (xmlSaveCtxtPtr ctxt,
xmlDocPtr doc)
Save a full document to a saving context TODO: The function is not fully implemented yet as it does not return the byte count but 0 instead
| ctxt: | a document saving context |
| doc: | a document |
| Returns: | the number of byte written or -1 in case of error |
int xmlSaveFlush (xmlSaveCtxtPtr ctxt)
Flush a document saving context, i.e. make sure that all bytes have been output.
| ctxt: | a document saving context |
| Returns: | the number of byte written or -1 in case of error. |
int xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape)
Set a custom escaping function to be used for text in attribute content
| ctxt: | a document saving context |
| escape: | the escaping function |
| Returns: | 0 if successful or -1 in case of error. |
int xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape)
Set a custom escaping function to be used for text in element content
| ctxt: | a document saving context |
| escape: | the escaping function |
| Returns: | 0 if successful or -1 in case of error. |
xmlSaveCtxtPtr xmlSaveToBuffer (xmlBufferPtr buffer,
const char * encoding,
int options)
Create a document saving context serializing to a buffer with the encoding and the options given
| buffer: | a buffer |
| encoding: | the encoding name to use or NULL |
| options: | a set of xmlSaveOptions |
| Returns: | a new serialization context or NULL in case of error. |
xmlSaveCtxtPtr xmlSaveToFd (int fd,
const char * encoding,
int options)
Create a document saving context serializing to a file descriptor with the encoding and the options given.
| fd: | a file descriptor number |
| encoding: | the encoding name to use or NULL |
| options: | a set of xmlSaveOptions |
| Returns: | a new serialization context or NULL in case of error. |
xmlSaveCtxtPtr xmlSaveToFilename (const char * filename,
const char * encoding,
int options)
Create a document saving context serializing to a filename or possibly to an URL (but this is less reliable) with the encoding and the options given.
| filename: | a file name or an URL |
| encoding: | the encoding name to use or NULL |
| options: | a set of xmlSaveOptions |
| Returns: | a new serialization context or NULL in case of error. |
xmlSaveCtxtPtr xmlSaveToIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void * ioctx,
const char * encoding,
int options)
Create a document saving context serializing to a file descriptor with the encoding and the options given
| iowrite: | an I/O write function |
| ioclose: | an I/O close function |
| ioctx: | an I/O handler |
| encoding: | the encoding name to use or NULL |
| options: | a set of xmlSaveOptions |
| Returns: | a new serialization context or NULL in case of error. |
long xmlSaveTree (xmlSaveCtxtPtr ctxt,
xmlNodePtr node)
Save a subtree starting at the node parameter to a saving context TODO: The function is not fully implemented yet as it does not return the byte count but 0 instead
| ctxt: | a document saving context |
| node: | the top node of the subtree to save |
| Returns: | the number of byte written or -1 in case of error |
|
|
|
|
|
libxml2 Reference Manual |
|---|
schemasInternals - internal interfaces for XML Schemas
internal interfaces for the XML Schemas handling and schema validity checking The Schemas development is a Work In Progress. Some of those interfaces are not guaranteed to be API or ABI stable !
Author(s): Daniel Veillard
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION; #define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION; #define XML_SCHEMAS_TYPE_FIXUP_1; #define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION; #define XML_SCHEMAS_ELEM_CIRCULAR; #define XML_SCHEMAS_QUALIF_ATTR; #define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE; #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION; #define XML_SCHEMAS_ATTR_USE_REQUIRED; #define XML_SCHEMAS_FACET_COLLAPSE; #define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE; #define XML_SCHEMAS_TYPE_VARIETY_UNION; #define XML_SCHEMAS_ANY_STRICT; #define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED; #define XML_SCHEMAS_QUALIF_ELEM; #define XML_SCHEMAS_TYPE_VARIETY_LIST; #define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE; #define XML_SCHEMAS_ELEM_INTERNAL_CHECKED; #define XML_SCHEMAS_INCLUDING_CONVERT_NS; #define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED; #define XML_SCHEMAS_ATTR_USE_PROHIBITED; #define XML_SCHEMAS_ELEM_NILLABLE; #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION; #define XML_SCHEMAS_ATTRGROUP_REDEFINED; #define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD; #define XML_SCHEMAS_TYPE_BLOCK_DEFAULT; #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION; #define XML_SCHEMAS_TYPE_FINAL_EXTENSION; #define XML_SCHEMAS_TYPE_REDEFINED; #define XML_SCHEMAS_ELEM_FIXED; #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD; #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC; #define XML_SCHEMAS_TYPE_FINAL_LIST; #define XML_SCHEMAS_ATTR_USE_OPTIONAL; #define XML_SCHEMAS_ATTR_NSDEFAULT; #define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE; #define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION; #define XML_SCHEMAS_ANYATTR_STRICT; #define XML_SCHEMAS_FACET_UNKNOWN; #define XML_SCHEMAS_ATTRGROUP_MARKED; #define XML_SCHEMAS_FACET_PRESERVE; #define XML_SCHEMAS_ELEM_BLOCK_EXTENSION; #define XML_SCHEMAS_ATTR_GLOBAL; #define XML_SCHEMAS_ANYATTR_SKIP; #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION; #define XML_SCHEMAS_ANYATTR_LAX; #define XML_SCHEMAS_TYPE_GLOBAL; #define XML_SCHEMAS_TYPE_ABSTRACT; #define XML_SCHEMAS_TYPE_MIXED; #define XML_SCHEMAS_ATTR_FIXED; #define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED; #define XML_SCHEMAS_ANY_SKIP; #define XML_SCHEMAS_FINAL_DEFAULT_LIST; #define XML_SCHEMAS_TYPE_VARIETY_ABSENT; #define XML_SCHEMAS_ELEM_FINAL_RESTRICTION; #define XML_SCHEMAS_WILDCARD_COMPLETE; #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED; #define XML_SCHEMAS_ELEM_NSDEFAULT; #define XML_SCHEMAS_ELEM_GLOBAL; #define XML_SCHEMAS_ELEM_TOPLEVEL; #define XML_SCHEMAS_ANY_LAX; #define XML_SCHEMAS_TYPE_FINAL_RESTRICTION; #define XML_SCHEMAS_TYPE_HAS_FACETS; #define XML_SCHEMAS_ELEM_FINAL_EXTENSION; #define XML_SCHEMAS_TYPE_NORMVALUENEEDED; #define XML_SCHEMAS_ELEM_FINAL_ABSENT; #define XML_SCHEMAS_TYPE_BLOCK_EXTENSION; #define XML_SCHEMAS_TYPE_INTERNAL_INVALID; #define XML_SCHEMAS_ATTRGROUP_HAS_REFS; #define XML_SCHEMAS_ELEM_ABSTRACT; #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION; #define XML_SCHEMAS_TYPE_FINAL_UNION; #define XML_SCHEMAS_TYPE_FINAL_DEFAULT; #define XML_SCHEMAS_TYPE_FACETSNEEDVALUE; #define XML_SCHEMAS_FINAL_DEFAULT_UNION; #define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION; #define XML_SCHEMAS_FACET_REPLACE; #define XML_SCHEMAS_ELEM_DEFAULT; #define XML_SCHEMAS_TYPE_MARKED; #define XML_SCHEMAS_ELEM_BLOCK_ABSENT; #define XML_SCHEMAS_ATTRGROUP_GLOBAL; #define XML_SCHEMAS_ELEM_REF; typedef xmlSchemaAttributeGroup * xmlSchemaAttributeGroupPtr; typedef xmlSchemaElement * xmlSchemaElementPtr; typedef xmlSchemaFacetLink * xmlSchemaFacetLinkPtr; typedef struct _xmlSchemaVal xmlSchemaVal; typedef xmlSchemaAttributeLink * xmlSchemaAttributeLinkPtr; typedef struct _xmlSchemaType xmlSchemaType; typedef struct _xmlSchemaAnnot xmlSchemaAnnot; typedef xmlSchemaAnnot * xmlSchemaAnnotPtr; typedef struct _xmlSchemaElement xmlSchemaElement; typedef struct _xmlSchemaWildcard xmlSchemaWildcard; typedef xmlSchemaWildcard * xmlSchemaWildcardPtr; typedef xmlSchemaFacet * xmlSchemaFacetPtr; typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; typedef xmlSchemaVal * xmlSchemaValPtr; typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; typedef xmlSchemaWildcardNs * xmlSchemaWildcardNsPtr; typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; typedef xmlSchemaTypeLink * xmlSchemaTypeLinkPtr; typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; typedef xmlSchemaAttribute * xmlSchemaAttributePtr; typedef xmlSchemaNotation * xmlSchemaNotationPtr; typedef enum xmlSchemaValType; typedef xmlSchemaType * xmlSchemaTypePtr; typedef struct _xmlSchemaNotation xmlSchemaNotation; typedef struct _xmlSchemaFacet xmlSchemaFacet; typedef enum xmlSchemaContentType; typedef enum xmlSchemaTypeType; typedef struct _xmlSchemaAttribute xmlSchemaAttribute; void xmlSchemaFreeType (xmlSchemaTypePtr type); void xmlSchemaFreeWildcard (xmlSchemaWildcardPtr wildcard);
#define XML_SCHEMAS_ANYATTR_LAX;
Ignore validation non definition on attributes Obsolete, not used anymore.
#define XML_SCHEMAS_ANYATTR_SKIP;
Skip unknown attribute from validation Obsolete, not used anymore.
#define XML_SCHEMAS_ANYATTR_STRICT;
Apply strict validation rules on attributes Obsolete, not used anymore.
#define XML_SCHEMAS_ANY_LAX;
Used by wildcards. Validate if type found, don't worry if not found
#define XML_SCHEMAS_ANY_STRICT;
Used by wildcards. Apply strict validation rules
#define XML_SCHEMAS_ATTRGROUP_GLOBAL;
The attribute wildcard has been already builded.
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS;
Whether this attr. group contains attr. group references.
#define XML_SCHEMAS_ATTRGROUP_MARKED;
Marks the attr group as marked; used for circular checks.
#define XML_SCHEMAS_ATTRGROUP_REDEFINED;
The attr group was redefined.
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED;
The attribute wildcard has been already builded.
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED;
this is set when the "type" and "ref" references have been resolved.
#define XML_SCHEMAS_ATTR_USE_OPTIONAL;
The attribute is optional.
#define XML_SCHEMAS_ATTR_USE_PROHIBITED;
Used by wildcards. The attribute is prohibited.
#define XML_SCHEMAS_ATTR_USE_REQUIRED;
The attribute is required.
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION;
the schema has "extension" in the set of blockDefault.
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION;
the schema has "restriction" in the set of blockDefault.
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION;
the schema has "substitution" in the set of blockDefault.
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT;
the "block" attribute is absent
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION;
disallowed substitutions are absent
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION;
disallowed substitutions: "restriction"
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION;
disallowed substitutions: "substituion"
#define XML_SCHEMAS_ELEM_CIRCULAR;
a helper flag for the search of circular references.
#define XML_SCHEMAS_ELEM_FINAL_ABSENT;
substitution group exclusions are absent
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION;
substitution group exclusions: "extension"
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION;
substitution group exclusions: "restriction"
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED;
this is set when the elem decl has been checked against all constraints
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED;
this is set when "type", "ref", "substitutionGroup" references have been resolved.
#define XML_SCHEMAS_ELEM_NSDEFAULT;
allow elements in no namespace Obsolete, not used anymore.
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD;
the declaration is a substitution group head
#define XML_SCHEMAS_ELEM_TOPLEVEL;
the element is top level obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION;
the schema has "extension" in the set of finalDefault.
#define XML_SCHEMAS_FINAL_DEFAULT_LIST;
the cshema has "list" in the set of finalDefault.
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION;
the schema has "restriction" in the set of finalDefault.
#define XML_SCHEMAS_FINAL_DEFAULT_UNION;
the schema has "union" in the set of finalDefault.
#define XML_SCHEMAS_INCLUDING_CONVERT_NS;
the schema is currently including an other schema with no target namespace.
#define XML_SCHEMAS_QUALIF_ATTR;
Reflects attributeFormDefault == qualified in an XML schema document.
#define XML_SCHEMAS_QUALIF_ELEM;
Reflects elementFormDefault == qualified in an XML schema document.
#define XML_SCHEMAS_TYPE_ABSTRACT;
the simple/complexType is abstract.
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT;
the complexType did not specify 'block' so use the default of the <schema> item.
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
the complexType has a 'block' of "extension".
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION;
the complexType has a 'block' of "restriction".
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE;
Marks the item as a builtin primitive.
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION;
the simple or complex type has a derivation method of "extension".
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION;
the simple or complex type has a derivation method of "restriction".
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE;
indicates if the facets need a computed value
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT;
the simpleType has a final of "default".
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION;
the complexType has a final of "extension".
#define XML_SCHEMAS_TYPE_FINAL_LIST;
the simpleType has a final of "list".
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION;
the simpleType/complexType has a final of "restriction".
#define XML_SCHEMAS_TYPE_FINAL_UNION;
the simpleType has a final of "union".
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID;
indicates that the type is invalid
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED;
indicates that the type was typefixed
#define XML_SCHEMAS_TYPE_MARKED;
Marks the item as marked; used for circular checks.
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED;
indicates if the facets (pattern) need a normalized value
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD;
the complexType owns an attribute wildcard, i.e. it can be freed by the complexType
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT;
the simpleType has a variety of "absent". TODO: Actually not necessary :-/, since if none of the variety flags occur then it's automatically absent.
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
the simpleType has a variety of "union".
#define XML_SCHEMAS_TYPE_VARIETY_LIST;
the simpleType has a variety of "list".
#define XML_SCHEMAS_TYPE_VARIETY_UNION;
the simpleType has a variety of "union".
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE;
a whitespace-facet value of "collapse"
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE;
a whitespace-facet value of "preserve"
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE;
a whitespace-facet value of "replace"
#define XML_SCHEMAS_WILDCARD_COMPLETE;
If the wildcard is complete.
struct _xmlSchemaAnnot {
struct _xmlSchemaAnnot * next
xmlNodePtr content : the annotation
} xmlSchemaAnnot;
xmlSchemaAnnot * xmlSchemaAnnotPtr;
struct _xmlSchemaAttribute {
xmlSchemaTypeType type
struct _xmlSchemaAttribute * next : the next attribute (not used?)
const xmlChar * name : the name of the declaration
const xmlChar * id : Deprecated; not used
const xmlChar * ref : Deprecated; not used
const xmlChar * refNs : Deprecated; not used
const xmlChar * typeName : the local name of the type definition
const xmlChar * typeNs : the ns URI of the type definition
xmlSchemaAnnotPtr annot
xmlSchemaTypePtr base : Deprecated; not used
int occurs : Deprecated; not used
const xmlChar * defValue : The initial value of the value constraint
xmlSchemaTypePtr subtypes : the type definition
xmlNodePtr node
const xmlChar * targetNamespace
int flags
const xmlChar * refPrefix : Deprecated; not used
xmlSchemaValPtr defVal : The compiled value constraint
xmlSchemaAttributePtr refDecl : Deprecated; not used
} xmlSchemaAttribute;
struct _xmlSchemaAttributeGroup {
xmlSchemaTypeType type : The kind of type
struct _xmlSchemaAttribute * next : the next attribute if in a group ...
const xmlChar * name
const xmlChar * id
const xmlChar * ref : Deprecated; not used
const xmlChar * refNs : Deprecated; not used
xmlSchemaAnnotPtr annot
xmlSchemaAttributePtr attributes : Deprecated; not used
xmlNodePtr node
int flags
xmlSchemaWildcardPtr attributeWildcard
const xmlChar * refPrefix : Deprecated; not used
xmlSchemaAttributeGroupPtr refItem : Deprecated; not used
const xmlChar * targetNamespace
void * attrUses
} xmlSchemaAttributeGroup;
xmlSchemaAttributeGroup * xmlSchemaAttributeGroupPtr;
struct _xmlSchemaAttributeLink {
struct _xmlSchemaAttributeLink * next : the next attribute link ...
struct _xmlSchemaAttribute * attr : the linked attribute
} xmlSchemaAttributeLink;
xmlSchemaAttributeLink * xmlSchemaAttributeLinkPtr;
xmlSchemaAttribute * xmlSchemaAttributePtr;
enum xmlSchemaContentType { XML_SCHEMA_CONTENT_UNKNOWN = 0 XML_SCHEMA_CONTENT_EMPTY = 1 XML_SCHEMA_CONTENT_ELEMENTS = 2 XML_SCHEMA_CONTENT_MIXED = 3 XML_SCHEMA_CONTENT_SIMPLE = 4 XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS = 5 /* Obsolete */ XML_SCHEMA_CONTENT_BASIC = 6 XML_SCHEMA_CONTENT_ANY = 7 };
struct _xmlSchemaElement {
xmlSchemaTypeType type : The kind of type
struct _xmlSchemaType * next : Not used?
const xmlChar * name
const xmlChar * id : Deprecated; not used
const xmlChar * ref : Deprecated; not used
const xmlChar * refNs : Deprecated; not used
xmlSchemaAnnotPtr annot
xmlSchemaTypePtr subtypes : the type definition
xmlSchemaAttributePtr attributes
xmlNodePtr node
int minOccurs : Deprecated; not used
int maxOccurs : Deprecated; not used
int flags
const xmlChar * targetNamespace
const xmlChar * namedType
const xmlChar * namedTypeNs
const xmlChar * substGroup
const xmlChar * substGroupNs
const xmlChar * scope
const xmlChar * value : The original value of the value constraint.
struct _xmlSchemaElement * refDecl : This will now be used for the substitution group affiliation
xmlRegexpPtr contModel : Obsolete for WXS, maybe used for RelaxNG
xmlSchemaContentType contentType
const xmlChar * refPrefix : Deprecated; not used
xmlSchemaValPtr defVal : The compiled value contraint.
void * idcs : The identity-constraint defs
} xmlSchemaElement;
xmlSchemaElement * xmlSchemaElementPtr;
struct _xmlSchemaFacet {
xmlSchemaTypeType type : The kind of type
struct _xmlSchemaFacet * next : the next type if in a sequence ...
const xmlChar * value : The original value
const xmlChar * id : Obsolete
xmlSchemaAnnotPtr annot
xmlNodePtr node
int fixed : XML_SCHEMAS_FACET_PRESERVE, etc.
int whitespace
xmlSchemaValPtr val : The compiled value
xmlRegexpPtr regexp : The regex for patterns
} xmlSchemaFacet;
struct _xmlSchemaFacetLink {
struct _xmlSchemaFacetLink * next : the next facet link ...
xmlSchemaFacetPtr facet : the linked facet
} xmlSchemaFacetLink;
xmlSchemaFacetLink * xmlSchemaFacetLinkPtr;
xmlSchemaFacet * xmlSchemaFacetPtr;
struct _xmlSchemaNotation {
xmlSchemaTypeType type : The kind of type
const xmlChar * name
xmlSchemaAnnotPtr annot
const xmlChar * identifier
const xmlChar * targetNamespace
} xmlSchemaNotation;
xmlSchemaNotation * xmlSchemaNotationPtr;
struct _xmlSchemaType {
xmlSchemaTypeType type : The kind of type
struct _xmlSchemaType * next : the next type if in a sequence ...
const xmlChar * name
const xmlChar * id : Deprecated; not used
const xmlChar * ref : Deprecated; not used
const xmlChar * refNs : Deprecated; not used
xmlSchemaAnnotPtr annot
xmlSchemaTypePtr subtypes
xmlSchemaAttributePtr attributes : Deprecated; not used
xmlNodePtr node
int minOccurs : Deprecated; not used
int maxOccurs : Deprecated; not used
int flags
xmlSchemaContentType contentType
const xmlChar * base : Base type's local name
const xmlChar * baseNs : Base type's target namespace
xmlSchemaTypePtr baseType : The base type component
xmlSchemaFacetPtr facets : Local facets
struct _xmlSchemaType * redef : Deprecated; not used
int recurse : Obsolete
xmlSchemaAttributeLinkPtr * attributeUses : Deprecated; not used
xmlSchemaWildcardPtr attributeWildcard
int builtInType : Type of built-in types.
xmlSchemaTypeLinkPtr memberTypes : member-types if a union type.
xmlSchemaFacetLinkPtr facetSet : All facets (incl. inherited)
const xmlChar * refPrefix : Deprecated; not used
xmlSchemaTypePtr contentTypeDef : Used for the simple content of complex types. Could we use @subtypes
xmlRegexpPtr contModel : Holds the automaton of the content model
const xmlChar * targetNamespace
void * attrUses
} xmlSchemaType;
struct _xmlSchemaTypeLink {
struct _xmlSchemaTypeLink * next : the next type link ...
xmlSchemaTypePtr type : the linked type
} xmlSchemaTypeLink;
xmlSchemaTypeLink * xmlSchemaTypeLinkPtr;
xmlSchemaType * xmlSchemaTypePtr;
enum xmlSchemaTypeType { XML_SCHEMA_TYPE_BASIC = 1 /* A built-in datatype */ XML_SCHEMA_TYPE_ANY = 2 XML_SCHEMA_TYPE_FACET = 3 XML_SCHEMA_TYPE_SIMPLE = 4 XML_SCHEMA_TYPE_COMPLEX = 5 XML_SCHEMA_TYPE_SEQUENCE = 6 XML_SCHEMA_TYPE_CHOICE = 7 XML_SCHEMA_TYPE_ALL = 8 XML_SCHEMA_TYPE_SIMPLE_CONTENT = 9 XML_SCHEMA_TYPE_COMPLEX_CONTENT = 10 XML_SCHEMA_TYPE_UR = 11 XML_SCHEMA_TYPE_RESTRICTION = 12 XML_SCHEMA_TYPE_EXTENSION = 13 XML_SCHEMA_TYPE_ELEMENT = 14 XML_SCHEMA_TYPE_ATTRIBUTE = 15 XML_SCHEMA_TYPE_ATTRIBUTEGROUP = 16 XML_SCHEMA_TYPE_GROUP = 17 XML_SCHEMA_TYPE_NOTATION = 18 XML_SCHEMA_TYPE_LIST = 19 XML_SCHEMA_TYPE_UNION = 20 XML_SCHEMA_TYPE_ANY_ATTRIBUTE = 21 XML_SCHEMA_TYPE_IDC_UNIQUE = 22 XML_SCHEMA_TYPE_IDC_KEY = 23 XML_SCHEMA_TYPE_IDC_KEYREF = 24 XML_SCHEMA_TYPE_PARTICLE = 25 XML_SCHEMA_TYPE_ATTRIBUTE_USE = 26 XML_SCHEMA_FACET_MININCLUSIVE = 1000 XML_SCHEMA_FACET_MINEXCLUSIVE = 1001 XML_SCHEMA_FACET_MAXINCLUSIVE = 1002 XML_SCHEMA_FACET_MAXEXCLUSIVE = 1003 XML_SCHEMA_FACET_TOTALDIGITS = 1004 XML_SCHEMA_FACET_FRACTIONDIGITS = 1005 XML_SCHEMA_FACET_PATTERN = 1006 XML_SCHEMA_FACET_ENUMERATION = 1007 XML_SCHEMA_FACET_WHITESPACE = 1008 XML_SCHEMA_FACET_LENGTH = 1009 XML_SCHEMA_FACET_MAXLENGTH = 1010 XML_SCHEMA_FACET_MINLENGTH = 1011 XML_SCHEMA_EXTRA_QNAMEREF = 2000 XML_SCHEMA_EXTRA_ATTR_USE_PROHIB = 2001 };
struct _xmlSchemaVal {
The content of this structure is not made public by the API.
} xmlSchemaVal;
xmlSchemaVal * xmlSchemaValPtr;
enum xmlSchemaValType { XML_SCHEMAS_UNKNOWN = 0 XML_SCHEMAS_STRING = 1 XML_SCHEMAS_NORMSTRING = 2 XML_SCHEMAS_DECIMAL = 3 XML_SCHEMAS_TIME = 4 XML_SCHEMAS_GDAY = 5 XML_SCHEMAS_GMONTH = 6 XML_SCHEMAS_GMONTHDAY = 7 XML_SCHEMAS_GYEAR = 8 XML_SCHEMAS_GYEARMONTH = 9 XML_SCHEMAS_DATE = 10 XML_SCHEMAS_DATETIME = 11 XML_SCHEMAS_DURATION = 12 XML_SCHEMAS_FLOAT = 13 XML_SCHEMAS_DOUBLE = 14 XML_SCHEMAS_BOOLEAN = 15 XML_SCHEMAS_TOKEN = 16 XML_SCHEMAS_LANGUAGE = 17 XML_SCHEMAS_NMTOKEN = 18 XML_SCHEMAS_NMTOKENS = 19 XML_SCHEMAS_NAME = 20 XML_SCHEMAS_QNAME = 21 XML_SCHEMAS_NCNAME = 22 XML_SCHEMAS_ID = 23 XML_SCHEMAS_IDREF = 24 XML_SCHEMAS_IDREFS = 25 XML_SCHEMAS_ENTITY = 26 XML_SCHEMAS_ENTITIES = 27 XML_SCHEMAS_NOTATION = 28 XML_SCHEMAS_ANYURI = 29 XML_SCHEMAS_INTEGER = 30 XML_SCHEMAS_NPINTEGER = 31 XML_SCHEMAS_NINTEGER = 32 XML_SCHEMAS_NNINTEGER = 33 XML_SCHEMAS_PINTEGER = 34 XML_SCHEMAS_INT = 35 XML_SCHEMAS_UINT = 36 XML_SCHEMAS_LONG = 37 XML_SCHEMAS_ULONG = 38 XML_SCHEMAS_SHORT = 39 XML_SCHEMAS_USHORT = 40 XML_SCHEMAS_BYTE = 41 XML_SCHEMAS_UBYTE = 42 XML_SCHEMAS_HEXBINARY = 43 XML_SCHEMAS_BASE64BINARY = 44 XML_SCHEMAS_ANYTYPE = 45 XML_SCHEMAS_ANYSIMPLETYPE = 46 };
struct _xmlSchemaWildcard {
xmlSchemaTypeType type : The kind of type
const xmlChar * id : Deprecated; not used
xmlSchemaAnnotPtr annot
xmlNodePtr node
int minOccurs : Deprecated; not used
int maxOccurs : Deprecated; not used
int processContents
int any : Indicates if the ns constraint is of ##any
xmlSchemaWildcardNsPtr nsSet : The list of allowed namespaces
xmlSchemaWildcardNsPtr negNsSet : The negated namespace
int flags
} xmlSchemaWildcard;
struct _xmlSchemaWildcardNs {
struct _xmlSchemaWildcardNs * next : the next constraint link ...
const xmlChar * value : the value
} xmlSchemaWildcardNs;
xmlSchemaWildcardNs * xmlSchemaWildcardNsPtr;
xmlSchemaWildcard * xmlSchemaWildcardPtr;
void xmlSchemaFreeType (xmlSchemaTypePtr type)
Deallocate a Schema Type structure.
| type: | a schema type structure |
void xmlSchemaFreeWildcard (xmlSchemaWildcardPtr wildcard)
Deallocates a wildcard structure.
| wildcard: | a wildcard structure |
|
|
|
|
|
libxml2 Reference Manual |
|---|
chvalid - Unicode character range checking
this module exports interfaces for the character range validation APIs This file is automatically generated from the cvs source definition files using the genChRanges.py Python script
Author(s): William Brack <wbrack@mmm.com.hk>
#define xmlIsExtender_ch(c); #define xmlIsPubidCharQ(c); #define xmlIsPubidChar_ch(c); #define xmlIsIdeographicQ(c); #define xmlIsExtenderQ(c); #define xmlIsChar_ch(c); #define xmlIsDigitQ(c); #define xmlIsDigit_ch(c); #define xmlIsBaseChar_ch(c); #define xmlIsCombiningQ(c); #define xmlIsBlankQ(c); #define xmlIsCharQ(c); #define xmlIsBaseCharQ(c); #define xmlIsBlank_ch(c); typedef struct _xmlChLRange xmlChLRange; typedef xmlChSRange * xmlChSRangePtr; typedef xmlChLRange * xmlChLRangePtr; typedef xmlChRangeGroup * xmlChRangeGroupPtr; typedef struct _xmlChSRange xmlChSRange; typedef struct _xmlChRangeGroup xmlChRangeGroup; int xmlIsChar (unsigned int ch); int xmlIsDigit (unsigned int ch); int xmlIsBlank (unsigned int ch); int xmlIsIdeographic (unsigned int ch); int xmlCharInRange (unsigned int val,
const xmlChRangeGroup * rptr); int xmlIsPubidChar (unsigned int ch); int xmlIsCombining (unsigned int ch); int xmlIsBaseChar (unsigned int ch); int xmlIsExtender (unsigned int ch);
#define xmlIsBaseCharQ(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsBaseChar_ch(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsBlankQ(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsBlank_ch(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsChar_ch(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsCombiningQ(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsDigitQ(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsDigit_ch(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsExtenderQ(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsExtender_ch(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsIdeographicQ(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsPubidCharQ(c);
Automatically generated by genChRanges.py
| c: | char to validate |
#define xmlIsPubidChar_ch(c);
Automatically generated by genChRanges.py
| c: | char to validate |
struct _xmlChLRange {
unsigned int low
unsigned int high
} xmlChLRange;
xmlChLRange * xmlChLRangePtr;
struct _xmlChRangeGroup {
int nbShortRange
int nbLongRange
const xmlChSRange * shortRange : points to an array of ranges
const xmlChLRange * longRange
} xmlChRangeGroup;
xmlChRangeGroup * xmlChRangeGroupPtr;
struct _xmlChSRange {
unsigned short low
unsigned short high
} xmlChSRange;
xmlChSRange * xmlChSRangePtr;
const xmlChRangeGroup xmlIsBaseCharGroup;
const xmlChRangeGroup xmlIsCharGroup;
const xmlChRangeGroup xmlIsCombiningGroup;
const xmlChRangeGroup xmlIsDigitGroup;
const xmlChRangeGroup xmlIsExtenderGroup;
const xmlChRangeGroup xmlIsIdeographicGroup;
const unsigned charxmlIsPubidChar_tab[256] xmlIsPubidChar_tab;
int xmlCharInRange (unsigned int val,
const xmlChRangeGroup * rptr)
Does a binary search of the range table to determine if char is valid
| val: | character to be validated |
| rptr: | pointer to range to be used to validate |
| Returns: | true if character valid, false otherwise |
int xmlIsBaseChar (unsigned int ch)
This function is DEPRECATED. Use xmlIsBaseChar_ch or xmlIsBaseCharQ instead
| ch: | character to validate |
| Returns: | true if argument valid, false otherwise |
int xmlIsBlank (unsigned int ch)
This function is DEPRECATED. Use xmlIsBlank_ch or xmlIsBlankQ instead
| ch: | character to validate |
| Returns: | true if argument valid, false otherwise |
int xmlIsChar (unsigned int ch)
This function is DEPRECATED. Use xmlIsChar_ch or xmlIsCharQ instead
| ch: | character to validate |
| Returns: | true if argument valid, false otherwise |
int xmlIsCombining (unsigned int ch)
This function is DEPRECATED. Use xmlIsCombiningQ instead
| ch: | character to validate |
| Returns: | true if argument valid, false otherwise |
int xmlIsDigit (unsigned int ch)
This function is DEPRECATED. Use xmlIsDigit_ch or xmlIsDigitQ instead
| ch: | character to validate |
| Returns: | true if argument valid, false otherwise |
int xmlIsExtender (unsigned int ch)
This function is DEPRECATED. Use xmlIsExtender_ch or xmlIsExtenderQ instead
| ch: | character to validate |
| Returns: | true if argument valid, false otherwise |
int xmlIsIdeographic (unsigned int ch)
This function is DEPRECATED. Use xmlIsIdeographicQ instead
| ch: | character to validate |
| Returns: | true if argument valid, false otherwise |
int xmlIsPubidChar (unsigned int ch)
This function is DEPRECATED. Use xmlIsPubidChar_ch or xmlIsPubidCharQ instead
| ch: | character to validate |
| Returns: | true if argument valid, false otherwise |
|
|
|
|
|
libxml2 Reference Manual |
|---|
threads - interfaces for thread handling
set of generic threading related routines should work with pthreads, Windows native or TLS threads
Author(s): Daniel Veillard
typedef struct _xmlMutex xmlMutex; typedef struct _xmlRMutex xmlRMutex; typedef xmlRMutex * xmlRMutexPtr; typedef xmlMutex * xmlMutexPtr; void xmlFreeRMutex (xmlRMutexPtr tok); int xmlGetThreadId (void); void xmlMutexUnlock (xmlMutexPtr tok); void xmlCleanupThreads (void); void xmlLockLibrary (void); xmlRMutexPtr xmlNewRMutex (void); void xmlMutexLock (xmlMutexPtr tok); int xmlIsMainThread (void); void xmlRMutexUnlock (xmlRMutexPtr tok); xmlGlobalStatePtr xmlGetGlobalState (void); xmlMutexPtr xmlNewMutex (void); int xmlDllMain (void * hinstDLL,
unsigned long fdwReason,
void * lpvReserved); void xmlFreeMutex (xmlMutexPtr tok); void xmlUnlockLibrary (void); void xmlInitThreads (void); void xmlRMutexLock (xmlRMutexPtr tok);
struct _xmlMutex {
The content of this structure is not made public by the API.
} xmlMutex;
struct _xmlRMutex {
The content of this structure is not made public by the API.
} xmlRMutex;
void xmlCleanupThreads (void)
xmlCleanupThreads() is used to to cleanup all the thread related data of the libxml2 library once processing has ended. WARNING: if your application is multithreaded or has plugin support calling this may crash the application if another thread or a plugin is still using libxml2. It's sometimes very hard to guess if libxml2 is in use in the application, some libraries or plugins may use it without notice. In case of doubt abstain from calling this function or do it just before calling exit() to avoid leak reports from valgrind !
int xmlDllMain (void * hinstDLL,
unsigned long fdwReason,
void * lpvReserved)
| hinstDLL: | |
| fdwReason: | |
| lpvReserved: | |
| Returns: |
void xmlFreeMutex (xmlMutexPtr tok)
xmlFreeMutex() is used to reclaim resources associated with a libxml2 token struct.
| tok: | the simple mutex |
void xmlFreeRMutex (xmlRMutexPtr tok)
xmlRFreeMutex() is used to reclaim resources associated with a reentrant mutex.
| tok: | the reentrant mutex |
xmlGlobalStatePtr xmlGetGlobalState (void)
xmlGetGlobalState() is called to retrieve the global state for a thread.
| Returns: | the thread global state or NULL in case of error |
int xmlGetThreadId (void)
xmlGetThreadId() find the current thread ID number Note that this is likely to be broken on some platforms using pthreads as the specification doesn't mandate pthread_t to be an integer type
| Returns: | the current thread ID number |
void xmlInitThreads (void)
xmlInitThreads() is used to to initialize all the thread related data of the libxml2 library.
int xmlIsMainThread (void)
xmlIsMainThread() check whether the current thread is the main thread.
| Returns: | 1 if the current thread is the main thread, 0 otherwise |
void xmlLockLibrary (void)
xmlLockLibrary() is used to take out a re-entrant lock on the libxml2 library.
void xmlMutexLock (xmlMutexPtr tok)
xmlMutexLock() is used to lock a libxml2 token.
| tok: | the simple mutex |
void xmlMutexUnlock (xmlMutexPtr tok)
xmlMutexUnlock() is used to unlock a libxml2 token.
| tok: | the simple mutex |
xmlMutexPtr xmlNewMutex (void)
xmlNewMutex() is used to allocate a libxml2 token struct for use in synchronizing access to data.
| Returns: | a new simple mutex pointer or NULL in case of error |
xmlRMutexPtr xmlNewRMutex (void)
xmlRNewMutex() is used to allocate a reentrant mutex for use in synchronizing access to data. token_r is a re-entrant lock and thus useful for synchronizing access to data structures that may be manipulated in a recursive fashion.
| Returns: | the new reentrant mutex pointer or NULL in case of error |
void xmlRMutexLock (xmlRMutexPtr tok)
xmlRMutexLock() is used to lock a libxml2 token_r.
| tok: | the reentrant mutex |
void xmlRMutexUnlock (xmlRMutexPtr tok)
xmlRMutexUnlock() is used to unlock a libxml2 token_r.
| tok: | the reentrant mutex |
void xmlUnlockLibrary (void)
xmlUnlockLibrary() is used to release a re-entrant lock on the libxml2 library.
|
|
|
|
|
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_ENTITY_REF_NODE; #define HTML_COMMENT_NODE; #define HTML_PRESERVE_NODE; #define HTML_TEXT_NODE; #define HTML_PI_NODE; int htmlNodeDumpFileFormat (FILE * out,
xmlDocPtr doc,
xmlNodePtr cur,
const char * encoding,
int format); void htmlDocDumpMemory (xmlDocPtr cur,
xmlChar ** mem,
int * size); int htmlSaveFile (const char * filename,
xmlDocPtr cur); int htmlDocDump (FILE * f,
xmlDocPtr cur); void htmlDocDumpMemoryFormat (xmlDocPtr cur,
xmlChar ** mem,
int * size,
int format); int htmlIsBooleanAttr (const xmlChar * name); int htmlSaveFileFormat (const char * filename,
xmlDocPtr cur,
const char * encoding,
int format); void htmlNodeDumpFormatOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char * encoding,
int format); int htmlSetMetaEncoding (htmlDocPtr doc,
const xmlChar * encoding); int htmlSaveFileEnc (const char * filename,
xmlDocPtr cur,
const char * encoding); void htmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char * encoding); int htmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur); htmlDocPtr htmlNewDoc (const xmlChar * URI,
const xmlChar * ExternalID); const xmlChar * htmlGetMetaEncoding (htmlDocPtr doc); void htmlNodeDumpFile (FILE * out,
xmlDocPtr doc,
xmlNodePtr cur); void htmlDocContentDumpFormatOutput (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding,
int format); htmlDocPtr htmlNewDocNoDtD (const xmlChar * URI,
const xmlChar * ExternalID); void htmlDocContentDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * 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 |
| format: | should formatting spaces been added |
void htmlDocContentDumpOutput (xmlOutputBufferPtr buf,
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 |
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)
Determine if a given attribute is a boolean attribute.
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 |
| 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 |
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 |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xlink - unfinished XLink detection module
unfinished XLink detection module
Author(s): Daniel Veillard
typedef xmlChar * xlinkTitle; typedef enum xlinkShow; typedef xmlChar * xlinkHRef; typedef enum xlinkActuate; typedef struct _xlinkHandler xlinkHandler; typedef xmlChar * xlinkRole; typedef xlinkHandler * xlinkHandlerPtr; typedef enum xlinkType; void xlinkSetDefaultDetect (xlinkNodeDetectFunc func); void xlinkSetDefaultHandler (xlinkHandlerPtr handler); typedef void xlinkExtendedLinkFunk (void * ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef * hrefs,
const xlinkRole * roles,
int nbArcs,
const xlinkRole * from,
const xlinkRole * to,
xlinkShow * show,
xlinkActuate * actuate,
int nbTitles,
const xlinkTitle * titles,
const xmlChar ** langs); typedef void xlinkExtendedLinkSetFunk (void * ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef * hrefs,
const xlinkRole * roles,
int nbTitles,
const xlinkTitle * titles,
const xmlChar ** langs); typedef void xlinkSimpleLinkFunk (void * ctx,
xmlNodePtr node,
const xlinkHRef href,
const xlinkRole role,
const xlinkTitle title); typedef void xlinkNodeDetectFunc (void * ctx,
xmlNodePtr node); xlinkHandlerPtr xlinkGetDefaultHandler (void); xlinkType xlinkIsLink (xmlDocPtr doc,
xmlNodePtr node); xlinkNodeDetectFunc xlinkGetDefaultDetect (void);
enum xlinkActuate { XLINK_ACTUATE_NONE = 0 XLINK_ACTUATE_AUTO = 1 XLINK_ACTUATE_ONREQUEST = 2 };
struct _xlinkHandler {
xlinkSimpleLinkFunk simple
xlinkExtendedLinkFunk extended
xlinkExtendedLinkSetFunk set
} xlinkHandler;
xlinkHandler * xlinkHandlerPtr;
enum xlinkShow { XLINK_SHOW_NONE = 0 XLINK_SHOW_NEW = 1 XLINK_SHOW_EMBED = 2 XLINK_SHOW_REPLACE = 3 };
enum xlinkType { XLINK_TYPE_NONE = 0 XLINK_TYPE_SIMPLE = 1 XLINK_TYPE_EXTENDED = 2 XLINK_TYPE_EXTENDED_SET = 3 };
void xlinkExtendedLinkFunk (void * ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef * hrefs,
const xlinkRole * roles,
int nbArcs,
const xlinkRole * from,
const xlinkRole * to,
xlinkShow * show,
xlinkActuate * actuate,
int nbTitles,
const xlinkTitle * titles,
const xmlChar ** langs)
This is the prototype for a extended link detection callback.
| ctx: | user data pointer |
| node: | the node carrying the link |
| nbLocators: | the number of locators detected on the link |
| hrefs: | pointer to the array of locator hrefs |
| roles: | pointer to the array of locator roles |
| nbArcs: | the number of arcs detected on the link |
| from: | pointer to the array of source roles found on the arcs |
| to: | pointer to the array of target roles found on the arcs |
| show: | array of values for the show attributes found on the arcs |
| actuate: | array of values for the actuate attributes found on the arcs |
| nbTitles: | the number of titles detected on the link |
| titles: | |
| langs: | array of xml:lang values for the titles |
void xlinkExtendedLinkSetFunk (void * ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef * hrefs,
const xlinkRole * roles,
int nbTitles,
const xlinkTitle * titles,
const xmlChar ** langs)
This is the prototype for a extended link set detection callback.
| ctx: | user data pointer |
| node: | the node carrying the link |
| nbLocators: | the number of locators detected on the link |
| hrefs: | pointer to the array of locator hrefs |
| roles: | pointer to the array of locator roles |
| nbTitles: | the number of titles detected on the link |
| titles: | |
| langs: | array of xml:lang values for the titles |
void xlinkNodeDetectFunc (void * ctx,
xmlNodePtr node)
This is the prototype for the link detection routine. It calls the default link detection callbacks upon link detection.
| ctx: | user data pointer |
| node: | the node to check |
void xlinkSimpleLinkFunk (void * ctx,
xmlNodePtr node,
const xlinkHRef href,
const xlinkRole role,
const xlinkTitle title)
This is the prototype for a simple link detection callback.
| ctx: | user data pointer |
| node: | the node carrying the link |
| href: | the target of the link |
| role: | the role string |
| title: | the link title |
xlinkNodeDetectFunc xlinkGetDefaultDetect (void)
Get the default xlink detection routine
| Returns: | the current function or NULL; |
xlinkHandlerPtr xlinkGetDefaultHandler (void)
Get the default xlink handler.
| Returns: | the current xlinkHandlerPtr value. |
xlinkType xlinkIsLink (xmlDocPtr doc,
xmlNodePtr node)
Check whether the given node carries the attributes needed to be a link element (or is one of the linking elements issued from the (X)HTML DtDs). This routine don't try to do full checking of the link validity but tries to detect and return the appropriate link type.
| doc: | the document containing the node |
| node: | the node pointer itself |
| Returns: | the xlinkType of the node (XLINK_TYPE_NONE if there is no link detected. |
void xlinkSetDefaultDetect (xlinkNodeDetectFunc func)
Set the default xlink detection routine
| func: | pointer to the new detection routine. |
void xlinkSetDefaultHandler (xlinkHandlerPtr handler)
Set the default xlink handlers
| handler: | the new value for the xlink handler block |
|
|
|
|
|
libxml2 Reference Manual |
|---|
schematron - XML Schemastron implementation
interface to the XML Schematron validity checking.
Author(s): Daniel Veillard
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; typedef enum xmlSchematronValidOptions; typedef xmlSchematron * xmlSchematronPtr; typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; typedef struct _xmlSchematron xmlSchematron; typedef xmlSchematronValidCtxt * xmlSchematronValidCtxtPtr; typedef xmlSchematronParserCtxt * xmlSchematronParserCtxtPtr; int xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
xmlDocPtr instance); void xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); xmlSchematronParserCtxtPtr xmlSchematronNewMemParserCtxt (const char * buffer,
int size); typedef void xmlSchematronValidityErrorFunc (void * ctx,
const char * msg,
... ...); xmlSchematronParserCtxtPtr xmlSchematronNewParserCtxt (const char * URL); typedef void xmlSchematronValidityWarningFunc (void * ctx,
const char * msg,
... ...); void xmlSchematronFree (xmlSchematronPtr schema); void xmlSchematronSetValidStructuredErrors (xmlSchematronValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void * ctx); void xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); xmlSchematronPtr xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); xmlSchematronParserCtxtPtr xmlSchematronNewDocParserCtxt (xmlDocPtr doc); xmlSchematronValidCtxtPtr xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
int options);
struct _xmlSchematron {
The content of this structure is not made public by the API.
} xmlSchematron;
struct _xmlSchematronParserCtxt {
The content of this structure is not made public by the API.
} xmlSchematronParserCtxt;
xmlSchematronParserCtxt * xmlSchematronParserCtxtPtr;
xmlSchematron * xmlSchematronPtr;
struct _xmlSchematronValidCtxt {
The content of this structure is not made public by the API.
} xmlSchematronValidCtxt;
xmlSchematronValidCtxt * xmlSchematronValidCtxtPtr;
enum xmlSchematronValidOptions { XML_SCHEMATRON_OUT_QUIET = 1 /* quiet no report */ XML_SCHEMATRON_OUT_TEXT = 2 /* build a textual report */ XML_SCHEMATRON_OUT_XML = 4 /* output SVRL */ XML_SCHEMATRON_OUT_ERROR = 8 /* output via xmlStructuredErrorFunc */ XML_SCHEMATRON_OUT_FILE = 256 /* output to a file descriptor */ XML_SCHEMATRON_OUT_BUFFER = 512 /* output to a buffer */ XML_SCHEMATRON_OUT_IO = 1024 /* output to I/O mechanism */ };
void xmlSchematronValidityErrorFunc (void * ctx,
const char * msg,
... ...)
Signature of an error callback from a Schematron validation
| ctx: | the validation context |
| msg: | the message |
| ...: | extra arguments |
void xmlSchematronValidityWarningFunc (void * ctx,
const char * msg,
... ...)
Signature of a warning callback from a Schematron validation
| ctx: | the validation context |
| msg: | the message |
| ...: | extra arguments |
void xmlSchematronFree (xmlSchematronPtr schema)
Deallocate a Schematron structure.
| schema: | a schema structure |
void xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt)
Free the resources associated to the schema parser context
| ctxt: | the schema parser context |
void xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt)
Free the resources associated to the schema validation context
| ctxt: | the schema validation context |
xmlSchematronParserCtxtPtr xmlSchematronNewDocParserCtxt (xmlDocPtr doc)
Create an XML Schematrons parse context for that document. NB. The document may be modified during the parsing process.
| doc: | a preparsed document tree |
| Returns: | the parser context or NULL in case of error |
xmlSchematronParserCtxtPtr xmlSchematronNewMemParserCtxt (const char * buffer,
int size)
Create an XML Schematrons parse context for that memory buffer expected to contain an XML Schematrons file.
| buffer: | a pointer to a char array containing the schemas |
| size: | the size of the array |
| Returns: | the parser context or NULL in case of error |
xmlSchematronParserCtxtPtr xmlSchematronNewParserCtxt (const char * URL)
Create an XML Schematrons parse context for that file/resource expected to contain an XML Schematrons file.
| URL: | the location of the schema |
| Returns: | the parser context or NULL in case of error |
xmlSchematronValidCtxtPtr xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
int options)
Create an XML Schematrons validation context based on the given schema.
| schema: | a precompiled XML Schematrons |
| options: | a set of xmlSchematronValidOptions |
| Returns: | the validation context or NULL in case of error |
xmlSchematronPtr xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt)
parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.
| ctxt: | a schema validation context |
| Returns: | the internal XML Schematron structure built from the resource or NULL in case of error |
void xmlSchematronSetValidStructuredErrors (xmlSchematronValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void * ctx)
Set the structured error callback
| ctxt: | a Schematron validation context |
| serror: | the structured error function |
| ctx: | the functions context |
int xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
xmlDocPtr instance)
Validate a tree instance against the schematron
| ctxt: | the schema validation context |
| instance: | the document instace tree |
| Returns: | 0 in case of success, -1 in case of internal error and an error count otherwise. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
dict - string dictionary
dictionary of reusable strings, just used to avoid allocation and freeing operations.
Author(s): Daniel Veillard
typedef struct _xmlDict xmlDict; typedef xmlDict * xmlDictPtr; size_t xmlDictGetUsage (xmlDictPtr dict); int xmlDictReference (xmlDictPtr dict); void xmlDictCleanup (void); int xmlDictSize (xmlDictPtr dict); const xmlChar * xmlDictExists (xmlDictPtr dict,
const xmlChar * name,
int len); size_t xmlDictSetLimit (xmlDictPtr dict,
size_t limit); int xmlDictOwns (xmlDictPtr dict,
const xmlChar * str); const xmlChar * xmlDictQLookup (xmlDictPtr dict,
const xmlChar * prefix,
const xmlChar * name); int xmlInitializeDict (void); xmlDictPtr xmlDictCreateSub (xmlDictPtr sub); void xmlDictFree (xmlDictPtr dict); const xmlChar * xmlDictLookup (xmlDictPtr dict,
const xmlChar * name,
int len); xmlDictPtr xmlDictCreate (void);
struct _xmlDict {
The content of this structure is not made public by the API.
} xmlDict;
void xmlDictCleanup (void)
Free the dictionary mutex. Do not call unless sure the library is not in use anymore !
xmlDictPtr xmlDictCreate (void)
Create a new dictionary
| Returns: | the newly created dictionary, or NULL if an error occurred. |
xmlDictPtr xmlDictCreateSub (xmlDictPtr sub)
Create a new dictionary, inheriting strings from the read-only dictionary @sub. On lookup, strings are first searched in the new dictionary, then in @sub, and if not found are created in the new dictionary.
| sub: | an existing dictionary |
| Returns: | the newly created dictionary, or NULL if an error occurred. |
const xmlChar * xmlDictExists (xmlDictPtr dict,
const xmlChar * name,
int len)
Check if the @name exists in the dictionary @dict.
| dict: | the dictionary |
| name: | the name of the userdata |
| len: | the length of the name, if -1 it is recomputed |
| Returns: | the internal copy of the name or NULL if not found. |
void xmlDictFree (xmlDictPtr dict)
Free the hash @dict and its contents. The userdata is deallocated with @f if provided.
| dict: | the dictionary |
size_t xmlDictGetUsage (xmlDictPtr dict)
Get how much memory is used by a dictionary for strings Added in 2.9.0
| dict: | the dictionary |
| Returns: | the amount of strings allocated |
const xmlChar * xmlDictLookup (xmlDictPtr dict,
const xmlChar * name,
int len)
Add the @name to the dictionary @dict if not present.
| dict: | the dictionary |
| name: | the name of the userdata |
| len: | the length of the name, if -1 it is recomputed |
| Returns: | the internal copy of the name or NULL in case of internal error |
int xmlDictOwns (xmlDictPtr dict,
const xmlChar * str)
check if a string is owned by the disctionary
| dict: | the dictionary |
| str: | the string |
| Returns: | 1 if true, 0 if false and -1 in case of error -1 in case of error |
const xmlChar * xmlDictQLookup (xmlDictPtr dict,
const xmlChar * prefix,
const xmlChar * name)
Add the QName @prefix:@name to the hash @dict if not present.
| dict: | the dictionary |
| prefix: | the prefix |
| name: | the name |
| Returns: | the internal copy of the QName or NULL in case of internal error |
int xmlDictReference (xmlDictPtr dict)
Increment the reference counter of a dictionary
| dict: | the dictionary |
| Returns: | 0 in case of success and -1 in case of error |
size_t xmlDictSetLimit (xmlDictPtr dict,
size_t limit)
Set a size limit for the dictionary Added in 2.9.0
| dict: | the dictionary |
| limit: | the limit in bytes |
| Returns: | the previous limit of the dictionary or 0 |
int xmlDictSize (xmlDictPtr dict)
Query the number of elements installed in the hash @dict.
| dict: | the dictionary |
| Returns: | the number of elements in the dictionary or -1 in case of error |
int xmlInitializeDict (void)
Do the dictionary mutex initialization. this function is deprecated
| Returns: | 0 if initialization was already done, and 1 if that call led to the initialization |
|
|
|
|
|
libxml2 Reference Manual |
|---|
c14n - Provide Canonical XML and Exclusive XML Canonicalization
the c14n modules provides a "Canonical XML" implementation
Author(s): Aleksey Sanin <aleksey@aleksey.com>
typedef enum xmlC14NMode; int xmlC14NExecute (xmlDocPtr doc,
xmlC14NIsVisibleCallback is_visible_callback,
void * user_data,
int mode,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf); int xmlC14NDocSaveTo (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf); typedef int xmlC14NIsVisibleCallback (void * user_data,
xmlNodePtr node,
xmlNodePtr parent); int xmlC14NDocSave (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
const char * filename,
int compression); int xmlC14NDocDumpMemory (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlChar ** doc_txt_ptr);
enum xmlC14NMode { XML_C14N_1_0 = 0 /* Origianal C14N 1.0 spec */ XML_C14N_EXCLUSIVE_1_0 = 1 /* Exclusive C14N 1.0 spec */ XML_C14N_1_1 = 2 /* C14N 1.1 spec */ };
int xmlC14NIsVisibleCallback (void * user_data,
xmlNodePtr node,
xmlNodePtr parent)
Signature for a C14N callback on visible nodes
| user_data: | user data |
| node: | the curent node |
| parent: | the parent node |
| Returns: | 1 if the node should be included |
int xmlC14NDocDumpMemory (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlChar ** doc_txt_ptr)
Dumps the canonized image of given XML document into memory. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
| doc: | the XML document for canonization |
| nodes: | the nodes set to be included in the canonized image or NULL if all document nodes should be included |
| mode: | the c14n mode (see @xmlC14NMode) |
| inclusive_ns_prefixes: | the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) |
| with_comments: | include comments in the result (!=0) or not (==0) |
| doc_txt_ptr: | the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory |
| Returns: | the number of bytes written on success or a negative value on fail |
int xmlC14NDocSave (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
const char * filename,
int compression)
Dumps the canonized image of given XML document into the file. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
| doc: | the XML document for canonization |
| nodes: | the nodes set to be included in the canonized image or NULL if all document nodes should be included |
| mode: | the c14n mode (see @xmlC14NMode) |
| inclusive_ns_prefixes: | the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) |
| with_comments: | include comments in the result (!=0) or not (==0) |
| filename: | the filename to store canonical XML image |
| compression: | the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level |
| Returns: | the number of bytes written success or a negative value on fail |
int xmlC14NDocSaveTo (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf)
Dumps the canonized image of given XML document into the provided buffer. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
| doc: | the XML document for canonization |
| nodes: | the nodes set to be included in the canonized image or NULL if all document nodes should be included |
| mode: | the c14n mode (see @xmlC14NMode) |
| inclusive_ns_prefixes: | the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) |
| with_comments: | include comments in the result (!=0) or not (==0) |
| buf: | the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output |
| Returns: | non-negative value on success or a negative value on fail |
int xmlC14NExecute (xmlDocPtr doc,
xmlC14NIsVisibleCallback is_visible_callback,
void * user_data,
int mode,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf)
Dumps the canonized image of given XML document into the provided buffer. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
| doc: | the XML document for canonization |
| is_visible_callback: | the function to use to determine is node visible or not |
| user_data: | the first parameter for @is_visible_callback function (in most cases, it is nodes set) |
| mode: | the c14n mode (see @xmlC14NMode) |
| inclusive_ns_prefixes: | the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) |
| with_comments: | include comments in the result (!=0) or not (==0) |
| buf: | the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output |
| Returns: | non-negative value on success or a negative value on fail |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlschemas - incomplete XML Schemas structure implementation
interface to the XML Schemas handling and schema validity checking, it is incomplete right now.
Author(s): Daniel Veillard
typedef xmlSchema * xmlSchemaPtr; typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; typedef enum xmlSchemaValidOption; typedef xmlSchemaSAXPlugStruct * xmlSchemaSAXPlugPtr; typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; typedef xmlSchemaValidCtxt * xmlSchemaValidCtxtPtr; typedef xmlSchemaParserCtxt * xmlSchemaParserCtxtPtr; typedef struct _xmlSchema xmlSchema; typedef enum xmlSchemaValidError; typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; xmlSchemaParserCtxtPtr xmlSchemaNewDocParserCtxt (xmlDocPtr doc); int xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); xmlSchemaPtr xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); void xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); void xmlSchemaValidateSetFilename (xmlSchemaValidCtxtPtr vctxt,
const char * filename); xmlSchemaParserCtxtPtr xmlSchemaNewParserCtxt (const char * URL); int xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); typedef void xmlSchemaValidityErrorFunc (void * ctx,
const char * msg,
... ...); xmlSchemaSAXPlugPtr xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
xmlSAXHandlerPtr * sax,
void ** user_data); int xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc,
xmlSAXHandlerPtr sax,
void * user_data); int xmlSchemaGetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void ** ctx); void xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt,
xmlSchemaValidityLocatorFunc f,
void * ctxt); int xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem); void xmlSchemaSetValidStructuredErrors (xmlSchemaValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void * ctx); void xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void * ctx); int xmlSchemaValidCtxtGetOptions (xmlSchemaValidCtxtPtr ctxt); int xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
const char * filename,
int options); int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
xmlDocPtr doc); void xmlSchemaFree (xmlSchemaPtr schema); xmlSchemaParserCtxtPtr xmlSchemaNewMemParserCtxt (const char * buffer,
int size); typedef int xmlSchemaValidityLocatorFunc (void * ctx,
const char ** file,
unsigned long * line); int xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void ** ctx); int xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
int options); void xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void * ctx); typedef void xmlSchemaValidityWarningFunc (void * ctx,
const char * msg,
... ...); void xmlSchemaDump (FILE * output,
xmlSchemaPtr schema); void xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); xmlParserCtxtPtr xmlSchemaValidCtxtGetParserCtxt (xmlSchemaValidCtxtPtr ctxt); void xmlSchemaSetParserStructuredErrors (xmlSchemaParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void * ctx); xmlSchemaValidCtxtPtr xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
struct _xmlSchema {
const xmlChar * name : schema name
const xmlChar * targetNamespace : the target namespace
const xmlChar * version
const xmlChar * id : Obsolete
xmlDocPtr doc
xmlSchemaAnnotPtr annot
int flags
xmlHashTablePtr typeDecl
xmlHashTablePtr attrDecl
xmlHashTablePtr attrgrpDecl
xmlHashTablePtr elemDecl
xmlHashTablePtr notaDecl
xmlHashTablePtr schemasImports
void * _private : unused by the library for users or bindings
xmlHashTablePtr groupDecl
xmlDictPtr dict
void * includes : the includes, this is opaque for now
int preserve : whether to free the document
int counter : used to give ononymous components unique names
xmlHashTablePtr idcDef : All identity-constraint defs.
void * volatiles : Obsolete
} xmlSchema;
struct _xmlSchemaParserCtxt {
The content of this structure is not made public by the API.
} xmlSchemaParserCtxt;
xmlSchemaParserCtxt * xmlSchemaParserCtxtPtr;
xmlSchemaSAXPlugStruct * xmlSchemaSAXPlugPtr;
struct _xmlSchemaSAXPlug {
The content of this structure is not made public by the API.
} xmlSchemaSAXPlugStruct;
struct _xmlSchemaValidCtxt {
The content of this structure is not made public by the API.
} xmlSchemaValidCtxt;
xmlSchemaValidCtxt * xmlSchemaValidCtxtPtr;
enum xmlSchemaValidError { XML_SCHEMAS_ERR_OK = 0 XML_SCHEMAS_ERR_NOROOT = 1 XML_SCHEMAS_ERR_UNDECLAREDELEM = 2 XML_SCHEMAS_ERR_NOTTOPLEVEL = 3 XML_SCHEMAS_ERR_MISSING = 4 XML_SCHEMAS_ERR_WRONGELEM = 5 XML_SCHEMAS_ERR_NOTYPE = 6 XML_SCHEMAS_ERR_NOROLLBACK = 7 XML_SCHEMAS_ERR_ISABSTRACT = 8 XML_SCHEMAS_ERR_NOTEMPTY = 9 XML_SCHEMAS_ERR_ELEMCONT = 10 XML_SCHEMAS_ERR_HAVEDEFAULT = 11 XML_SCHEMAS_ERR_NOTNILLABLE = 12 XML_SCHEMAS_ERR_EXTRACONTENT = 13 XML_SCHEMAS_ERR_INVALIDATTR = 14 XML_SCHEMAS_ERR_INVALIDELEM = 15 XML_SCHEMAS_ERR_NOTDETERMINIST = 16 XML_SCHEMAS_ERR_CONSTRUCT = 17 XML_SCHEMAS_ERR_INTERNAL = 18 XML_SCHEMAS_ERR_NOTSIMPLE = 19 XML_SCHEMAS_ERR_ATTRUNKNOWN = 20 XML_SCHEMAS_ERR_ATTRINVALID = 21 XML_SCHEMAS_ERR_VALUE = 22 XML_SCHEMAS_ERR_FACET = 23 XML_SCHEMAS_ERR_ = 24 XML_SCHEMAS_ERR_XXX = 25 };
enum xmlSchemaValidOption { XML_SCHEMA_VAL_VC_I_CREATE = 1 /* Default/fixed: create an attribute node * or an element's text node on the instance. * */ };
void xmlSchemaValidityErrorFunc (void * ctx,
const char * msg,
... ...)
Signature of an error callback from an XSD validation
| ctx: | the validation context |
| msg: | the message |
| ...: | extra arguments |
int xmlSchemaValidityLocatorFunc (void * ctx,
const char ** file,
unsigned long * line)
A schemas validation locator, a callback called by the validator. This is used when file or node informations are not available to find out what file and line number are affected
| ctx: | user provided context |
| file: | returned file information |
| line: | returned line information |
| Returns: | 0 in case of success and -1 in case of error |
void xmlSchemaValidityWarningFunc (void * ctx,
const char * msg,
... ...)
Signature of a warning callback from an XSD validation
| ctx: | the validation context |
| msg: | the message |
| ...: | extra arguments |
void xmlSchemaDump (FILE * output,
xmlSchemaPtr schema)
Dump a Schema structure.
| output: | the file output |
| schema: | a schema structure |
void xmlSchemaFree (xmlSchemaPtr schema)
Deallocate a Schema structure.
| schema: | a schema structure |
void xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt)
Free the resources associated to the schema parser context
| ctxt: | the schema parser context |
void xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt)
Free the resources associated to the schema validation context
| ctxt: | the schema validation context |
int xmlSchemaGetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void ** ctx)
Get the callback information used to handle errors for a parser context
| ctxt: | a XMl-Schema parser context |
| err: | the error callback result |
| warn: | the warning callback result |
| ctx: | contextual data for the callbacks result |
| Returns: | -1 in case of failure, 0 otherwise |
int xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void ** ctx)
Get the error and warning callback informations
| ctxt: | a XML-Schema validation context |
| err: | the error function result |
| warn: | the warning function result |
| ctx: | the functions context result |
| Returns: | -1 in case of error and 0 otherwise |
int xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt)
Check if any error was detected during validation.
| ctxt: | the schema validation context |
| Returns: | 1 if valid so far, 0 if errors were detected, and -1 in case of internal error. |
xmlSchemaParserCtxtPtr xmlSchemaNewDocParserCtxt (xmlDocPtr doc)
Create an XML Schemas parse context for that document. NB. The document may be modified during the parsing process.
| doc: | a preparsed document tree |
| Returns: | the parser context or NULL in case of error |
xmlSchemaParserCtxtPtr xmlSchemaNewMemParserCtxt (const char * buffer,
int size)
Create an XML Schemas parse context for that memory buffer expected to contain an XML Schemas file.
| buffer: | a pointer to a char array containing the schemas |
| size: | the size of the array |
| Returns: | the parser context or NULL in case of error |
xmlSchemaParserCtxtPtr xmlSchemaNewParserCtxt (const char * URL)
Create an XML Schemas parse context for that file/resource expected to contain an XML Schemas file.
| URL: | the location of the schema |
| Returns: | the parser context or NULL in case of error |
xmlSchemaValidCtxtPtr xmlSchemaNewValidCtxt (xmlSchemaPtr schema)
Create an XML Schemas validation context based on the given schema.
| schema: | a precompiled XML Schemas |
| Returns: | the validation context or NULL in case of error |
xmlSchemaPtr xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt)
parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.
| ctxt: | a schema validation context |
| Returns: | the internal XML Schema structure built from the resource or NULL in case of error |
xmlSchemaSAXPlugPtr xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
xmlSAXHandlerPtr * sax,
void ** user_data)
Plug a SAX based validation layer in a SAX parsing event flow. The original @saxptr and @dataptr data are replaced by new pointers but the calls to the original will be maintained.
| ctxt: | a schema validation context |
| sax: | a pointer to the original xmlSAXHandlerPtr |
| user_data: | a pointer to the original SAX user data pointer |
| Returns: | a pointer to a data structure needed to unplug the validation layer or NULL in case of errors. |
int xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug)
Unplug a SAX based validation layer in a SAX parsing event flow. The original pointers used in the call are restored.
| plug: | a data structure returned by xmlSchemaSAXPlug |
| Returns: | 0 in case of success and -1 in case of failure. |
void xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void * ctx)
Set the callback functions used to handle errors for a validation context
| ctxt: | a schema validation context |
| err: | the error callback |
| warn: | the warning callback |
| ctx: | contextual data for the callbacks |
void xmlSchemaSetParserStructuredErrors (xmlSchemaParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void * ctx)
Set the structured error callback
| ctxt: | a schema parser context |
| serror: | the structured error function |
| ctx: | the functions context |
void xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void * ctx)
Set the error and warning callback informations
| ctxt: | a schema validation context |
| err: | the error function |
| warn: | the warning function |
| ctx: | the functions context |
int xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
int options)
Sets the options to be used during the validation.
| ctxt: | a schema validation context |
| options: | a combination of xmlSchemaValidOption |
| Returns: | 0 in case of success, -1 in case of an API error. |
void xmlSchemaSetValidStructuredErrors (xmlSchemaValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void * ctx)
Set the structured error callback
| ctxt: | a schema validation context |
| serror: | the structured error function |
| ctx: | the functions context |
int xmlSchemaValidCtxtGetOptions (xmlSchemaValidCtxtPtr ctxt)
Get the validation context options.
| ctxt: | a schema validation context |
| Returns: | the option combination or -1 on error. |
xmlParserCtxtPtr xmlSchemaValidCtxtGetParserCtxt (xmlSchemaValidCtxtPtr ctxt)
allow access to the parser context of the schema validation context
| ctxt: | a schema validation context |
| Returns: | the parser context of the schema validation context or NULL in case of error. |
int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
xmlDocPtr doc)
Validate a document tree in memory.
| ctxt: | a schema validation context |
| doc: | a parsed document tree |
| Returns: | 0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
const char * filename,
int options)
Do a schemas validation of the given resource, it will use the SAX streamable validation internally.
| ctxt: | a schema validation context |
| filename: | the URI of the instance |
| options: | a future set of options, currently unused |
| Returns: | 0 if the document is valid, a positive error code number otherwise and -1 in case of an internal or API error. |
int xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem)
Validate a branch of a tree, starting with the given @elem.
| ctxt: | a schema validation context |
| elem: | an element node |
| Returns: | 0 if the element and its subtree is valid, a positive error code number otherwise and -1 in case of an internal or API error. |
void xmlSchemaValidateSetFilename (xmlSchemaValidCtxtPtr vctxt,
const char * filename)
Workaround to provide file error reporting information when this is not provided by current APIs
| vctxt: | the schema validation context |
| filename: | the file name |
void xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt,
xmlSchemaValidityLocatorFunc f,
void * ctxt)
Allows to set a locator function to the validation context, which will be used to provide file and line information since those are not provided as part of the SAX validation flow Setting @f to NULL disable the locator.
| vctxt: | a schema validation context |
| f: | the locator function pointer |
| ctxt: | the locator context |
int xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc,
xmlSAXHandlerPtr sax,
void * user_data)
Validate an input based on a flow of SAX event from the parser and forward the events to the @sax handler with the provided @user_data the user provided @sax handler must be a SAX2 one.
| ctxt: | a schema validation context |
| input: | the input to use for reading the data |
| enc: | an optional encoding information |
| sax: | a SAX handler for the resulting events |
| user_data: | the context to provide to the SAX handler. |
| Returns: | 0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
tree - interfaces for tree manipulation
this module describes the structures found in an tree resulting from an XML or HTML parsing, as well as the API provided for various processing on that tree
Author(s): Daniel Veillard
#define XML_LOCAL_NAMESPACE; #define BASE_BUFFER_SIZE; #define XML_XML_ID; #define xmlRootNode; #define XML_GET_LINE; #define XML_GET_CONTENT; #define xmlChildrenNode; #define XML_XML_NAMESPACE; #define LIBXML2_NEW_BUFFER; typedef struct _xmlNs xmlNs; typedef struct _xmlElementContent xmlElementContent; typedef xmlEnumeration * xmlEnumerationPtr; typedef struct _xmlBuffer xmlBuffer; typedef xmlParserInput * xmlParserInputPtr; typedef xmlSAXLocator * xmlSAXLocatorPtr; typedef struct _xmlParserInput xmlParserInput; typedef struct _xmlElement xmlElement; typedef xmlElementType xmlNsType; typedef enum xmlBufferAllocationScheme; typedef struct _xmlNode xmlNode; typedef xmlDoc * xmlDocPtr; typedef xmlBuffer * xmlBufferPtr; typedef xmlDOMWrapCtxt * xmlDOMWrapCtxtPtr; typedef xmlRef * xmlRefPtr; typedef struct _xmlParserInputBuffer xmlParserInputBuffer; typedef struct _xmlRef xmlRef; typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; typedef xmlNode * xmlNodePtr; typedef struct _xmlParserCtxt xmlParserCtxt; typedef xmlDtd * xmlDtdPtr; typedef enum xmlAttributeDefault; typedef struct _xmlBuf xmlBuf; typedef struct _xmlNotation xmlNotation; typedef enum xmlElementType; typedef struct _xmlEntity xmlEntity; typedef struct _xmlAttr xmlAttr; typedef xmlAttribute * xmlAttributePtr; typedef enum xmlElementTypeVal; typedef xmlNotation * xmlNotationPtr; typedef xmlElement * xmlElementPtr; typedef xmlBuf * xmlBufPtr; typedef enum xmlElementContentOccur; typedef xmlAttr * xmlAttrPtr; typedef struct _xmlDoc xmlDoc; typedef struct _xmlID xmlID; typedef xmlParserCtxt * xmlParserCtxtPtr; typedef xmlEntity * xmlEntityPtr; typedef struct _xmlEnumeration xmlEnumeration; typedef enum xmlAttributeType; typedef xmlNs * xmlNsPtr; typedef xmlParserInputBuffer * xmlParserInputBufferPtr; typedef struct _xmlSAXHandler xmlSAXHandler; typedef struct _xmlOutputBuffer xmlOutputBuffer; typedef struct _xmlSAXLocator xmlSAXLocator; typedef xmlElementContent * xmlElementContentPtr; typedef enum xmlElementContentType; typedef enum xmlDocProperties; typedef xmlID * xmlIDPtr; typedef struct _xmlDtd xmlDtd; typedef struct _xmlAttribute xmlAttribute; typedef xmlOutputBuffer * xmlOutputBufferPtr; typedef xmlSAXHandler * xmlSAXHandlerPtr; xmlNodePtr xmlDocCopyNode (xmlNodePtr node,
xmlDocPtr doc,
int extended); xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content); xmlChar * xmlBufContent (const xmlBuf * buf); xmlAttrPtr xmlNewNsPropEatName (xmlNodePtr node,
xmlNsPtr ns,
xmlChar * name,
const xmlChar * value); xmlNodePtr xmlStringGetNodeList (const xmlDoc * doc,
const xmlChar * value); xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
const xmlChar * content,
int len); void xmlBufferWriteCHAR (xmlBufferPtr buf,
const xmlChar * string); xmlChar * xmlNodeGetBase (const xmlDoc * doc,
const xmlNode * cur); void xmlBufferEmpty (xmlBufferPtr buf); xmlChar * xmlBuildQName (const xmlChar * ncname,
const xmlChar * prefix,
xmlChar * memory,
int len); int xmlValidateNMToken (const xmlChar * value,
int space); int xmlSaveFormatFileEnc (const char * filename,
xmlDocPtr cur,
const char * encoding,
int format); xmlNodePtr xmlAddSibling (xmlNodePtr cur,
xmlNodePtr elem); xmlBufferPtr xmlBufferCreate (void); xmlNodePtr xmlNewDocFragment (xmlDocPtr doc); xmlNodePtr xmlDocGetRootElement (const xmlDoc * doc); xmlChar * xmlGetProp (const xmlNode * node,
const xmlChar * name); int xmlValidateName (const xmlChar * value,
int space); xmlChar * xmlBufEnd (xmlBufPtr buf); int xmlValidateQName (const xmlChar * value,
int space); xmlAttrPtr xmlHasNsProp (const xmlNode * node,
const xmlChar * name,
const xmlChar * nameSpace); xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
xmlNodePtr elem); int xmlBufferAddHead (xmlBufferPtr buf,
const xmlChar * str,
int len); xmlNodePtr xmlNewPI (const xmlChar * name,
const xmlChar * content); void xmlDocDumpFormatMemoryEnc (xmlDocPtr out_doc,
xmlChar ** doc_txt_ptr,
int * doc_txt_len,
const char * txt_encoding,
int format); xmlAttrPtr xmlSetProp (xmlNodePtr node,
const xmlChar * name,
const xmlChar * value); unsigned long xmlChildElementCount (xmlNodePtr parent); void xmlElemDump (FILE * f,
xmlDocPtr doc,
xmlNodePtr cur); int xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding,
int format); xmlDtdPtr xmlGetIntSubset (const xmlDoc * doc); int xmlNodeBufGetContent (xmlBufferPtr buffer,
const xmlNode * cur); xmlNodePtr xmlNextElementSibling (xmlNodePtr node); void xmlBufferWriteChar (xmlBufferPtr buf,
const char * string); void xmlBufferFree (xmlBufferPtr buf); int xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr sourceDoc,
xmlNodePtr node,
xmlNodePtr * resNode,
xmlDocPtr destDoc,
xmlNodePtr destParent,
int deep,
int options); xmlNodePtr xmlNewNode (xmlNsPtr ns,
const xmlChar * name); int xmlSaveFileTo (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding); xmlNodePtr xmlNewTextLen (const xmlChar * content,
int len); xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content); void xmlNodeSetContent (xmlNodePtr cur,
const xmlChar * content); int xmlBufferAdd (xmlBufferPtr buf,
const xmlChar * str,
int len); void xmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format,
const char * encoding); xmlNsPtr xmlCopyNamespace (xmlNsPtr cur); xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
xmlNodePtr node,
const xmlChar * href); xmlNodePtr xmlAddChild (xmlNodePtr parent,
xmlNodePtr cur); int xmlReconciliateNs (xmlDocPtr doc,
xmlNodePtr tree); int xmlValidateNCName (const xmlChar * value,
int space); xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
const xmlChar * content); int xmlGetCompressMode (void); int xmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format); xmlBufferPtr xmlBufferCreateSize (size_t size); xmlChar * xmlNodeListGetString (xmlDocPtr doc,
const xmlNode * list,
int inLine); void xmlSetCompressMode (int mode); void xmlSetTreeDoc (xmlNodePtr tree,
xmlDocPtr doc); int xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr sourceDoc,
xmlNodePtr node,
xmlDocPtr destDoc,
xmlNodePtr destParent,
int options); xmlNodePtr xmlCopyNodeList (xmlNodePtr node); xmlNodePtr xmlNewDocNodeEatName (xmlDocPtr doc,
xmlNsPtr ns,
xmlChar * name,
const xmlChar * content); xmlNodePtr xmlAddChildList (xmlNodePtr parent,
xmlNodePtr cur); xmlChar * xmlGetNodePath (const xmlNode * node); void xmlFreePropList (xmlAttrPtr cur); void xmlNodeAddContent (xmlNodePtr cur,
const xmlChar * content); int xmlUnsetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar * name); xmlNodePtr xmlFirstElementChild (xmlNodePtr parent); xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
xmlNodePtr elem); int xmlIsBlankNode (const xmlNode * node); xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
const xmlChar * href,
const xmlChar * prefix); int xmlBufferDump (FILE * file,
xmlBufferPtr buf); xmlChar * xmlNodeGetContent (const xmlNode * cur); xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
int recursive); xmlDOMWrapCtxtPtr xmlDOMWrapNewCtxt (void); void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
xmlChar ** doc_txt_ptr,
int * doc_txt_len,
const char * txt_encoding); int xmlBufGetNodeContent (xmlBufPtr buf,
const xmlNode * cur); xmlNodePtr xmlTextMerge (xmlNodePtr first,
xmlNodePtr second); void xmlDocDumpMemory (xmlDocPtr cur,
xmlChar ** mem,
int * size); xmlNodePtr xmlNewDocPI (xmlDocPtr doc,
const xmlChar * name,
const xmlChar * content); void xmlFreeNs (xmlNsPtr cur); int xmlDocDump (FILE * f,
xmlDocPtr cur); void xmlFreeProp (xmlAttrPtr cur); xmlChar * xmlGetNoNsProp (const xmlNode * node,
const xmlChar * name); xmlChar * xmlSplitQName2 (const xmlChar * name,
xmlChar ** prefix); xmlAttrPtr xmlNewProp (xmlNodePtr node,
const xmlChar * name,
const xmlChar * value); int xmlTextConcat (xmlNodePtr node,
const xmlChar * content,
int len); int xmlNodeGetSpacePreserve (const xmlNode * cur); int xmlBufferShrink (xmlBufferPtr buf,
unsigned int len); xmlNodePtr xmlPreviousElementSibling (xmlNodePtr node); void xmlNodeSetContentLen (xmlNodePtr cur,
const xmlChar * content,
int len); void xmlNodeAddContentLen (xmlNodePtr cur,
const xmlChar * content,
int len); void xmlBufferWriteQuotedString (xmlBufferPtr buf,
const xmlChar * string); xmlAttrPtr xmlCopyProp (xmlNodePtr target,
xmlAttrPtr cur); xmlNodePtr xmlReplaceNode (xmlNodePtr old,
xmlNodePtr cur); void xmlSetDocCompressMode (xmlDocPtr doc,
int mode); xmlNodePtr xmlCopyNode (xmlNodePtr node,
int extended); void xmlUnlinkNode (xmlNodePtr cur); const xmlChar * xmlSplitQName3 (const xmlChar * name,
int * len); typedef xmlNsPtr xmlDOMWrapAcquireNsFunction (xmlDOMWrapCtxtPtr ctxt,
xmlNodePtr node,
const xmlChar * nsName,
const xmlChar * nsPrefix); size_t xmlBufUse (const xmlBufPtr buf); xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
xmlNodePtr root); long xmlGetLineNo (const xmlNode * node); const xmlChar * xmlBufferContent (const xmlBuffer * buf); int xmlRemoveProp (xmlAttrPtr cur); xmlNodePtr xmlLastElementChild (xmlNodePtr parent); xmlChar * xmlNodeGetLang (const xmlNode * cur); int xmlGetDocCompressMode (const xmlDoc * doc); size_t xmlBufNodeDump (xmlBufPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format); xmlChar * xmlGetNsProp (const xmlNode * node,
const xmlChar * name,
const xmlChar * nameSpace); xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
const xmlChar * name,
const xmlChar * value); void xmlFreeNode (xmlNodePtr cur); xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * value); void xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); xmlChar * xmlBufferDetach (xmlBufferPtr buf); void xmlBufferSetAllocationScheme (xmlBufferPtr buf,
xmlBufferAllocationScheme scheme); xmlNodePtr xmlNewChild (xmlNodePtr parent,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content); xmlNsPtr xmlSearchNs (xmlDocPtr doc,
xmlNodePtr node,
const xmlChar * nameSpace); xmlNodePtr xmlStringLenGetNodeList (const xmlDoc * doc,
const xmlChar * value,
int len); int xmlSaveFormatFile (const char * filename,
xmlDocPtr cur,
int format); xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
xmlAttrPtr cur); int xmlDocFormatDump (FILE * f,
xmlDocPtr cur,
int format); void xmlNodeSetSpacePreserve (xmlNodePtr cur,
int val); xmlAttrPtr xmlHasProp (const xmlNode * node,
const xmlChar * name); int xmlBufferCat (xmlBufferPtr buf,
const xmlChar * str); xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID); xmlDocPtr xmlNewDoc (const xmlChar * version); xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
const xmlChar * name); xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur); xmlNodePtr xmlNewNodeEatName (xmlNsPtr ns,
xmlChar * name); int xmlBufferResize (xmlBufferPtr buf,
unsigned int size); void xmlNodeSetBase (xmlNodePtr cur,
const xmlChar * uri); xmlNodePtr xmlNewComment (const xmlChar * content); int xmlBufferLength (const xmlBuffer * buf); xmlNodePtr xmlNewText (const xmlChar * content); int xmlUnsetProp (xmlNodePtr node,
const xmlChar * name); xmlBufferAllocationScheme xmlGetBufferAllocationScheme (void); int xmlSaveFile (const char * filename,
xmlDocPtr cur); xmlNodePtr xmlDocCopyNodeList (xmlDocPtr doc,
xmlNodePtr node); void xmlSetNs (xmlNodePtr node,
xmlNsPtr ns); xmlNsPtr xmlNewNs (xmlNodePtr node,
const xmlChar * href,
const xmlChar * prefix); int xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr node,
int options); void xmlAttrSerializeTxtContent (xmlBufferPtr buf,
xmlDocPtr doc,
xmlAttrPtr attr,
const xmlChar * string); xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd); xmlNodePtr xmlNewDocText (const xmlDoc * doc,
const xmlChar * content); xmlChar * xmlNodeListGetRawString (const xmlDoc * doc,
const xmlNode * list,
int inLine); xmlBufferPtr xmlBufferCreateStatic (void * mem,
size_t size); xmlNodePtr xmlNewReference (const xmlDoc * doc,
const xmlChar * name); int xmlDOMWrapReconcileNamespaces (xmlDOMWrapCtxtPtr ctxt,
xmlNodePtr elem,
int options); int xmlBufferCCat (xmlBufferPtr buf,
const char * str); xmlNsPtr * xmlGetNsList (const xmlDoc * doc,
const xmlNode * node); int xmlBufferGrow (xmlBufferPtr buf,
unsigned int len); int xmlNodeIsText (const xmlNode * node); void xmlSetBufferAllocationScheme (xmlBufferAllocationScheme scheme); int xmlIsXHTML (const xmlChar * systemID,
const xmlChar * publicID); void xmlNodeSetLang (xmlNodePtr cur,
const xmlChar * lang); void xmlFreeDtd (xmlDtdPtr cur); void xmlFreeNodeList (xmlNodePtr cur); void xmlFreeDoc (xmlDocPtr cur); size_t xmlBufShrink (xmlBufPtr buf,
size_t len); xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content); int xmlSaveFileEnc (const char * filename,
xmlDocPtr cur,
const char * encoding); xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * value); void xmlDocDumpFormatMemory (xmlDocPtr cur,
xmlChar ** mem,
int * size,
int format); void xmlSetListDoc (xmlNodePtr list,
xmlDocPtr doc); void xmlNodeSetName (xmlNodePtr cur,
const xmlChar * name); xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
const xmlChar * content,
int len); xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID); void xmlFreeNsList (xmlNsPtr cur); xmlNodePtr xmlGetLastChild (const xmlNode * parent);
#define LIBXML2_NEW_BUFFER;
Macro used to express that the API use the new buffers for xmlParserInputBuffer and xmlOutputBuffer. The change was introduced in 2.9.0.
#define XML_XML_NAMESPACE;
This is the namespace for the special xml: prefix predefined in the XML Namespace specification.
#define xmlChildrenNode;
Macro for compatibility naming layer with libxml1. Maps to "children."
#define xmlRootNode;
Macro for compatibility naming layer with libxml1. Maps to "children".
struct _xmlAttr {
void * _private : application data
xmlElementType type : XML_ATTRIBUTE_NODE, must be second !
const xmlChar * name : the name of the property
struct _xmlNode * children : the value of the property
struct _xmlNode * last : NULL
struct _xmlNode * parent : child->parent link
struct _xmlAttr * next : next sibling link
struct _xmlAttr * prev : previous sibling link
struct _xmlDoc * doc : the containing document
xmlNs * ns : pointer to the associated namespace
xmlAttributeType atype : the attribute type if validating
void * psvi : for type/PSVI informations
} xmlAttr;
struct _xmlAttribute {
void * _private : application data
xmlElementType type : XML_ATTRIBUTE_DECL, must be second !
const xmlChar * name : Attribute name
struct _xmlNode * children : NULL
struct _xmlNode * last : NULL
struct _xmlDtd * parent : -> DTD
struct _xmlNode * next : next sibling link
struct _xmlNode * prev : previous sibling link
struct _xmlDoc * doc : the containing document
struct _xmlAttribute * nexth : next in hash table
xmlAttributeType atype : The attribute type
xmlAttributeDefault def : the default
const xmlChar * defaultValue : or the default value
xmlEnumerationPtr tree : or the enumeration tree if any
const xmlChar * prefix : the namespace prefix if any
const xmlChar * elem : Element holding the attribute
} xmlAttribute;
enum xmlAttributeDefault { XML_ATTRIBUTE_NONE = 1 XML_ATTRIBUTE_REQUIRED = 2 XML_ATTRIBUTE_IMPLIED = 3 XML_ATTRIBUTE_FIXED = 4 };
xmlAttribute * xmlAttributePtr;
enum xmlAttributeType { XML_ATTRIBUTE_CDATA = 1 XML_ATTRIBUTE_ID = 2 XML_ATTRIBUTE_IDREF = 3 XML_ATTRIBUTE_IDREFS = 4 XML_ATTRIBUTE_ENTITY = 5 XML_ATTRIBUTE_ENTITIES = 6 XML_ATTRIBUTE_NMTOKEN = 7 XML_ATTRIBUTE_NMTOKENS = 8 XML_ATTRIBUTE_ENUMERATION = 9 XML_ATTRIBUTE_NOTATION = 10 };
struct _xmlBuf {
The content of this structure is not made public by the API.
} xmlBuf;
xmlBuf * xmlBufPtr;
A pointer to a buffer structure, the actual structure internals are not public
struct _xmlBuffer {
xmlChar * content : The buffer content UTF8
unsigned int use : The buffer size used
unsigned int size : The buffer size
xmlBufferAllocationScheme alloc : The realloc method
xmlChar * contentIO : in IO mode we may have a different base
} xmlBuffer;
enum xmlBufferAllocationScheme { XML_BUFFER_ALLOC_DOUBLEIT = 1 /* double each time one need to grow */ XML_BUFFER_ALLOC_EXACT = 2 /* grow only to the minimal size */ XML_BUFFER_ALLOC_IMMUTABLE = 3 /* immutable buffer */ XML_BUFFER_ALLOC_IO = 4 /* special allocation scheme used for I/O */ XML_BUFFER_ALLOC_HYBRID = 5 /* exact up to a threshold, and doubleit thereafter */ XML_BUFFER_ALLOC_BOUNDED = 6 /* limit the upper size of the buffer */ };
struct _xmlDOMWrapCtxt {
void * _private : * The type of this context, just in case we need specialized * context
int type : * Internal namespace map used for various operations. *
void * namespaceMap : * Use this one to acquire an xmlNsPtr intended for node->ns. * (Note t
xmlDOMWrapAcquireNsFunction getNsForNodeFunc
} xmlDOMWrapCtxt;
xmlDOMWrapCtxt * xmlDOMWrapCtxtPtr;
struct _xmlDoc {
void * _private : application data
xmlElementType type : XML_DOCUMENT_NODE, must be second !
char * name : name/filename/URI of the document
struct _xmlNode * children : the document tree
struct _xmlNode * last : last child link
struct _xmlNode * parent : child->parent link
struct _xmlNode * next : next sibling link
struct _xmlNode * prev : previous sibling link
struct _xmlDoc * doc : autoreference to itself End of common part
int compression : level of zlib compression
int standalone : standalone document (no external refs) 1 if standalone="yes" 0 if sta
struct _xmlDtd * intSubset : the document internal subset
struct _xmlDtd * extSubset : the document external subset
struct _xmlNs * oldNs : Global namespace, the old way
const xmlChar * version : the XML version string
const xmlChar * encoding : external initial encoding, if any
void * ids : Hash table for ID attributes if any
void * refs : Hash table for IDREFs attributes if any
const xmlChar * URL : The URI for that document
int charset : encoding of the in-memory content actually an xmlCharEncoding
struct _xmlDict * dict : dict used to allocate names or NULL
void * psvi : for type/PSVI informations
int parseFlags : set of xmlParserOption used to parse the document
int properties : set of xmlDocProperties for this document set at the end of parsing
} xmlDoc;
enum xmlDocProperties { XML_DOC_WELLFORMED = 1 /* document is XML well formed */ XML_DOC_NSVALID = 2 /* document is Namespace valid */ XML_DOC_OLD10 = 4 /* parsed with old XML-1.0 parser */ XML_DOC_DTDVALID = 8 /* DTD validation was successful */ XML_DOC_XINCLUDE = 16 /* XInclude substitution was done */ XML_DOC_USERBUILT = 32 /* Document was built using the API and not by parsing an instance */ XML_DOC_INTERNAL = 64 /* built for internal processing */ XML_DOC_HTML = 128 /* parsed or built HTML document */ };
struct _xmlDtd {
void * _private : application data
xmlElementType type : XML_DTD_NODE, must be second !
const xmlChar * name : Name of the DTD
struct _xmlNode * children : the value of the property link
struct _xmlNode * last : last child link
struct _xmlDoc * parent : child->parent link
struct _xmlNode * next : next sibling link
struct _xmlNode * prev : previous sibling link
struct _xmlDoc * doc : the containing document End of common part
void * notations : Hash table for notations if any
void * elements : Hash table for elements if any
void * attributes : Hash table for attributes if any
void * entities : Hash table for entities if any
const xmlChar * ExternalID : External identifier for PUBLIC DTD
const xmlChar * SystemID : URI for a SYSTEM or PUBLIC DTD
void * pentities : Hash table for param entities if any
} xmlDtd;
struct _xmlElement {
void * _private : application data
xmlElementType type : XML_ELEMENT_DECL, must be second !
const xmlChar * name : Element name
struct _xmlNode * children : NULL
struct _xmlNode * last : NULL
struct _xmlDtd * parent : -> DTD
struct _xmlNode * next : next sibling link
struct _xmlNode * prev : previous sibling link
struct _xmlDoc * doc : the containing document
xmlElementTypeVal etype : The type
xmlElementContentPtr content : the allowed element content
xmlAttributePtr attributes : List of the declared attributes
const xmlChar * prefix : the namespace prefix if any
xmlRegexpPtr contModel : the validating regexp
void * contModel
} xmlElement;
struct _xmlElementContent {
xmlElementContentType type : PCDATA, ELEMENT, SEQ or OR
xmlElementContentOccur ocur : ONCE, OPT, MULT or PLUS
const xmlChar * name : Element name
struct _xmlElementContent * c1 : first child
struct _xmlElementContent * c2 : second child
struct _xmlElementContent * parent : parent
const xmlChar * prefix : Namespace prefix
} xmlElementContent;
enum xmlElementContentOccur { XML_ELEMENT_CONTENT_ONCE = 1 XML_ELEMENT_CONTENT_OPT = 2 XML_ELEMENT_CONTENT_MULT = 3 XML_ELEMENT_CONTENT_PLUS = 4 };
xmlElementContent * xmlElementContentPtr;
enum xmlElementContentType { XML_ELEMENT_CONTENT_PCDATA = 1 XML_ELEMENT_CONTENT_ELEMENT = 2 XML_ELEMENT_CONTENT_SEQ = 3 XML_ELEMENT_CONTENT_OR = 4 };
xmlElement * xmlElementPtr;
enum xmlElementType { XML_ELEMENT_NODE = 1 XML_ATTRIBUTE_NODE = 2 XML_TEXT_NODE = 3 XML_CDATA_SECTION_NODE = 4 XML_ENTITY_REF_NODE = 5 XML_ENTITY_NODE = 6 XML_PI_NODE = 7 XML_COMMENT_NODE = 8 XML_DOCUMENT_NODE = 9 XML_DOCUMENT_TYPE_NODE = 10 XML_DOCUMENT_FRAG_NODE = 11 XML_NOTATION_NODE = 12 XML_HTML_DOCUMENT_NODE = 13 XML_DTD_NODE = 14 XML_ELEMENT_DECL = 15 XML_ATTRIBUTE_DECL = 16 XML_ENTITY_DECL = 17 XML_NAMESPACE_DECL = 18 XML_XINCLUDE_START = 19 XML_XINCLUDE_END = 20 XML_DOCB_DOCUMENT_NODE = 21 };
enum xmlElementTypeVal { XML_ELEMENT_TYPE_UNDEFINED = 0 XML_ELEMENT_TYPE_EMPTY = 1 XML_ELEMENT_TYPE_ANY = 2 XML_ELEMENT_TYPE_MIXED = 3 XML_ELEMENT_TYPE_ELEMENT = 4 };
struct _xmlEntity {
void * _private : application data
xmlElementType type : XML_ENTITY_DECL, must be second !
const xmlChar * name : Entity name
struct _xmlNode * children : First child link
struct _xmlNode * last : Last child link
struct _xmlDtd * parent : -> DTD
struct _xmlNode * next : next sibling link
struct _xmlNode * prev : previous sibling link
struct _xmlDoc * doc : the containing document
xmlChar * orig : content without ref substitution
xmlChar * content : content or ndata if unparsed
int length : the content length
xmlEntityType etype : The entity type
const xmlChar * ExternalID : External identifier for PUBLIC
const xmlChar * SystemID : URI for a SYSTEM or PUBLIC Entity
struct _xmlEntity * nexte : unused
const xmlChar * URI : the full URI as computed
int owner : does the entity own the childrens
int checked : was the entity content checked this is also used to count entities *
} xmlEntity;
struct _xmlEnumeration {
struct _xmlEnumeration * next : next one
const xmlChar * name : Enumeration name
} xmlEnumeration;
xmlEnumeration * xmlEnumerationPtr;
struct _xmlID {
struct _xmlID * next : next ID
const xmlChar * value : The ID name
xmlAttrPtr attr : The attribute holding it
const xmlChar * name : The attribute if attr is not available
int lineno : The line number if attr is not available
struct _xmlDoc * doc : The document holding the ID
} xmlID;
struct _xmlNode {
void * _private : application data
xmlElementType type : type number, must be second !
const xmlChar * name : the name of the node, or the entity
struct _xmlNode * children : parent->childs link
struct _xmlNode * last : last child link
struct _xmlNode * parent : child->parent link
struct _xmlNode * next : next sibling link
struct _xmlNode * prev : previous sibling link
struct _xmlDoc * doc : the containing document End of common part
xmlNs * ns : pointer to the associated namespace
xmlChar * content : the content
struct _xmlAttr * properties : properties list
xmlNs * nsDef : namespace definitions on this node
void * psvi : for type/PSVI informations
unsigned short line : line number
unsigned short extra : extra data for XPath/XSLT
} xmlNode;
struct _xmlNotation {
const xmlChar * name : Notation name
const xmlChar * PublicID : Public identifier, if any
const xmlChar * SystemID : System identifier, if any
} xmlNotation;
xmlNotation * xmlNotationPtr;
struct _xmlNs {
struct _xmlNs * next : next Ns link for this node
xmlNsType type : global or local
const xmlChar * href : URL for the namespace
const xmlChar * prefix : prefix for the namespace
void * _private : application data
struct _xmlDoc * context : normally an xmlDoc
} xmlNs;
xmlElementType xmlNsType;
struct _xmlOutputBuffer {
void * context
xmlOutputWriteCallback writecallback
xmlOutputCloseCallback closecallback
xmlCharEncodingHandlerPtr encoder : I18N conversions to UTF-8
xmlBufPtr buffer : Local buffer encoded in UTF-8 or ISOLatin
xmlBufPtr conv : if encoder != NULL buffer for output
int written : total number of byte written
int error
} xmlOutputBuffer;
xmlOutputBuffer * xmlOutputBufferPtr;
struct _xmlParserCtxt {
struct _xmlSAXHandler * sax : The SAX handler
void * userData : For SAX interface only, used by DOM build
xmlDocPtr myDoc : the document being built
int wellFormed : is the document well formed
int replaceEntities : shall we replace entities ?
const xmlChar * version : the XML version string
const xmlChar * encoding : the declared encoding, if any
int standalone : standalone document
int html : an HTML(1)/Docbook(2) document * 3 is HTML after <head> * 10 is HTML
xmlParserInputPtr input : Current input stream
int inputNr : Number of current input streams
int inputMax : Max number of input streams
xmlParserInputPtr * inputTab : stack of inputs Node analysis stack only used for DOM building
xmlNodePtr node : Current parsed Node
int nodeNr : Depth of the parsing stack
int nodeMax : Max depth of the parsing stack
xmlNodePtr * nodeTab : array of nodes
int record_info : Whether node info should be kept
xmlParserNodeInfoSeq node_seq : info about each node parsed
int errNo : error code
int hasExternalSubset : reference and external subset
int hasPErefs : the internal subset has PE refs
int external : are we parsing an external entity
int valid : is the document valid
int validate : shall we try to validate ?
xmlValidCtxt vctxt : The validity context
xmlParserInputState instate : current type of input
int token : next char look-ahead
char * directory : the data directory Node name stack
const xmlChar * name : Current parsed Node
int nameNr : Depth of the parsing stack
int nameMax : Max depth of the parsing stack
const xmlChar * * nameTab : array of nodes
long nbChars : number of xmlChar processed
long checkIndex : used by progressive parsing lookup
int keepBlanks : ugly but ...
int disableSAX : SAX callbacks are disabled
int inSubset : Parsing is in int 1/ext 2 subset
const xmlChar * intSubName : name of subset
xmlChar * extSubURI : URI of external subset
xmlChar * extSubSystem : SYSTEM ID of external subset xml:space values
int * space : Should the parser preserve spaces
int spaceNr : Depth of the parsing stack
int spaceMax : Max depth of the parsing stack
int * spaceTab : array of space infos
int depth : to prevent entity substitution loops
xmlParserInputPtr entity : used to check entities boundaries
int charset : encoding of the in-memory content actually an xmlCharEncoding
int nodelen : Those two fields are there to
int nodemem : Speed up large node parsing
int pedantic : signal pedantic warnings
void * _private : For user data, libxml won't touch it
int loadsubset : should the external subset be loaded
int linenumbers : set line number in element content
void * catalogs : document's own catalog
int recovery : run in recovery mode
int progressive : is this a progressive parsing
xmlDictPtr dict : dictionary for the parser
const xmlChar * * atts : array for the attributes callbacks
int maxatts : the size of the array
int docdict : * pre-interned strings *
const xmlChar * str_xml
const xmlChar * str_xmlns
const xmlChar * str_xml_ns : * Everything below is used only by the new SAX mode *
int sax2 : operating in the new SAX mode
int nsNr : the number of inherited namespaces
int nsMax : the size of the arrays
const xmlChar * * nsTab : the array of prefix/namespace name
int * attallocs : which attribute were allocated
void * * pushTab : array of data for push
xmlHashTablePtr attsDefault : defaulted attributes if any
xmlHashTablePtr attsSpecial : non-CDATA attributes if any
int nsWellFormed : is the document XML Nanespace okay
int options : * Those fields are needed only for treaming parsing so far *
int dictNames : Use dictionary names for the tree
int freeElemsNr : number of freed element nodes
xmlNodePtr freeElems : List of freed element nodes
int freeAttrsNr : number of freed attributes nodes
xmlAttrPtr freeAttrs : * the complete error informations for the last error. *
xmlError lastError
xmlParserMode parseMode : the parser mode
unsigned long nbentities : number of entities references
unsigned long sizeentities : size of parsed entities for use by HTML non-recursive parser
xmlParserNodeInfo * nodeInfo : Current NodeInfo
int nodeInfoNr : Depth of the parsing stack
int nodeInfoMax : Max depth of the parsing stack
xmlParserNodeInfo * nodeInfoTab : array of nodeInfos
int input_id : we need to label inputs
unsigned long sizeentcopy : volume of entity copy
} xmlParserCtxt;
xmlParserCtxt * xmlParserCtxtPtr;
struct _xmlParserInput {
xmlParserInputBufferPtr buf : UTF-8 encoded buffer
const char * filename : The file analyzed, if any
const char * directory : the directory/base of the file
const xmlChar * base : Base of the array to parse
const xmlChar * cur : Current char being parsed
const xmlChar * end : end of the array to parse
int length : length if known
int line : Current line
int col : * NOTE: consumed is only tested for equality in the parser code, *
unsigned long consumed : How many xmlChars already consumed
xmlParserInputDeallocate free : function to deallocate the base
const xmlChar * encoding : the encoding string for entity
const xmlChar * version : the version string for entity
int standalone : Was that entity marked standalone
int id : an unique identifier for the entity
} xmlParserInput;
struct _xmlParserInputBuffer {
void * context
xmlInputReadCallback readcallback
xmlInputCloseCallback closecallback
xmlCharEncodingHandlerPtr encoder : I18N conversions to UTF-8
xmlBufPtr buffer : Local buffer encoded in UTF-8
xmlBufPtr raw : if encoder != NULL buffer for raw input
int compressed : -1=unknown, 0=not compressed, 1=compressed
int error
unsigned long rawconsumed : amount consumed from raw
} xmlParserInputBuffer;
xmlParserInputBuffer * xmlParserInputBufferPtr;
xmlParserInput * xmlParserInputPtr;
struct _xmlRef {
struct _xmlRef * next : next Ref
const xmlChar * value : The Ref name
xmlAttrPtr attr : The attribute holding it
const xmlChar * name : The attribute if attr is not available
int lineno : The line number if attr is not available
} xmlRef;
struct _xmlSAXHandler {
internalSubsetSAXFunc internalSubset
isStandaloneSAXFunc isStandalone
hasInternalSubsetSAXFunc hasInternalSubset
hasExternalSubsetSAXFunc hasExternalSubset
resolveEntitySAXFunc resolveEntity
getEntitySAXFunc getEntity
entityDeclSAXFunc entityDecl
notationDeclSAXFunc notationDecl
attributeDeclSAXFunc attributeDecl
elementDeclSAXFunc elementDecl
unparsedEntityDeclSAXFunc unparsedEntityDecl
setDocumentLocatorSAXFunc setDocumentLocator
startDocumentSAXFunc startDocument
endDocumentSAXFunc endDocument
startElementSAXFunc startElement
endElementSAXFunc endElement
referenceSAXFunc reference
charactersSAXFunc characters
ignorableWhitespaceSAXFunc ignorableWhitespace
processingInstructionSAXFunc processingInstruction
commentSAXFunc comment
warningSAXFunc warning
errorSAXFunc error
fatalErrorSAXFunc fatalError : unused error() get all the errors
getParameterEntitySAXFunc getParameterEntity
cdataBlockSAXFunc cdataBlock
externalSubsetSAXFunc externalSubset
unsigned int initialized : The following fields are extensions available only on version 2
void * _private
startElementNsSAX2Func startElementNs
endElementNsSAX2Func endElementNs
xmlStructuredErrorFunc serror
} xmlSAXHandler;
xmlSAXHandler * xmlSAXHandlerPtr;
struct _xmlSAXLocator {
const xmlChar *(*getPublicId) getPublicId
const xmlChar *(*getSystemId) getSystemId
int(*getLineNumber) getLineNumber
int(*getColumnNumber) getColumnNumber
} xmlSAXLocator;
xmlSAXLocator * xmlSAXLocatorPtr;
xmlNsPtr xmlDOMWrapAcquireNsFunction (xmlDOMWrapCtxtPtr ctxt,
xmlNodePtr node,
const xmlChar * nsName,
const xmlChar * nsPrefix)
A function called to acquire namespaces (xmlNs) from the wrapper.
| ctxt: | a DOM wrapper context |
| node: | the context node (element or attribute) |
| nsName: | the requested namespace name |
| nsPrefix: | the requested namespace prefix |
| Returns: | an xmlNsPtr or NULL in case of an error. |
xmlNodePtr xmlAddChild (xmlNodePtr parent,
xmlNodePtr cur)
Add a new node to @parent, at the end of the child (or property) list merging adjacent TEXT nodes (in which case @cur is freed) If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an attribute with equal name, it is first destroyed.
| parent: | the parent node |
| cur: | the child node |
| Returns: | the child or NULL in case of error. |
xmlNodePtr xmlAddChildList (xmlNodePtr parent,
xmlNodePtr cur)
Add a list of node at the end of the child list of the parent merging adjacent TEXT nodes (@cur may be freed)
| parent: | the parent node |
| cur: | the first node in the list |
| Returns: | the last child or NULL in case of error. |
xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
xmlNodePtr elem)
Add a new node @elem as the next sibling of @cur If the new node was already inserted in a document it is first unlinked from its existing context. As a result of text merging @elem may be freed. If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an attribute with equal name, it is first destroyed.
| cur: | the child node |
| elem: | the new node |
| Returns: | the new node or NULL in case of error. |
xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
xmlNodePtr elem)
Add a new node @elem as the previous sibling of @cur merging adjacent TEXT nodes (@elem may be freed) If the new node was already inserted in a document it is first unlinked from its existing context. If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an attribute with equal name, it is first destroyed.
| cur: | the child node |
| elem: | the new node |
| Returns: | the new node or NULL in case of error. |
xmlNodePtr xmlAddSibling (xmlNodePtr cur,
xmlNodePtr elem)
Add a new element @elem to the list of siblings of @cur merging adjacent TEXT nodes (@elem may be freed) If the new element was already inserted in a document it is first unlinked from its existing context.
| cur: | the child node |
| elem: | the new node |
| Returns: | the new element or NULL in case of error. |
void xmlAttrSerializeTxtContent (xmlBufferPtr buf,
xmlDocPtr doc,
xmlAttrPtr attr,
const xmlChar * string)
Serialize text attribute values to an xml simple buffer
| buf: | the XML buffer output |
| doc: | the document |
| attr: | the attribute node |
| string: | the text content |
xmlChar * xmlBufContent (const xmlBuf * buf)
Function to extract the content of a buffer
| buf: | the buffer |
| Returns: | the internal content |
xmlChar * xmlBufEnd (xmlBufPtr buf)
Function to extract the end of the content of a buffer
| buf: | the buffer |
| Returns: | the end of the internal content or NULL in case of error |
int xmlBufGetNodeContent (xmlBufPtr buf,
const xmlNode * cur)
Read the value of a node @cur, this can be either the text carried directly by this node if it's a TEXT node or the aggregate string of the values carried by this node child's (TEXT and ENTITY_REF). Entity references are substituted. Fills up the buffer @buf with this value
| buf: | a buffer xmlBufPtr |
| cur: | the node being read |
| Returns: | 0 in case of success and -1 in case of error. |
size_t xmlBufNodeDump (xmlBufPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format)
Dump an XML node, recursive behaviour,children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
| buf: | the XML buffer output |
| doc: | the document |
| cur: | the current node |
| level: | the imbrication level for indenting |
| format: | is formatting allowed |
| Returns: | the number of bytes written to the buffer, in case of error 0 is returned or @buf stores the error |
size_t xmlBufShrink (xmlBufPtr buf,
size_t len)
Remove the beginning of an XML buffer. NOTE that this routine behaviour differs from xmlBufferShrink() as it will return 0 on error instead of -1 due to size_t being used as the return type.
| buf: | the buffer to dump |
| len: | the number of xmlChar to remove |
| Returns: | the number of byte removed or 0 in case of failure |
size_t xmlBufUse (const xmlBufPtr buf)
Function to get the length of a buffer
| buf: | the buffer |
| Returns: | the length of data in the internal content |
int xmlBufferAdd (xmlBufferPtr buf,
const xmlChar * str,
int len)
Add a string range to an XML buffer. if len == -1, the length of str is recomputed.
| buf: | the buffer to dump |
| str: | the #xmlChar string |
| len: | the number of #xmlChar to add |
| Returns: | 0 successful, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlBufferAddHead (xmlBufferPtr buf,
const xmlChar * str,
int len)
Add a string range to the beginning of an XML buffer. if len == -1, the length of @str is recomputed.
| buf: | the buffer |
| str: | the #xmlChar string |
| len: | the number of #xmlChar to add |
| Returns: | 0 successful, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlBufferCCat (xmlBufferPtr buf,
const char * str)
Append a zero terminated C string to an XML buffer.
| buf: | the buffer to dump |
| str: | the C char string |
| Returns: | 0 successful, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlBufferCat (xmlBufferPtr buf,
const xmlChar * str)
Append a zero terminated string to an XML buffer.
| buf: | the buffer to add to |
| str: | the #xmlChar string |
| Returns: | 0 successful, a positive error code number otherwise and -1 in case of internal or API error. |
const xmlChar * xmlBufferContent (const xmlBuffer * buf)
Function to extract the content of a buffer
| buf: | the buffer |
| Returns: | the internal content |
xmlBufferPtr xmlBufferCreate (void)
routine to create an XML buffer.
| Returns: | the new structure. |
xmlBufferPtr xmlBufferCreateSize (size_t size)
routine to create an XML buffer.
| size: | initial size of buffer |
| Returns: | the new structure. |
xmlBufferPtr xmlBufferCreateStatic (void * mem,
size_t size)
routine to create an XML buffer from an immutable memory area. The area won't be modified nor copied, and is expected to be present until the end of the buffer lifetime.
| mem: | the memory area |
| size: | the size in byte |
| Returns: | the new structure. |
xmlChar * xmlBufferDetach (xmlBufferPtr buf)
Remove the string contained in a buffer and gie it back to the caller. The buffer is reset to an empty content. This doesn't work with immutable buffers as they can't be reset.
| buf: | the buffer |
| Returns: | the previous string contained by the buffer. |
int xmlBufferDump (FILE * file,
xmlBufferPtr buf)
Dumps an XML buffer to a FILE *.
| file: | the file output |
| buf: | the buffer to dump |
| Returns: | the number of #xmlChar written |
void xmlBufferFree (xmlBufferPtr buf)
Frees an XML buffer. It frees both the content and the structure which encapsulate it.
| buf: | the buffer to free |
int xmlBufferGrow (xmlBufferPtr buf,
unsigned int len)
Grow the available space of an XML buffer.
| buf: | the buffer |
| len: | the minimum free size to allocate |
| Returns: | the new available space or -1 in case of error |
int xmlBufferLength (const xmlBuffer * buf)
Function to get the length of a buffer
| buf: | the buffer |
| Returns: | the length of data in the internal content |
int xmlBufferResize (xmlBufferPtr buf,
unsigned int size)
Resize a buffer to accommodate minimum size of @size.
| buf: | the buffer to resize |
| size: | the desired size |
| Returns: | 0 in case of problems, 1 otherwise |
void xmlBufferSetAllocationScheme (xmlBufferPtr buf,
xmlBufferAllocationScheme scheme)
Sets the allocation scheme for this buffer
| buf: | the buffer to tune |
| scheme: | allocation scheme to use |
int xmlBufferShrink (xmlBufferPtr buf,
unsigned int len)
Remove the beginning of an XML buffer.
| buf: | the buffer to dump |
| len: | the number of xmlChar to remove |
| Returns: | the number of #xmlChar removed, or -1 in case of failure. |
void xmlBufferWriteCHAR (xmlBufferPtr buf,
const xmlChar * string)
routine which manages and grows an output buffer. This one adds xmlChars at the end of the buffer.
| buf: | the XML buffer |
| string: | the string to add |
void xmlBufferWriteChar (xmlBufferPtr buf,
const char * string)
routine which manage and grows an output buffer. This one add C chars at the end of the array.
| buf: | the XML buffer output |
| string: | the string to add |
void xmlBufferWriteQuotedString (xmlBufferPtr buf,
const xmlChar * string)
routine which manage and grows an output buffer. This one writes a quoted or double quoted #xmlChar string, checking first if it holds quote or double-quotes internally
| buf: | the XML buffer output |
| string: | the string to add |
xmlChar * xmlBuildQName (const xmlChar * ncname,
const xmlChar * prefix,
xmlChar * memory,
int len)
Builds the QName @prefix:@ncname in @memory if there is enough space and prefix is not NULL nor empty, otherwise allocate a new string. If prefix is NULL or empty it returns ncname.
| ncname: | the Name |
| prefix: | the prefix |
| memory: | preallocated memory |
| len: | preallocated memory length |
| Returns: | the new string which must be freed by the caller if different from @memory and @ncname or NULL in case of error |
unsigned long xmlChildElementCount (xmlNodePtr parent)
Finds the current number of child nodes of that element which are element nodes. Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content to entities references.
| parent: | the parent node |
| Returns: | the count of element child or 0 if not available |
xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
int recursive)
Do a copy of the document info. If recursive, the content tree will be copied too as well as DTD, namespaces and entities.
| doc: | the document |
| recursive: | if not zero do a recursive copy. |
| Returns: | a new #xmlDocPtr, or NULL in case of error. |
xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd)
Do a copy of the dtd.
| dtd: | the dtd |
| Returns: | a new #xmlDtdPtr, or NULL in case of error. |
xmlNsPtr xmlCopyNamespace (xmlNsPtr cur)
Do a copy of the namespace.
| cur: | the namespace |
| Returns: | a new #xmlNsPtr, or NULL in case of error. |
xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur)
Do a copy of an namespace list.
| cur: | the first namespace |
| Returns: | a new #xmlNsPtr, or NULL in case of error. |
xmlNodePtr xmlCopyNode (xmlNodePtr node,
int extended)
Do a copy of the node.
| node: | the node |
| extended: | if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) |
| Returns: | a new #xmlNodePtr, or NULL in case of error. |
xmlNodePtr xmlCopyNodeList (xmlNodePtr node)
Do a recursive copy of the node list. Use xmlDocCopyNodeList() if possible to ensure string interning.
| node: | the first node in the list. |
| Returns: | a new #xmlNodePtr, or NULL in case of error. |
xmlAttrPtr xmlCopyProp (xmlNodePtr target,
xmlAttrPtr cur)
Do a copy of the attribute.
xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
xmlAttrPtr cur)
Do a copy of an attribute list.
| target: | the element where the attributes will be grafted |
| cur: | the first attribute |
| Returns: | a new #xmlAttrPtr, or NULL in case of error. |
xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID)
Create the internal subset of a document
| doc: | the document pointer |
| name: | the DTD name |
| ExternalID: | the external (PUBLIC) ID |
| SystemID: | the system ID |
| Returns: | a pointer to the new DTD structure |
int xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr sourceDoc,
xmlNodePtr node,
xmlDocPtr destDoc,
xmlNodePtr destParent,
int options)
References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unlinked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. NOTE: This function was not intensively tested.
| ctxt: | the optional context for custom processing |
| sourceDoc: | the optional sourceDoc |
| node: | the node to start with |
| destDoc: | the destination doc |
| destParent: | the optional new parent of @node in @destDoc |
| options: | option flags |
| Returns: | 0 if the operation succeeded, 1 if a node of unsupported type was given, 2 if a node of not yet supported type was given and -1 on API/internal errors. |
int xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr sourceDoc,
xmlNodePtr node,
xmlNodePtr * resNode,
xmlDocPtr destDoc,
xmlNodePtr destParent,
int deep,
int options)
References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used. This is the case when you don't know already where the cloned branch will be added to. If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. TODO: 1) What to do with XInclude? Currently this returns an error for XInclude.
| ctxt: | the optional context for custom processing |
| sourceDoc: | the optional sourceDoc |
| node: | the node to start with |
| resNode: | the clone of the given @node |
| destDoc: | the destination doc |
| destParent: | the optional new parent of @node in @destDoc |
| deep: | descend into child if set |
| options: | option flags |
| Returns: | 0 if the operation succeeded, 1 if a node of unsupported (or not yet supported) type was given, -1 on API/internal errors. |
void xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt)
Frees the DOM-wrapper context.
| ctxt: | the DOM-wrapper context |
xmlDOMWrapCtxtPtr xmlDOMWrapNewCtxt (void)
Allocates and initializes a new DOM-wrapper context.
| Returns: | the xmlDOMWrapCtxtPtr or NULL in case of an internal error. |
int xmlDOMWrapReconcileNamespaces (xmlDOMWrapCtxtPtr ctxt,
xmlNodePtr elem,
int options)
Ensures that ns-references point to ns-decls hold on element-nodes. Ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. NOTE: This function was not intensively tested.
| ctxt: | DOM wrapper context, unused at the moment |
| elem: | the element-node |
| options: | option flags |
| Returns: | 0 if succeeded, -1 otherwise and on API/internal errors. |
int xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr node,
int options)
Unlinks the given node from its owner. This will substitute ns-references to node->nsDef for ns-references to doc->oldNs, thus ensuring the removed branch to be autark wrt ns-references. NOTE: This function was not intensively tested.
| ctxt: | a DOM wrapper context |
| doc: | the doc |
| node: | the node to be removed. |
| options: | set of options, unused at the moment |
| Returns: | 0 on success, 1 if the node is not supported, -1 on API and internal errors. |
xmlNodePtr xmlDocCopyNode (xmlNodePtr node,
xmlDocPtr doc,
int extended)
Do a copy of the node to a given document.
| node: | the node |
| doc: | the document |
| extended: | if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) |
| Returns: | a new #xmlNodePtr, or NULL in case of error. |
xmlNodePtr xmlDocCopyNodeList (xmlDocPtr doc,
xmlNodePtr node)
Do a recursive copy of the node list.
| doc: | the target document |
| node: | the first node in the list. |
| Returns: | a new #xmlNodePtr, or NULL in case of error. |
int xmlDocDump (FILE * f,
xmlDocPtr cur)
Dump an XML document to an open FILE.
| f: | the FILE* |
| cur: | the document |
| Returns: | the number of bytes written or -1 in case of failure. |
void xmlDocDumpFormatMemory (xmlDocPtr cur,
xmlChar ** mem,
int * size,
int format)
Dump an XML document in memory and return the #xmlChar * and it's size. It's up to the caller to free the memory with xmlFree(). Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
| cur: | the document |
| mem: | OUT: the memory pointer |
| size: | OUT: the memory length |
| format: | should formatting spaces been added |
void xmlDocDumpFormatMemoryEnc (xmlDocPtr out_doc,
xmlChar ** doc_txt_ptr,
int * doc_txt_len,
const char * txt_encoding,
int format)
Dump the current DOM tree into memory using the character encoding specified by the caller. Note it is up to the caller of this function to free the allocated memory with xmlFree(). Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
| out_doc: | Document to generate XML text from |
| doc_txt_ptr: | Memory pointer for allocated XML text |
| doc_txt_len: | Length of the generated XML text |
| txt_encoding: | Character encoding to use when generating XML text |
| format: | should formatting spaces been added |
void xmlDocDumpMemory (xmlDocPtr cur,
xmlChar ** mem,
int * size)
Dump an XML document in memory and return the #xmlChar * and it's size in bytes. It's up to the caller to free the memory with xmlFree(). The resulting byte array is zero terminated, though the last 0 is not included in the returned size.
| cur: | the document |
| mem: | OUT: the memory pointer |
| size: | OUT: the memory length |
void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
xmlChar ** doc_txt_ptr,
int * doc_txt_len,
const char * txt_encoding)
Dump the current DOM tree into memory using the character encoding specified by the caller. Note it is up to the caller of this function to free the allocated memory with xmlFree().
| out_doc: | Document to generate XML text from |
| doc_txt_ptr: | Memory pointer for allocated XML text |
| doc_txt_len: | Length of the generated XML text |
| txt_encoding: | Character encoding to use when generating XML text |
int xmlDocFormatDump (FILE * f,
xmlDocPtr cur,
int format)
Dump an XML document to an open FILE.
| f: | the FILE* |
| cur: | the document |
| format: | should formatting spaces been added |
| Returns: | the number of bytes written or -1 in case of failure. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called |
xmlNodePtr xmlDocGetRootElement (const xmlDoc * doc)
Get the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...).
| doc: | the document |
| Returns: | the #xmlNodePtr for the root or NULL |
xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
xmlNodePtr root)
Set the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...).
| doc: | the document |
| root: | the new document root element, if root is NULL no action is taken, to remove a node from a document use xmlUnlinkNode(root) instead. |
| Returns: | the old root element if any was found, NULL if root was NULL |
void xmlElemDump (FILE * f,
xmlDocPtr doc,
xmlNodePtr cur)
Dump an XML/HTML node, recursive behaviour, children are printed too.
| f: | the FILE * for the output |
| doc: | the document |
| cur: | the current node |
xmlNodePtr xmlFirstElementChild (xmlNodePtr parent)
Finds the first child node of that element which is a Element node Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content to entities references.
| parent: | the parent node |
| Returns: | the first element child or NULL if not available |
void xmlFreeDoc (xmlDocPtr cur)
Free up all the structures used by a document, tree included.
| cur: | pointer to the document |
void xmlFreeNode (xmlNodePtr cur)
Free a node, this is a recursive behaviour, all the children are freed too. This doesn't unlink the child from the list, use xmlUnlinkNode() first.
| cur: | the node |
void xmlFreeNodeList (xmlNodePtr cur)
Free a node and all its siblings, this is a recursive behaviour, all the children are freed too.
| cur: | the first node in the list |
void xmlFreeNs (xmlNsPtr cur)
Free up the structures associated to a namespace
| cur: | the namespace pointer |
void xmlFreeNsList (xmlNsPtr cur)
Free up all the structures associated to the chained namespaces.
| cur: | the first namespace pointer |
void xmlFreeProp (xmlAttrPtr cur)
Free one attribute, all the content is freed too
| cur: | an attribute |
void xmlFreePropList (xmlAttrPtr cur)
Free a property and all its siblings, all the children are freed too.
| cur: | the first property in the list |
xmlBufferAllocationScheme xmlGetBufferAllocationScheme (void)
Types are XML_BUFFER_ALLOC_EXACT - use exact sizes, keeps memory usage down XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed, improves performance XML_BUFFER_ALLOC_HYBRID - use exact sizes on small strings to keep memory usage tight in normal usage, and doubleit on large strings to avoid pathological performance.
| Returns: | the current allocation scheme |
int xmlGetCompressMode (void)
get the default compression mode used, ZLIB based.
| Returns: | 0 (uncompressed) to 9 (max compression) |
int xmlGetDocCompressMode (const xmlDoc * doc)
get the compression ratio for a document, ZLIB based
| doc: | the document |
| Returns: | 0 (uncompressed) to 9 (max compression) |
xmlDtdPtr xmlGetIntSubset (const xmlDoc * doc)
Get the internal subset of a document
| doc: | the document pointer |
| Returns: | a pointer to the DTD structure or NULL if not found |
xmlNodePtr xmlGetLastChild (const xmlNode * parent)
Search the last child of a node.
| parent: | the parent node |
| Returns: | the last child or NULL if none. |
long xmlGetLineNo (const xmlNode * node)
Get line number of @node. Try to override the limitation of lines being store in 16 bits ints if XML_PARSE_BIG_LINES parser option was used
| node: | valid node |
| Returns: | the line number if successful, -1 otherwise |
xmlChar * xmlGetNoNsProp (const xmlNode * node,
const xmlChar * name)
Search and get the value of an attribute associated to a node This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off. This function is similar to xmlGetProp except it will accept only an attribute in no namespace.
xmlChar * xmlGetNodePath (const xmlNode * node)
Build a structure based Path for the given node
| node: | a node |
| Returns: | the new path or NULL in case of error. The caller must free the returned string |
xmlNsPtr * xmlGetNsList (const xmlDoc * doc,
const xmlNode * node)
Search all the namespace applying to a given element.
| doc: | the document |
| node: | the current node |
| Returns: | an NULL terminated array of all the #xmlNsPtr found that need to be freed by the caller or NULL if no namespace if defined |
xmlChar * xmlGetNsProp (const xmlNode * node,
const xmlChar * name,
const xmlChar * nameSpace)
Search and get the value of an attribute associated to a node This attribute has to be anchored in the namespace specified. This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off.
xmlChar * xmlGetProp (const xmlNode * node,
const xmlChar * name)
Search and get the value of an attribute associated to a node This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off. NOTE: this function acts independently of namespaces associated to the attribute. Use xmlGetNsProp() or xmlGetNoNsProp() for namespace aware processing.
xmlAttrPtr xmlHasNsProp (const xmlNode * node,
const xmlChar * name,
const xmlChar * nameSpace)
Search for an attribute associated to a node This attribute has to be anchored in the namespace specified. This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off. Note that a namespace of NULL indicates to use the default namespace.
xmlAttrPtr xmlHasProp (const xmlNode * node,
const xmlChar * name)
Search an attribute associated to a node This function also looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off.
int xmlIsBlankNode (const xmlNode * node)
Checks whether this node is an empty or whitespace only (and possibly ignorable) text-node.
| node: | the node |
| Returns: | 1 yes, 0 no |
int xmlIsXHTML (const xmlChar * systemID,
const xmlChar * publicID)
Try to find if the document correspond to an XHTML DTD
| systemID: | the system identifier |
| publicID: | the public identifier |
| Returns: | 1 if true, 0 if not and -1 in case of error |
xmlNodePtr xmlLastElementChild (xmlNodePtr parent)
Finds the last child node of that element which is a Element node Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content to entities references.
| parent: | the parent node |
| Returns: | the last element child or NULL if not available |
xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
const xmlChar * content,
int len)
Creation of a new node containing a CDATA block.
| doc: | the document |
| content: | the CDATA block content content |
| len: | the length of the block |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
const xmlChar * name)
Creation of a new character reference node.
| doc: | the document |
| name: | the char ref string, starting with # or "&# ... ;" |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewChild (xmlNodePtr parent,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content)
Creation of a new child element, added at the end of @parent children list. @ns and @content parameters are optional (NULL). If @ns is NULL, the newly created element inherits the namespace of @parent. If @content is non NULL, a child list containing the TEXTs and ENTITY_REFs node will be created. NOTE: @content is supposed to be a piece of XML CDATA, so it allows entity references. XML special chars must be escaped first by using xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should be used.
| parent: | the parent node |
| ns: | a namespace if any |
| name: | the name of the child |
| content: | the XML content of the child if any. |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewComment (const xmlChar * content)
Creation of a new node containing a comment.
| content: | the comment content |
| Returns: | a pointer to the new node object. |
xmlDocPtr xmlNewDoc (const xmlChar * version)
Creates a new XML document
| version: | xmlChar string giving the version of XML "1.0" |
| Returns: | a new document |
xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
const xmlChar * content)
Creation of a new node containing a comment within a document.
| doc: | the document |
| content: | the comment content |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewDocFragment (xmlDocPtr doc)
Creation of a new Fragment node.
| doc: | the document owning the fragment |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content)
Creation of a new node element within a document. @ns and @content are optional (NULL). NOTE: @content is supposed to be a piece of XML CDATA, so it allow entities references, but XML special chars need to be escaped first by using xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you don't need entities support.
| doc: | the document |
| ns: | namespace if any |
| name: | the node name |
| content: | the XML text content if any |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewDocNodeEatName (xmlDocPtr doc,
xmlNsPtr ns,
xmlChar * name,
const xmlChar * content)
Creation of a new node element within a document. @ns and @content are optional (NULL). NOTE: @content is supposed to be a piece of XML CDATA, so it allow entities references, but XML special chars need to be escaped first by using xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you don't need entities support.
| doc: | the document |
| ns: | namespace if any |
| name: | the node name |
| content: | the XML text content if any |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewDocPI (xmlDocPtr doc,
const xmlChar * name,
const xmlChar * content)
Creation of a processing instruction element.
| doc: | the target document |
| name: | the processing instruction name |
| content: | the PI content |
| Returns: | a pointer to the new node object. |
xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
const xmlChar * name,
const xmlChar * value)
Create a new property carried by a document.
xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content)
Creation of a new node element within a document. @ns and @content are optional (NULL).
| doc: | the document |
| ns: | namespace if any |
| name: | the node name |
| content: | the text content if any |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewDocText (const xmlDoc * doc,
const xmlChar * content)
Creation of a new text node within a document.
| doc: | the document |
| content: | the text content |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
const xmlChar * content,
int len)
Creation of a new text node with an extra content length parameter. The text node pertain to a given document.
| doc: | the document |
| content: | the text content |
| len: | the text len. |
| Returns: | a pointer to the new node object. |
xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID)
Creation of a new DTD for the external subset. To create an internal subset, use xmlCreateIntSubset().
| doc: | the document pointer |
| name: | the DTD name |
| ExternalID: | the external ID |
| SystemID: | the system ID |
| Returns: | a pointer to the new DTD structure |
xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
const xmlChar * href,
const xmlChar * prefix)
Creation of a Namespace, the old way using PI and without scoping DEPRECATED !!!
| doc: | the document carrying the namespace |
| href: | the URI associated |
| prefix: | the prefix for the namespace |
| Returns: | NULL this functionality had been removed |
xmlNodePtr xmlNewNode (xmlNsPtr ns,
const xmlChar * name)
Creation of a new node element. @ns is optional (NULL).
| ns: | namespace if any |
| name: | the node name |
| Returns: | a pointer to the new node object. Uses xmlStrdup() to make copy of @name. |
xmlNodePtr xmlNewNodeEatName (xmlNsPtr ns,
xmlChar * name)
Creation of a new node element. @ns is optional (NULL).
| ns: | namespace if any |
| name: | the node name |
| Returns: | a pointer to the new node object, with pointer @name as new node's name. Use xmlNewNode() if a copy of @name string is is needed as new node's name. |
xmlNsPtr xmlNewNs (xmlNodePtr node,
const xmlChar * href,
const xmlChar * prefix)
Creation of a new Namespace. This function will refuse to create a namespace with a similar prefix than an existing one present on this node. Note that for a default namespace, @prefix should be NULL. We use href==NULL in the case of an element creation where the namespace was not defined.
| node: | the element carrying the namespace |
| href: | the URI associated |
| prefix: | the prefix for the namespace |
| Returns: | a new namespace pointer or NULL |
xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * value)
Create a new property tagged with a namespace and carried by a node.
xmlAttrPtr xmlNewNsPropEatName (xmlNodePtr node,
xmlNsPtr ns,
xmlChar * name,
const xmlChar * value)
Create a new property tagged with a namespace and carried by a node.
xmlNodePtr xmlNewPI (const xmlChar * name,
const xmlChar * content)
Creation of a processing instruction element. Use xmlDocNewPI preferably to get string interning
| name: | the processing instruction name |
| content: | the PI content |
| Returns: | a pointer to the new node object. |
xmlAttrPtr xmlNewProp (xmlNodePtr node,
const xmlChar * name,
const xmlChar * value)
Create a new property carried by a node.
xmlNodePtr xmlNewReference (const xmlDoc * doc,
const xmlChar * name)
Creation of a new reference node.
xmlNodePtr xmlNewText (const xmlChar * content)
Creation of a new text node.
| content: | the text content |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content)
Creation of a new child element, added at the end of @parent children list. @ns and @content parameters are optional (NULL). If @ns is NULL, the newly created element inherits the namespace of @parent. If @content is non NULL, a child TEXT node will be created containing the string @content. NOTE: Use xmlNewChild() if @content will contain entities that need to be preserved. Use this function, xmlNewTextChild(), if you need to ensure that reserved XML chars that might appear in @content, such as the ampersand, greater-than or less-than signs, are automatically replaced by their XML escaped entity representations.
| parent: | the parent node |
| ns: | a namespace if any |
| name: | the name of the child |
| content: | the text content of the child if any. |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNewTextLen (const xmlChar * content,
int len)
Creation of a new text node with an extra parameter for the content's length
| content: | the text content |
| len: | the text len. |
| Returns: | a pointer to the new node object. |
xmlNodePtr xmlNextElementSibling (xmlNodePtr node)
Finds the first closest next sibling of the node which is an element node. Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content to entities references.
| node: | the current node |
| Returns: | the next element sibling or NULL if not available |
void xmlNodeAddContent (xmlNodePtr cur,
const xmlChar * content)
Append the extra substring to the node content. NOTE: In contrast to xmlNodeSetContent(), @content is supposed to be raw text, so unescaped XML special chars are allowed, entity references are not supported.
| cur: | the node being modified |
| content: | extra content |
void xmlNodeAddContentLen (xmlNodePtr cur,
const xmlChar * content,
int len)
Append the extra substring to the node content. NOTE: In contrast to xmlNodeSetContentLen(), @content is supposed to be raw text, so unescaped XML special chars are allowed, entity references are not supported.
| cur: | the node being modified |
| content: | extra content |
| len: | the size of @content |
int xmlNodeBufGetContent (xmlBufferPtr buffer,
const xmlNode * cur)
Read the value of a node @cur, this can be either the text carried directly by this node if it's a TEXT node or the aggregate string of the values carried by this node child's (TEXT and ENTITY_REF). Entity references are substituted. Fills up the buffer @buffer with this value
| buffer: | a buffer |
| cur: | the node being read |
| Returns: | 0 in case of success and -1 in case of error. |
int xmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format)
Dump an XML node, recursive behaviour,children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called Since this is using xmlBuffer structures it is limited to 2GB and somehow deprecated, use xmlBufNodeDump() instead.
| buf: | the XML buffer output |
| doc: | the document |
| cur: | the current node |
| level: | the imbrication level for indenting |
| format: | is formatting allowed |
| Returns: | the number of bytes written to the buffer or -1 in case of error |
void xmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format,
const char * encoding)
Dump an XML node, recursive behaviour, children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
| buf: | the XML buffer output |
| doc: | the document |
| cur: | the current node |
| level: | the imbrication level for indenting |
| format: | is formatting allowed |
| encoding: | an optional encoding string |
xmlChar * xmlNodeGetBase (const xmlDoc * doc,
const xmlNode * cur)
Searches for the BASE URL. The code should work on both XML and HTML document even if base mechanisms are completely different. It returns the base as defined in RFC 2396 sections 5.1.1. Base URI within Document Content and 5.1.2. Base URI from the Encapsulating Entity However it does not return the document base (5.1.3), use doc->URL in this case
| doc: | the document the node pertains to |
| cur: | the node being checked |
| Returns: | a pointer to the base URL, or NULL if not found It's up to the caller to free the memory with xmlFree(). |
xmlChar * xmlNodeGetContent (const xmlNode * cur)
Read the value of a node, this can be either the text carried directly by this node if it's a TEXT node or the aggregate string of the values carried by this node child's (TEXT and ENTITY_REF). Entity references are substituted.
| cur: | the node being read |
| Returns: | a new #xmlChar * or NULL if no content is available. It's up to the caller to free the memory with xmlFree(). |
xmlChar * xmlNodeGetLang (const xmlNode * cur)
Searches the language of a node, i.e. the values of the xml:lang attribute or the one carried by the nearest ancestor.
| cur: | the node being checked |
| Returns: | a pointer to the lang value, or NULL if not found It's up to the caller to free the memory with xmlFree(). |
int xmlNodeGetSpacePreserve (const xmlNode * cur)
Searches the space preserving behaviour of a node, i.e. the values of the xml:space attribute or the one carried by the nearest ancestor.
| cur: | the node being checked |
| Returns: | -1 if xml:space is not inherited, 0 if "default", 1 if "preserve" |
int xmlNodeIsText (const xmlNode * node)
Is this node a Text node ?
| node: | the node |
| Returns: | 1 yes, 0 no |
xmlChar * xmlNodeListGetRawString (const xmlDoc * doc,
const xmlNode * list,
int inLine)
Builds the string equivalent to the text contained in the Node list made of TEXTs and ENTITY_REFs, contrary to xmlNodeListGetString() this function doesn't do any character encoding handling.
| doc: | the document |
| list: | a Node list |
| inLine: | should we replace entity contents or show their external form |
| Returns: | a pointer to the string copy, the caller must free it with xmlFree(). |
xmlChar * xmlNodeListGetString (xmlDocPtr doc,
const xmlNode * list,
int inLine)
Build the string equivalent to the text contained in the Node list made of TEXTs and ENTITY_REFs
| doc: | the document |
| list: | a Node list |
| inLine: | should we replace entity contents or show their external form |
| Returns: | a pointer to the string copy, the caller must free it with xmlFree(). |
void xmlNodeSetBase (xmlNodePtr cur,
const xmlChar * uri)
Set (or reset) the base URI of a node, i.e. the value of the xml:base attribute.
| cur: | the node being changed |
| uri: | the new base URI |
void xmlNodeSetContent (xmlNodePtr cur,
const xmlChar * content)
Replace the content of a node. NOTE: @content is supposed to be a piece of XML CDATA, so it allows entity references, but XML special chars need to be escaped first by using xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars().
| cur: | the node being modified |
| content: | the new value of the content |
void xmlNodeSetContentLen (xmlNodePtr cur,
const xmlChar * content,
int len)
Replace the content of a node. NOTE: @content is supposed to be a piece of XML CDATA, so it allows entity references, but XML special chars need to be escaped first by using xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars().
| cur: | the node being modified |
| content: | the new value of the content |
| len: | the size of @content |
void xmlNodeSetLang (xmlNodePtr cur,
const xmlChar * lang)
Set the language of a node, i.e. the values of the xml:lang attribute.
| cur: | the node being changed |
| lang: | the language description |
void xmlNodeSetName (xmlNodePtr cur,
const xmlChar * name)
Set (or reset) the name of a node.
| cur: | the node being changed |
| name: | the new tag name |
void xmlNodeSetSpacePreserve (xmlNodePtr cur,
int val)
Set (or reset) the space preserving behaviour of a node, i.e. the value of the xml:space attribute.
| cur: | the node being changed |
| val: | the xml:space value ("0": default, 1: "preserve") |
xmlNodePtr xmlPreviousElementSibling (xmlNodePtr node)
Finds the first closest previous sibling of the node which is an element node. Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content to entities references.
| node: | the current node |
| Returns: | the previous element sibling or NULL if not available |
int xmlReconciliateNs (xmlDocPtr doc,
xmlNodePtr tree)
This function checks that all the namespaces declared within the given tree are properly declared. This is needed for example after Copy or Cut and then paste operations. The subtree may still hold pointers to namespace declarations outside the subtree or invalid/masked. As much as possible the function try to reuse the existing namespaces found in the new environment. If not possible the new namespaces are redeclared on @tree at the top of the given subtree.
| doc: | the document |
| tree: | a node defining the subtree to reconciliate |
| Returns: | the number of namespace declarations created or -1 in case of error. |
int xmlRemoveProp (xmlAttrPtr cur)
Unlink and free one attribute, all the content is freed too Note this doesn't work for namespace definition attributes
| cur: | an attribute |
| Returns: | 0 if success and -1 in case of error. |
xmlNodePtr xmlReplaceNode (xmlNodePtr old,
xmlNodePtr cur)
Unlink the old node from its current context, prune the new one at the same place. If @cur was already inserted in a document it is first unlinked from its existing context.
| old: | the old node |
| cur: | the node |
| Returns: | the @old node |
int xmlSaveFile (const char * filename,
xmlDocPtr cur)
Dump an XML document to a file. Will use compression if compiled in and enabled. If @filename is "-" the stdout file is used.
| filename: | the filename (or URL) |
| cur: | the document |
| Returns: | the number of bytes written or -1 in case of failure. |
int xmlSaveFileEnc (const char * filename,
xmlDocPtr cur,
const char * encoding)
Dump an XML document, converting it to the given encoding
| filename: | the filename (or URL) |
| cur: | the document |
| encoding: | the name of an encoding (or NULL) |
| Returns: | the number of bytes written or -1 in case of failure. |
int xmlSaveFileTo (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding)
Dump an XML document to an I/O buffer. Warning ! This call xmlOutputBufferClose() on buf which is not available after this call.
| buf: | an output I/O buffer |
| cur: | the document |
| encoding: | the encoding if any assuming the I/O layer handles the trancoding |
| Returns: | the number of bytes written or -1 in case of failure. |
int xmlSaveFormatFile (const char * filename,
xmlDocPtr cur,
int format)
Dump an XML document to a file. Will use compression if compiled in and enabled. If @filename is "-" the stdout file is used. If @format is set then the document will be indented on output. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
| filename: | the filename (or URL) |
| cur: | the document |
| format: | should formatting spaces been added |
| Returns: | the number of bytes written or -1 in case of failure. |
int xmlSaveFormatFileEnc (const char * filename,
xmlDocPtr cur,
const char * encoding,
int format)
Dump an XML document to a file or an URL.
| filename: | the filename or URL to output |
| cur: | the document being saved |
| encoding: | the name of the encoding to use or NULL. |
| format: | should formatting spaces be added. |
| Returns: | the number of bytes written or -1 in case of error. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called |
int xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char * encoding,
int format)
Dump an XML document to an I/O buffer. Warning ! This call xmlOutputBufferClose() on buf which is not available after this call.
| buf: | an output I/O buffer |
| cur: | the document |
| encoding: | the encoding if any assuming the I/O layer handles the trancoding |
| format: | should formatting spaces been added |
| Returns: | the number of bytes written or -1 in case of failure. |
xmlNsPtr xmlSearchNs (xmlDocPtr doc,
xmlNodePtr node,
const xmlChar * nameSpace)
Search a Ns registered under a given name space for a document. recurse on the parents until it finds the defined namespace or return NULL otherwise. @nameSpace can be NULL, this is a search for the default namespace. We don't allow to cross entities boundaries. If you don't declare the namespace within those you will be in troubles !!! A warning is generated to cover this case.
| doc: | the document |
| node: | the current node |
| nameSpace: | the namespace prefix |
| Returns: | the namespace pointer or NULL. |
xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
xmlNodePtr node,
const xmlChar * href)
Search a Ns aliasing a given URI. Recurse on the parents until it finds the defined namespace or return NULL otherwise.
| doc: | the document |
| node: | the current node |
| href: | the namespace value |
| Returns: | the namespace pointer or NULL. |
void xmlSetBufferAllocationScheme (xmlBufferAllocationScheme scheme)
Set the buffer allocation method. Types are XML_BUFFER_ALLOC_EXACT - use exact sizes, keeps memory usage down XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed, improves performance
| scheme: | allocation method to use |
void xmlSetCompressMode (int mode)
set the default compression mode used, ZLIB based Correct values: 0 (uncompressed) to 9 (max compression)
| mode: | the compression ratio |
void xmlSetDocCompressMode (xmlDocPtr doc,
int mode)
set the compression ratio for a document, ZLIB based Correct values: 0 (uncompressed) to 9 (max compression)
| doc: | the document |
| mode: | the compression ratio |
void xmlSetListDoc (xmlNodePtr list,
xmlDocPtr doc)
update all nodes in the list to point to the right document
| list: | the first element |
| doc: | the document |
void xmlSetNs (xmlNodePtr node,
xmlNsPtr ns)
Associate a namespace to a node, a posteriori.
| node: | a node in the document |
| ns: | a namespace pointer |
xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * value)
Set (or reset) an attribute carried by a node. The ns structure must be in scope, this is not checked
xmlAttrPtr xmlSetProp (xmlNodePtr node,
const xmlChar * name,
const xmlChar * value)
Set (or reset) an attribute carried by a node. If @name has a prefix, then the corresponding namespace-binding will be used, if in scope; it is an error it there's no such ns-binding for the prefix in scope.
void xmlSetTreeDoc (xmlNodePtr tree,
xmlDocPtr doc)
update all nodes under the tree to point to the right document
| tree: | the top element |
| doc: | the document |
xmlChar * xmlSplitQName2 (const xmlChar * name,
xmlChar ** prefix)
parse an XML qualified name string [NS 5] QName ::= (Prefix ':')? LocalPart [NS 6] Prefix ::= NCName [NS 7] LocalPart ::= NCName
| name: | the full QName |
| prefix: | a xmlChar ** |
| Returns: | NULL if the name doesn't have a prefix. Otherwise, returns the local part, and prefix is updated to get the Prefix. Both the return value and the prefix must be freed by the caller. |
const xmlChar * xmlSplitQName3 (const xmlChar * name,
int * len)
parse an XML qualified name string,i
| name: | the full QName |
| len: | an int * |
| Returns: | NULL if it is not a Qualified Name, otherwise, update len with the length in byte of the prefix and return a pointer to the start of the name without the prefix |
xmlNodePtr xmlStringGetNodeList (const xmlDoc * doc,
const xmlChar * value)
Parse the value string and build the node list associated. Should produce a flat tree with only TEXTs and ENTITY_REFs.
| doc: | the document |
| value: | the value of the attribute |
| Returns: | a pointer to the first child |
xmlNodePtr xmlStringLenGetNodeList (const xmlDoc * doc,
const xmlChar * value,
int len)
Parse the value string and build the node list associated. Should produce a flat tree with only TEXTs and ENTITY_REFs.
| doc: | the document |
| value: | the value of the text |
| len: | the length of the string value |
| Returns: | a pointer to the first child |
int xmlTextConcat (xmlNodePtr node,
const xmlChar * content,
int len)
Concat the given string at the end of the existing node content
| node: | the node |
| content: | the content |
| len: | @content length |
| Returns: | -1 in case of error, 0 otherwise |
xmlNodePtr xmlTextMerge (xmlNodePtr first,
xmlNodePtr second)
Merge two text nodes into one
| first: | the first text node |
| second: | the second text node being merged |
| Returns: | the first text node augmented |
void xmlUnlinkNode (xmlNodePtr cur)
Unlink a node from it's current context, the node is not freed If one need to free the node, use xmlFreeNode() routine after the unlink to discard it. Note that namespace nodes can't be unlinked as they do not have pointer to their parent.
| cur: | the node |
int xmlUnsetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar * name)
Remove an attribute carried by a node.
| node: | the node |
| ns: | the namespace definition |
| name: | the attribute name |
| Returns: | 0 if successful, -1 if not found |
int xmlUnsetProp (xmlNodePtr node,
const xmlChar * name)
Remove an attribute carried by a node. This handles only attributes in no namespace.
| node: | the node |
| name: | the attribute name |
| Returns: | 0 if successful, -1 if not found |
int xmlValidateNCName (const xmlChar * value,
int space)
Check that a value conforms to the lexical space of NCName
| value: | the value to check |
| space: | allow spaces in front and end of the string |
| Returns: | 0 if this validates, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlValidateNMToken (const xmlChar * value,
int space)
Check that a value conforms to the lexical space of NMToken
| value: | the value to check |
| space: | allow spaces in front and end of the string |
| Returns: | 0 if this validates, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlValidateName (const xmlChar * value,
int space)
Check that a value conforms to the lexical space of Name
| value: | the value to check |
| space: | allow spaces in front and end of the string |
| Returns: | 0 if this validates, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlValidateQName (const xmlChar * value,
int space)
Check that a value conforms to the lexical space of QName
| value: | the value to check |
| space: | allow spaces in front and end of the string |
| Returns: | 0 if this validates, a positive error code number otherwise and -1 in case of internal or API error. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlschemastypes - implementation of XML Schema Datatypes
module providing the XML Schema Datatypes implementation both definition and validity checking
Author(s): Daniel Veillard
typedef enum xmlSchemaWhitespaceValueType; int xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
const xmlChar * value,
xmlSchemaValPtr * val,
xmlNodePtr node); int xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
const xmlChar ** retValue,
xmlSchemaWhitespaceValueType ws); int xmlSchemaValidateLengthFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaValType valType,
const xmlChar * value,
xmlSchemaValPtr val,
unsigned long * length,
xmlSchemaWhitespaceValueType ws); int xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
int facetType); int xmlSchemaGetCanonValue (xmlSchemaValPtr val,
const xmlChar ** retValue); xmlSchemaTypePtr xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); int xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
xmlSchemaWhitespaceValueType xws,
xmlSchemaValPtr y,
xmlSchemaWhitespaceValueType yws); int xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); xmlChar * xmlSchemaCollapseString (const xmlChar * value); int xmlSchemaValPredefTypeNodeNoNorm (xmlSchemaTypePtr type,
const xmlChar * value,
xmlSchemaValPtr * val,
xmlNodePtr node); int xmlSchemaValidateFacet (xmlSchemaTypePtr base,
xmlSchemaFacetPtr facet,
const xmlChar * value,
xmlSchemaValPtr val); xmlSchemaFacetPtr xmlSchemaNewFacet (void); int xmlSchemaValueAppend (xmlSchemaValPtr prev,
xmlSchemaValPtr cur); int xmlSchemaCompareValues (xmlSchemaValPtr x,
xmlSchemaValPtr y); int xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
xmlSchemaFacetPtr facet,
const xmlChar * value,
xmlSchemaValPtr val,
unsigned long * length); xmlSchemaValType xmlSchemaGetValType (xmlSchemaValPtr val); xmlSchemaTypePtr xmlSchemaGetPredefinedType (const xmlChar * name,
const xmlChar * ns); int xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
const xmlChar * value,
xmlSchemaValPtr * val); void xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); int xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
const xmlChar * value,
unsigned long actualLen,
unsigned long * expectedLen); unsigned long xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); void xmlSchemaFreeValue (xmlSchemaValPtr value); xmlSchemaValPtr xmlSchemaValueGetNext (xmlSchemaValPtr cur); const xmlChar * xmlSchemaValueGetAsString (xmlSchemaValPtr val); xmlSchemaValPtr xmlSchemaCopyValue (xmlSchemaValPtr val); xmlSchemaValPtr xmlSchemaNewNOTATIONValue (const xmlChar * name,
const xmlChar * ns); xmlSchemaValPtr xmlSchemaNewQNameValue (const xmlChar * namespaceName,
const xmlChar * localName); void xmlSchemaCleanupTypes (void); xmlChar * xmlSchemaWhiteSpaceReplace (const xmlChar * value); xmlSchemaValPtr xmlSchemaNewStringValue (xmlSchemaValType type,
const xmlChar * value); xmlSchemaTypePtr xmlSchemaGetBuiltInType (xmlSchemaValType type); void xmlSchemaInitTypes (void); int xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType fws,
xmlSchemaValType valType,
const xmlChar * value,
xmlSchemaValPtr val,
xmlSchemaWhitespaceValueType ws); int xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
xmlSchemaTypePtr typeDecl,
xmlSchemaParserCtxtPtr pctxt,
const xmlChar * name);
enum xmlSchemaWhitespaceValueType { XML_SCHEMA_WHITESPACE_UNKNOWN = 0 XML_SCHEMA_WHITESPACE_PRESERVE = 1 XML_SCHEMA_WHITESPACE_REPLACE = 2 XML_SCHEMA_WHITESPACE_COLLAPSE = 3 };
int xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
xmlSchemaTypePtr typeDecl,
xmlSchemaParserCtxtPtr pctxt,
const xmlChar * name)
Checks and computes the values of facets.
| facet: | the facet |
| typeDecl: | the schema type definition |
| pctxt: | the schema parser context or NULL |
| name: | the optional name of the type |
| Returns: | 0 if valid, a positive error code if not valid and -1 in case of an internal or API error. |
void xmlSchemaCleanupTypes (void)
Cleanup the default XML Schemas type library
xmlChar * xmlSchemaCollapseString (const xmlChar * value)
Removes and normalize white spaces in the string
| value: | a value |
| Returns: | the new string or NULL if no change was required. |
int xmlSchemaCompareValues (xmlSchemaValPtr x,
xmlSchemaValPtr y)
Compare 2 values
| x: | a first value |
| y: | a second value |
| Returns: | -1 if x < y, 0 if x == y, 1 if x > y, 2 if x <> y, and -2 in case of error |
int xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
xmlSchemaWhitespaceValueType xws,
xmlSchemaValPtr y,
xmlSchemaWhitespaceValueType yws)
Compare 2 values
| x: | a first value |
| xws: | the whitespace value of x |
| y: | a second value |
| yws: | the whitespace value of y |
| Returns: | -1 if x < y, 0 if x == y, 1 if x > y, 2 if x <> y, and -2 in case of error |
xmlSchemaValPtr xmlSchemaCopyValue (xmlSchemaValPtr val)
Copies the precomputed value. This duplicates any string within.
| val: | the precomputed value to be copied |
| Returns: | the copy or NULL if a copy for a data-type is not implemented. |
void xmlSchemaFreeFacet (xmlSchemaFacetPtr facet)
Deallocate a Schema Facet structure.
| facet: | a schema facet structure |
void xmlSchemaFreeValue (xmlSchemaValPtr value)
Cleanup the default XML Schemas type library
| value: | the value to free |
xmlSchemaTypePtr xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type)
Lookup function
| type: | the built-in simple type. |
| Returns: | the item type of @type as defined by the built-in datatype hierarchy of XML Schema Part 2: Datatypes, or NULL in case of an error. |
xmlSchemaTypePtr xmlSchemaGetBuiltInType (xmlSchemaValType type)
Gives you the type struct for a built-in type by its type id.
| type: | the type of the built in type |
| Returns: | the type if found, NULL otherwise. |
int xmlSchemaGetCanonValue (xmlSchemaValPtr val,
const xmlChar ** retValue)
Get the canonical lexical representation of the value. The caller has to FREE the returned retValue. WARNING: Some value types are not supported yet, resulting in a @retValue of "???". TODO: XML Schema 1.0 does not define canonical representations for: duration, gYearMonth, gYear, gMonthDay, gMonth, gDay, anyURI, QName, NOTATION. This will be fixed in XML Schema 1.1.
| val: | the precomputed value |
| retValue: | the returned value |
| Returns: | 0 if the value could be built, 1 if the value type is not supported yet and -1 in case of API errors. |
int xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
const xmlChar ** retValue,
xmlSchemaWhitespaceValueType ws)
Get the canonical representation of the value. The caller has to free the returned @retValue.
| val: | the precomputed value |
| retValue: | the returned value |
| ws: | the whitespace type of the value |
| Returns: | 0 if the value could be built, 1 if the value type is not supported yet and -1 in case of API errors. |
unsigned long xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet)
Extract the value of a facet
| facet: | an schemas type facet |
| Returns: | the value as a long |
xmlSchemaTypePtr xmlSchemaGetPredefinedType (const xmlChar * name,
const xmlChar * ns)
Lookup a type in the default XML Schemas type library
| name: | the type name |
| ns: | the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" |
| Returns: | the type if found, NULL otherwise |
xmlSchemaValType xmlSchemaGetValType (xmlSchemaValPtr val)
Accessor for the type of a value
| val: | a schemas value |
| Returns: | the xmlSchemaValType of the value |
int xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
int facetType)
Evaluates if a specific facet can be used in conjunction with a type.
| type: | the built-in type |
| facetType: | the facet type |
| Returns: | 1 if the facet can be used with the given built-in type, 0 otherwise and -1 in case the type is not a built-in type. |
xmlSchemaFacetPtr xmlSchemaNewFacet (void)
Allocate a new Facet structure.
| Returns: | the newly allocated structure or NULL in case or error |
xmlSchemaValPtr xmlSchemaNewNOTATIONValue (const xmlChar * name,
const xmlChar * ns)
Allocate a new NOTATION value. The given values are consumed and freed with the struct.
| name: | the notation name |
| ns: | the notation namespace name or NULL |
| Returns: | a pointer to the new value or NULL in case of error |
xmlSchemaValPtr xmlSchemaNewQNameValue (const xmlChar * namespaceName,
const xmlChar * localName)
Allocate a new QName value. The given values are consumed and freed with the struct.
| namespaceName: | the namespace name |
| localName: | the local name |
| Returns: | a pointer to the new value or NULL in case of an error. |
xmlSchemaValPtr xmlSchemaNewStringValue (xmlSchemaValType type,
const xmlChar * value)
Allocate a new simple type value. The type can be of XML_SCHEMAS_STRING. WARNING: This one is intended to be expanded for other string based types. We need this for anySimpleType as well. The given value is consumed and freed with the struct.
| type: | the value type |
| value: | the value |
| Returns: | a pointer to the new value or NULL in case of error |
int xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
const xmlChar * value,
xmlSchemaValPtr * val,
xmlNodePtr node)
Check that a value conforms to the lexical space of the predefined type. if true a value is computed and returned in @val.
| type: | the predefined type |
| value: | the value to check |
| val: | the return computed value |
| node: | the node containing the value |
| Returns: | 0 if this validates, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlSchemaValPredefTypeNodeNoNorm (xmlSchemaTypePtr type,
const xmlChar * value,
xmlSchemaValPtr * val,
xmlNodePtr node)
Check that a value conforms to the lexical space of the predefined type. if true a value is computed and returned in @val. This one does apply any normalization to the value.
| type: | the predefined type |
| value: | the value to check |
| val: | the return computed value |
| node: | the node containing the value |
| Returns: | 0 if this validates, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlSchemaValidateFacet (xmlSchemaTypePtr base,
xmlSchemaFacetPtr facet,
const xmlChar * value,
xmlSchemaValPtr val)
Check a value against a facet condition
| base: | the base type |
| facet: | the facet to check |
| value: | the lexical repr of the value to validate |
| val: | the precomputed value |
| Returns: | 0 if the element is schemas valid, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType fws,
xmlSchemaValType valType,
const xmlChar * value,
xmlSchemaValPtr val,
xmlSchemaWhitespaceValueType ws)
Check a value against a facet condition. This takes value normalization according to the specified whitespace types into account. Note that @value needs to be the *normalized* value if the facet is of type "pattern".
| facet: | the facet to check |
| fws: | the whitespace type of the facet's value |
| valType: | the built-in type of the value |
| value: | the lexical (or normalized for pattern) repr of the value to validate |
| val: | the precomputed value |
| ws: | the whitespace type of the value |
| Returns: | 0 if the element is schemas valid, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
xmlSchemaFacetPtr facet,
const xmlChar * value,
xmlSchemaValPtr val,
unsigned long * length)
Checka a value against a "length", "minLength" and "maxLength" facet; sets @length to the computed length of @value.
| type: | the built-in type |
| facet: | the facet to check |
| value: | the lexical repr. of the value to be validated |
| val: | the precomputed value |
| length: | the actual length of the value |
| Returns: | 0 if the value is valid, a positive error code otherwise and -1 in case of an internal or API error. |
int xmlSchemaValidateLengthFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaValType valType,
const xmlChar * value,
xmlSchemaValPtr val,
unsigned long * length,
xmlSchemaWhitespaceValueType ws)
Checka a value against a "length", "minLength" and "maxLength" facet; sets @length to the computed length of @value.
| facet: | the facet to check |
| valType: | the built-in type |
| value: | the lexical repr. of the value to be validated |
| val: | the precomputed value |
| length: | the actual length of the value |
| ws: | the whitespace type of the value |
| Returns: | 0 if the value is valid, a positive error code otherwise and -1 in case of an internal or API error. |
int xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
const xmlChar * value,
unsigned long actualLen,
unsigned long * expectedLen)
Checks the value of a list simple type against a facet.
| facet: | the facet to check |
| value: | the lexical repr of the value to validate |
| actualLen: | the number of list items |
| expectedLen: | the resulting expected number of list items |
| Returns: | 0 if the value is valid, a positive error code number otherwise and -1 in case of an internal error. |
int xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
const xmlChar * value,
xmlSchemaValPtr * val)
Check that a value conforms to the lexical space of the predefined type. if true a value is computed and returned in @val.
| type: | the predefined type |
| value: | the value to check |
| val: | the return computed value |
| Returns: | 0 if this validates, a positive error code number otherwise and -1 in case of internal or API error. |
int xmlSchemaValueAppend (xmlSchemaValPtr prev,
xmlSchemaValPtr cur)
Appends a next sibling to a list of computed values.
| prev: | the value |
| cur: | the value to be appended |
| Returns: | 0 if succeeded and -1 on API errors. |
int xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val)
Accessor for the boolean value of a computed value.
| val: | the value |
| Returns: | 1 if true and 0 if false, or in case of an error. Hmm. |
const xmlChar * xmlSchemaValueGetAsString (xmlSchemaValPtr val)
Accessor for the string value of a computed value.
| val: | the value |
| Returns: | the string value or NULL if there was none, or on API errors. |
xmlSchemaValPtr xmlSchemaValueGetNext (xmlSchemaValPtr cur)
Accessor for the next sibling of a list of computed values.
| cur: | the value |
| Returns: | the next value or NULL if there was none, or on API errors. |
xmlChar * xmlSchemaWhiteSpaceReplace (const xmlChar * value)
Replaces 0xd, 0x9 and 0xa with a space.
| value: | a value |
| Returns: | the new string or NULL if no change was required. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xinclude - implementation of XInclude
API to handle XInclude processing, implements the World Wide Web Consortium Last Call Working Draft 10 November 2003
Author(s): Daniel Veillard
#define XINCLUDE_PARSE_TEXT; #define XINCLUDE_PARSE_XPOINTER; #define XINCLUDE_HREF; #define XINCLUDE_FALLBACK; #define XINCLUDE_NS; #define XINCLUDE_PARSE; #define XINCLUDE_NODE; #define XINCLUDE_PARSE_XML; #define XINCLUDE_PARSE_ENCODING; #define XINCLUDE_OLD_NS; typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; typedef xmlXIncludeCtxt * xmlXIncludeCtxtPtr; int xmlXIncludeProcessTreeFlagsData (xmlNodePtr tree,
int flags,
void * data); int xmlXIncludeProcessFlagsData (xmlDocPtr doc,
int flags,
void * data); int xmlXIncludeProcessFlags (xmlDocPtr doc,
int flags); int xmlXIncludeProcessTree (xmlNodePtr tree); int xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
xmlNodePtr node); void xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt); int xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
int flags); int xmlXIncludeProcess (xmlDocPtr doc); xmlXIncludeCtxtPtr xmlXIncludeNewContext (xmlDocPtr doc); int xmlXIncludeProcessTreeFlags (xmlNodePtr tree,
int flags);
#define XINCLUDE_NS;
Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
#define XINCLUDE_OLD_NS;
Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
struct _xmlXIncludeCtxt {
The content of this structure is not made public by the API.
} xmlXIncludeCtxt;
xmlXIncludeCtxt * xmlXIncludeCtxtPtr;
void xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt)
Free an XInclude context
| ctxt: | the XInclude context |
xmlXIncludeCtxtPtr xmlXIncludeNewContext (xmlDocPtr doc)
Creates a new XInclude context
| doc: | an XML Document |
| Returns: | the new set |
int xmlXIncludeProcess (xmlDocPtr doc)
Implement the XInclude substitution on the XML document @doc
| doc: | an XML document |
| Returns: | 0 if no substitution were done, -1 if some processing failed or the number of substitutions done. |
int xmlXIncludeProcessFlags (xmlDocPtr doc,
int flags)
Implement the XInclude substitution on the XML document @doc
| doc: | an XML document |
| flags: | a set of xmlParserOption used for parsing XML includes |
| Returns: | 0 if no substitution were done, -1 if some processing failed or the number of substitutions done. |
int xmlXIncludeProcessFlagsData (xmlDocPtr doc,
int flags,
void * data)
Implement the XInclude substitution on the XML document @doc
| doc: | an XML document |
| flags: | a set of xmlParserOption used for parsing XML includes |
| data: | application data that will be passed to the parser context in the _private field of the parser context(s) |
| Returns: | 0 if no substitution were done, -1 if some processing failed or the number of substitutions done. |
int xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
xmlNodePtr node)
Implement the XInclude substitution for the given subtree reusing the informations and data coming from the given context.
| ctxt: | an existing XInclude context |
| node: | a node in an XML document |
| Returns: | 0 if no substitution were done, -1 if some processing failed or the number of substitutions done. |
int xmlXIncludeProcessTree (xmlNodePtr tree)
Implement the XInclude substitution for the given subtree
| tree: | a node in an XML document |
| Returns: | 0 if no substitution were done, -1 if some processing failed or the number of substitutions done. |
int xmlXIncludeProcessTreeFlags (xmlNodePtr tree,
int flags)
Implement the XInclude substitution for the given subtree
| tree: | a node in an XML document |
| flags: | a set of xmlParserOption used for parsing XML includes |
| Returns: | 0 if no substitution were done, -1 if some processing failed or the number of substitutions done. |
int xmlXIncludeProcessTreeFlagsData (xmlNodePtr tree,
int flags,
void * data)
Implement the XInclude substitution on the XML node @tree
| tree: | an XML node |
| flags: | a set of xmlParserOption used for parsing XML includes |
| data: | application data that will be passed to the parser context in the _private field of the parser context(s) |
| Returns: | 0 if no substitution were done, -1 if some processing failed or the number of substitutions done. |
int xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
int flags)
Set the flags used for further processing of XML resources.
| ctxt: | an XInclude processing context |
| flags: | a set of xmlParserOption used for parsing XML includes |
| Returns: | 0 in case of success and -1 in case of error. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlIO - interface for the I/O interfaces used by the parser
interface for the I/O interfaces used by the parser
Author(s): Daniel Veillard
int xmlIOHTTPRead (void * context,
char * buffer,
int len); typedef int xmlInputMatchCallback (char const * filename); void xmlRegisterDefaultOutputCallbacks (void); int xmlFileClose (void * context); typedef int xmlOutputMatchCallback (char const * filename); int xmlParserInputBufferPush (xmlParserInputBufferPtr in,
int len,
const char * buf); int xmlIOFTPRead (void * context,
char * buffer,
int len); void xmlRegisterHTTPPostCallbacks (void); void * xmlIOFTPOpen (const char * filename); int xmlIOFTPClose (void * context); void * xmlFileOpen (const char * filename); xmlOutputBufferPtr xmlOutputBufferCreateFile (FILE * file,
xmlCharEncodingHandlerPtr encoder); int xmlCheckFilename (const char * path); typedef void * xmlOutputOpenCallback (char const * filename); xmlParserInputBufferPtr xmlParserInputBufferCreateFilename (const char * URI,
xmlCharEncoding enc); int xmlOutputBufferClose (xmlOutputBufferPtr out); xmlParserInputBufferPtr xmlAllocParserInputBuffer (xmlCharEncoding enc); xmlOutputBufferPtr xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void * ioctx,
xmlCharEncodingHandlerPtr encoder); typedef int xmlOutputWriteCallback (void * context,
const char * buffer,
int len); int xmlOutputBufferFlush (xmlOutputBufferPtr out); xmlParserInputPtr xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr ret); int xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc); xmlParserInputBufferPtr xmlParserInputBufferCreateMem (const char * mem,
int size,
xmlCharEncoding enc); int xmlIOFTPMatch (const char * filename); int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc); void xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); void xmlRegisterDefaultInputCallbacks (void); int xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
int len); typedef int xmlOutputCloseCallback (void * context); xmlOutputBufferPtr xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); xmlParserInputPtr xmlNoNetExternalEntityLoader (const char * URL,
const char * ID,
xmlParserCtxtPtr ctxt); xmlOutputBufferPtr xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
xmlCharEncodingHandlerPtr encoder); int xmlIOHTTPMatch (const char * filename); void * xmlIOHTTPOpen (const char * filename); xmlParserInputBufferPtr xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
xmlCharEncoding enc); xmlOutputBufferPtr xmlOutputBufferCreateFd (int fd,
xmlCharEncodingHandlerPtr encoder); xmlChar * xmlNormalizeWindowsPath (const xmlChar * path); typedef int xmlInputReadCallback (void * context,
char * buffer,
int len); xmlParserInputBufferPtr xmlParserInputBufferCreateStatic (const char * mem,
int size,
xmlCharEncoding enc); const xmlChar * xmlOutputBufferGetContent (xmlOutputBufferPtr out); int xmlIOHTTPClose (void * context); int xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
const xmlChar * str,
xmlCharEncodingOutputFunc escaping); xmlOutputBufferPtr xmlOutputBufferCreateFilename (const char * URI,
xmlCharEncodingHandlerPtr encoder,
int compression); size_t xmlOutputBufferGetSize (xmlOutputBufferPtr out); void xmlCleanupOutputCallbacks (void); typedef void * xmlInputOpenCallback (char const * filename); int xmlParserInputBufferRead (xmlParserInputBufferPtr in,
int len); int xmlOutputBufferWriteString (xmlOutputBufferPtr out,
const char * str); int xmlFileMatch (const char * filename); int xmlPopInputCallbacks (void); int xmlFileRead (void * context,
char * buffer,
int len); xmlParserInputBufferPtr xmlParserInputBufferCreateFile (FILE * file,
xmlCharEncoding enc); char * xmlParserGetDirectory (const char * filename); int xmlOutputBufferWrite (xmlOutputBufferPtr out,
int len,
const char * buf); void xmlCleanupInputCallbacks (void); typedef int xmlInputCloseCallback (void * context); void * xmlIOHTTPOpenW (const char * post_uri,
int compression); xmlParserInputBufferPtr xmlParserInputBufferCreateFd (int fd,
xmlCharEncoding enc);
int xmlInputCloseCallback (void * context)
Callback used in the I/O Input API to close the resource
| context: | an Input context |
| Returns: | 0 or -1 in case of error |
int xmlInputMatchCallback (char const * filename)
Callback used in the I/O Input API to detect if the current handler can provide input fonctionnalities for this resource.
| filename: | the filename or URI |
| Returns: | 1 if yes and 0 if another Input module should be used |
void * xmlInputOpenCallback (char const * filename)
Callback used in the I/O Input API to open the resource
| filename: | the filename or URI |
| Returns: | an Input context or NULL in case or error |
int xmlInputReadCallback (void * context,
char * buffer,
int len)
Callback used in the I/O Input API to read the resource
| context: | an Input context |
| buffer: | the buffer to store data read |
| len: | the length of the buffer in bytes |
| Returns: | the number of bytes read or -1 in case of error |
int xmlOutputCloseCallback (void * context)
Callback used in the I/O Output API to close the resource
| context: | an Output context |
| Returns: | 0 or -1 in case of error |
int xmlOutputMatchCallback (char const * filename)
Callback used in the I/O Output API to detect if the current handler can provide output fonctionnalities for this resource.
| filename: | the filename or URI |
| Returns: | 1 if yes and 0 if another Output module should be used |
void * xmlOutputOpenCallback (char const * filename)
Callback used in the I/O Output API to open the resource
| filename: | the filename or URI |
| Returns: | an Output context or NULL in case or error |
int xmlOutputWriteCallback (void * context,
const char * buffer,
int len)
Callback used in the I/O Output API to write to the resource
| context: | an Output context |
| buffer: | the buffer of data to write |
| len: | the length of the buffer in bytes |
| Returns: | the number of bytes written or -1 in case of error |
xmlOutputBufferPtr xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder)
Create a buffered parser output
| encoder: | the encoding converter or NULL |
| Returns: | the new parser output or NULL |
xmlParserInputBufferPtr xmlAllocParserInputBuffer (xmlCharEncoding enc)
Create a buffered parser input for progressive parsing
| enc: | the charset encoding if known |
| Returns: | the new parser input or NULL |
int xmlCheckFilename (const char * path)
function checks to see if @path is a valid source (file, socket...) for XML. if stat is not available on the target machine,
| path: | the path to check |
| Returns: | 1. if stat fails, returns 0 (if calling stat on the filename fails, it can't be right). if stat succeeds and the file is a directory, returns 2. otherwise returns 1. |
xmlParserInputPtr xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr ret)
Check an input in case it was created from an HTTP stream, in that case it will handle encoding and update of the base URL in case of redirection. It also checks for HTTP errors in which case the input is cleanly freed up and an appropriate error is raised in context
| ctxt: | an XML parser context |
| ret: | an XML parser input |
| Returns: | the input or NULL in case of HTTP error. |
void xmlCleanupInputCallbacks (void)
clears the entire input callback table. this includes the compiled-in I/O.
void xmlCleanupOutputCallbacks (void)
clears the entire output callback table. this includes the compiled-in I/O callbacks.
int xmlFileClose (void * context)
Close an I/O channel
| context: | the I/O context |
| Returns: | 0 or -1 in case of error |
int xmlFileMatch (const char * filename)
input from FILE *
| filename: | the URI for matching |
| Returns: | 1 if matches, 0 otherwise |
void * xmlFileOpen (const char * filename)
Wrapper around xmlFileOpen_real that try it with an unescaped version of @filename, if this fails fallback to @filename
| filename: | the URI for matching |
| Returns: | a handler or NULL in case or failure |
int xmlFileRead (void * context,
char * buffer,
int len)
Read @len bytes to @buffer from the I/O channel.
| context: | the I/O context |
| buffer: | where to drop data |
| len: | number of bytes to write |
| Returns: | the number of bytes written or < 0 in case of failure |
void xmlFreeParserInputBuffer (xmlParserInputBufferPtr in)
Free up the memory used by a buffered parser input
| in: | a buffered parser input |
int xmlIOFTPClose (void * context)
Close an FTP I/O channel
| context: | the I/O context |
| Returns: | 0 |
int xmlIOFTPMatch (const char * filename)
check if the URI matches an FTP one
| filename: | the URI for matching |
| Returns: | 1 if matches, 0 otherwise |
void * xmlIOFTPOpen (const char * filename)
open an FTP I/O channel
| filename: | the URI for matching |
| Returns: | an I/O context or NULL in case of error |
int xmlIOFTPRead (void * context,
char * buffer,
int len)
Read @len bytes to @buffer from the I/O channel.
| context: | the I/O context |
| buffer: | where to drop data |
| len: | number of bytes to write |
| Returns: | the number of bytes written |
int xmlIOHTTPClose (void * context)
Close an HTTP I/O channel
| context: | the I/O context |
| Returns: | 0 |
int xmlIOHTTPMatch (const char * filename)
check if the URI matches an HTTP one
| filename: | the URI for matching |
| Returns: | 1 if matches, 0 otherwise |
void * xmlIOHTTPOpen (const char * filename)
open an HTTP I/O channel
| filename: | the URI for matching |
| Returns: | an I/O context or NULL in case of error |
void * xmlIOHTTPOpenW (const char * post_uri,
int compression)
Open a temporary buffer to collect the document for a subsequent HTTP POST request. Non-static as is called from the output buffer creation routine.
| post_uri: | The destination URI for the document |
| compression: | The compression desired for the document. |
| Returns: | an I/O context or NULL in case of error. |
int xmlIOHTTPRead (void * context,
char * buffer,
int len)
Read @len bytes to @buffer from the I/O channel.
| context: | the I/O context |
| buffer: | where to drop data |
| len: | number of bytes to write |
| Returns: | the number of bytes written |
xmlParserInputPtr xmlNoNetExternalEntityLoader (const char * URL,
const char * ID,
xmlParserCtxtPtr ctxt)
A specific entity loader disabling network accesses, though still allowing local catalog accesses for resolution.
| URL: | the URL for the entity to load |
| ID: | the System ID for the entity to load |
| ctxt: | the context in which the entity is called or NULL |
| Returns: | a new allocated xmlParserInputPtr, or NULL. |
xmlChar * xmlNormalizeWindowsPath (const xmlChar * path)
This function is obsolete. Please see xmlURIFromPath in uri.c for a better solution.
| path: | the input file path |
| Returns: | a canonicalized version of the path |
int xmlOutputBufferClose (xmlOutputBufferPtr out)
flushes and close the output I/O channel and free up all the associated resources
| out: | a buffered output |
| Returns: | the number of byte written or -1 in case of error. |
xmlOutputBufferPtr xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
xmlCharEncodingHandlerPtr encoder)
Create a buffered output for the progressive saving to a xmlBuffer
| buffer: | a xmlBufferPtr |
| encoder: | the encoding converter or NULL |
| Returns: | the new parser output or NULL |
xmlOutputBufferPtr xmlOutputBufferCreateFd (int fd,
xmlCharEncodingHandlerPtr encoder)
Create a buffered output for the progressive saving to a file descriptor
| fd: | a file descriptor number |
| encoder: | the encoding converter or NULL |
| Returns: | the new parser output or NULL |
xmlOutputBufferPtr xmlOutputBufferCreateFile (FILE * file,
xmlCharEncodingHandlerPtr encoder)
Create a buffered output for the progressive saving to a FILE * buffered C I/O
| file: | a FILE* |
| encoder: | the encoding converter or NULL |
| Returns: | the new parser output or NULL |
xmlOutputBufferPtr xmlOutputBufferCreateFilename (const char * URI,
xmlCharEncodingHandlerPtr encoder,
int compression)
Create a buffered output for the progressive saving of a file If filename is "-' then we use stdout as the output. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. TODO: currently if compression is set, the library only support writing to a local file.
| URI: | a C string containing the URI or filename |
| encoder: | the encoding converter or NULL |
| compression: | the compression ration (0 none, 9 max). |
| Returns: | the new output or NULL |
xmlOutputBufferPtr xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void * ioctx,
xmlCharEncodingHandlerPtr encoder)
Create a buffered output for the progressive saving to an I/O handler
| iowrite: | an I/O write function |
| ioclose: | an I/O close function |
| ioctx: | an I/O handler |
| encoder: | the charset encoding if known |
| Returns: | the new parser output or NULL |
int xmlOutputBufferFlush (xmlOutputBufferPtr out)
flushes the output I/O channel
| out: | a buffered output |
| Returns: | the number of byte written or -1 in case of error. |
const xmlChar * xmlOutputBufferGetContent (xmlOutputBufferPtr out)
Gives a pointer to the data currently held in the output buffer
| out: | an xmlOutputBufferPtr |
| Returns: | a pointer to the data or NULL in case of error |
size_t xmlOutputBufferGetSize (xmlOutputBufferPtr out)
Gives the length of the data currently held in the output buffer
| out: | an xmlOutputBufferPtr |
| Returns: | 0 in case or error or no data is held, the size otherwise |
int xmlOutputBufferWrite (xmlOutputBufferPtr out,
int len,
const char * buf)
Write the content of the array in the output I/O buffer This routine handle the I18N transcoding from internal UTF-8 The buffer is lossless, i.e. will store in case of partial or delayed writes.
| out: | a buffered parser output |
| len: | the size in bytes of the array. |
| buf: | an char array |
| Returns: | the number of chars immediately written, or -1 in case of error. |
int xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
const xmlChar * str,
xmlCharEncodingOutputFunc escaping)
Write the content of the string in the output I/O buffer This routine escapes the caracters and then handle the I18N transcoding from internal UTF-8 The buffer is lossless, i.e. will store in case of partial or delayed writes.
| out: | a buffered parser output |
| str: | a zero terminated UTF-8 string |
| escaping: | an optional escaping function (or NULL) |
| Returns: | the number of chars immediately written, or -1 in case of error. |
int xmlOutputBufferWriteString (xmlOutputBufferPtr out,
const char * str)
Write the content of the string in the output I/O buffer This routine handle the I18N transcoding from internal UTF-8 The buffer is lossless, i.e. will store in case of partial or delayed writes.
| out: | a buffered parser output |
| str: | a zero terminated C string |
| Returns: | the number of chars immediately written, or -1 in case of error. |
char * xmlParserGetDirectory (const char * filename)
lookup the directory for that file
| filename: | the path to a file |
| Returns: | a new allocated string containing the directory, or NULL. |
xmlParserInputBufferPtr xmlParserInputBufferCreateFd (int fd,
xmlCharEncoding enc)
Create a buffered parser input for the progressive parsing for the input from a file descriptor
| fd: | a file descriptor number |
| enc: | the charset encoding if known |
| Returns: | the new parser input or NULL |
xmlParserInputBufferPtr xmlParserInputBufferCreateFile (FILE * file,
xmlCharEncoding enc)
Create a buffered parser input for the progressive parsing of a FILE * buffered C I/O
| file: | a FILE* |
| enc: | the charset encoding if known |
| Returns: | the new parser input or NULL |
xmlParserInputBufferPtr xmlParserInputBufferCreateFilename (const char * URI,
xmlCharEncoding enc)
Create a buffered parser input for the progressive parsing of a file If filename is "-' then we use stdin as the input. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. Do an encoding check if enc == XML_CHAR_ENCODING_NONE
| URI: | a C string containing the URI or filename |
| enc: | the charset encoding if known |
| Returns: | the new parser input or NULL |
xmlParserInputBufferPtr xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
xmlCharEncoding enc)
Create a buffered parser input for the progressive parsing for the input from an I/O handler
| ioread: | an I/O read function |
| ioclose: | an I/O close function |
| ioctx: | an I/O handler |
| enc: | the charset encoding if known |
| Returns: | the new parser input or NULL |
xmlParserInputBufferPtr xmlParserInputBufferCreateMem (const char * mem,
int size,
xmlCharEncoding enc)
Create a buffered parser input for the progressive parsing for the input from a memory area.
| mem: | the memory input |
| size: | the length of the memory block |
| enc: | the charset encoding if known |
| Returns: | the new parser input or NULL |
xmlParserInputBufferPtr xmlParserInputBufferCreateStatic (const char * mem,
int size,
xmlCharEncoding enc)
Create a buffered parser input for the progressive parsing for the input from an immutable memory area. This will not copy the memory area to the buffer, but the memory is expected to be available until the end of the parsing, this is useful for example when using mmap'ed file.
| mem: | the memory input |
| size: | the length of the memory block |
| enc: | the charset encoding if known |
| Returns: | the new parser input or NULL |
int xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
int len)
Grow up the content of the input buffer, the old data are preserved This routine handle the I18N transcoding to internal UTF-8 This routine is used when operating the parser in normal (pull) mode TODO: one should be able to remove one extra copy by copying directly onto in->buffer or in->raw
| in: | a buffered parser input |
| len: | indicative value of the amount of chars to read |
| Returns: | the number of chars read and stored in the buffer, or -1 in case of error. |
int xmlParserInputBufferPush (xmlParserInputBufferPtr in,
int len,
const char * buf)
Push the content of the arry in the input buffer This routine handle the I18N transcoding to internal UTF-8 This is used when operating the parser in progressive (push) mode.
| in: | a buffered parser input |
| len: | the size in bytes of the array. |
| buf: | an char array |
| Returns: | the number of chars read and stored in the buffer, or -1 in case of error. |
int xmlParserInputBufferRead (xmlParserInputBufferPtr in,
int len)
Refresh the content of the input buffer, the old data are considered consumed This routine handle the I18N transcoding to internal UTF-8
| in: | a buffered parser input |
| len: | indicative value of the amount of chars to read |
| Returns: | the number of chars read and stored in the buffer, or -1 in case of error. |
int xmlPopInputCallbacks (void)
Clear the top input callback from the input stack. this includes the compiled-in I/O.
| Returns: | the number of input callback registered or -1 in case of error. |
void xmlRegisterDefaultInputCallbacks (void)
Registers the default compiled-in I/O handlers.
void xmlRegisterDefaultOutputCallbacks (void)
Registers the default compiled-in I/O handlers.
void xmlRegisterHTTPPostCallbacks (void)
By default, libxml submits HTTP output requests using the "PUT" method. Calling this method changes the HTTP output method to use the "POST" method instead.
int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc)
Register a new set of I/O callback for handling parser input.
| matchFunc: | the xmlInputMatchCallback |
| openFunc: | the xmlInputOpenCallback |
| readFunc: | the xmlInputReadCallback |
| closeFunc: | the xmlInputCloseCallback |
| Returns: | the registered handler number or -1 in case of error |
int xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc)
Register a new set of I/O callback for handling output.
| matchFunc: | the xmlOutputMatchCallback |
| openFunc: | the xmlOutputOpenCallback |
| writeFunc: | the xmlOutputWriteCallback |
| closeFunc: | the xmlOutputCloseCallback |
| Returns: | the registered handler number or -1 in case of error |
|
|
|
|
libxml2 Reference Manual |
|---|
xpointer - API to handle XML Pointers
API to handle XML Pointers Base implementation was made accordingly to W3C Candidate Recommendation 7 June 2000
Author(s): Daniel Veillard
typedef struct _xmlLocationSet xmlLocationSet; typedef xmlLocationSet * xmlLocationSetPtr; xmlXPathObjectPtr xmlXPtrNewRange (xmlNodePtr start,
int startindex,
xmlNodePtr end,
int endindex); void xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); xmlXPathObjectPtr xmlXPtrWrapLocationSet (xmlLocationSetPtr val); xmlNodePtr xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); xmlXPathObjectPtr xmlXPtrEval (const xmlChar * str,
xmlXPathContextPtr ctx); xmlXPathObjectPtr xmlXPtrNewRangeNodes (xmlNodePtr start,
xmlNodePtr end); void xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val); void xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlXPathObjectPtr xmlXPtrNewCollapsedRange (xmlNodePtr start); xmlXPathObjectPtr xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
xmlXPathObjectPtr end); xmlXPathObjectPtr xmlXPtrNewLocationSetNodeSet (xmlNodeSetPtr set); xmlXPathObjectPtr xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
xmlNodePtr end); xmlLocationSetPtr xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); xmlXPathObjectPtr xmlXPtrNewRangeNodeObject (xmlNodePtr start,
xmlXPathObjectPtr end); xmlXPathContextPtr xmlXPtrNewContext (xmlDocPtr doc,
xmlNodePtr here,
xmlNodePtr origin); void xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
int val); xmlXPathObjectPtr xmlXPtrNewRangeNodePoint (xmlNodePtr start,
xmlXPathObjectPtr end); void xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
xmlXPathObjectPtr val); xmlLocationSetPtr xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2); void xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); xmlXPathObjectPtr xmlXPtrNewLocationSetNodes (xmlNodePtr start,
xmlNodePtr end);
struct _xmlLocationSet {
int locNr : number of locations in the set
int locMax : size of the array as allocated
xmlXPathObjectPtr * locTab : array of locations
} xmlLocationSet;
xmlLocationSet * xmlLocationSetPtr;
xmlNodePtr xmlXPtrBuildNodeList (xmlXPathObjectPtr obj)
Build a node list tree copy of the XPointer result. This will drop Attributes and Namespace declarations.
| obj: | the XPointer result from the evaluation. |
| Returns: | an xmlNodePtr list or NULL. the caller has to free the node tree. |
xmlXPathObjectPtr xmlXPtrEval (const xmlChar * str,
xmlXPathContextPtr ctx)
Evaluate the XPath Location Path in the given context.
| str: | the XPointer expression |
| ctx: | the XPointer context |
| Returns: | the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object. |
void xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt)
[8] Predicate ::= '[' PredicateExpr ']' [9] PredicateExpr ::= Expr Evaluate a predicate as in xmlXPathEvalPredicate() but for a Location Set instead of a node set
| ctxt: | the XPointer Parser context |
void xmlXPtrFreeLocationSet (xmlLocationSetPtr obj)
Free the LocationSet compound (not the actual ranges !).
| obj: | the xmlLocationSetPtr to free |
void xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val)
add a new xmlXPathObjectPtr to an existing LocationSet If the location already exist in the set @val is freed.
| cur: | the initial range set |
| val: | a new xmlXPathObjectPtr |
xmlLocationSetPtr xmlXPtrLocationSetCreate (xmlXPathObjectPtr val)
Create a new xmlLocationSetPtr of type double and of value @val
| val: | an initial xmlXPathObjectPtr, or NULL |
| Returns: | the newly created object. |
void xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
xmlXPathObjectPtr val)
Removes an xmlXPathObjectPtr from an existing LocationSet
| cur: | the initial range set |
| val: | an xmlXPathObjectPtr |
xmlLocationSetPtr xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2)
Merges two rangesets, all ranges from @val2 are added to @val1
| val1: | the first LocationSet |
| val2: | the second LocationSet |
| Returns: | val1 once extended or NULL in case of error. |
void xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
int val)
Removes an entry from an existing LocationSet list.
| cur: | the initial range set |
| val: | the index to remove |
xmlXPathObjectPtr xmlXPtrNewCollapsedRange (xmlNodePtr start)
Create a new xmlXPathObjectPtr of type range using a single nodes
| start: | the starting and ending node |
| Returns: | the newly created object. |
xmlXPathContextPtr xmlXPtrNewContext (xmlDocPtr doc,
xmlNodePtr here,
xmlNodePtr origin)
Create a new XPointer context
| doc: | the XML document |
| here: | the node that directly contains the XPointer being evaluated or NULL |
| origin: | the element from which a user or program initiated traversal of the link, or NULL. |
| Returns: | the xmlXPathContext just allocated. |
xmlXPathObjectPtr xmlXPtrNewLocationSetNodeSet (xmlNodeSetPtr set)
Create a new xmlXPathObjectPtr of type LocationSet and initialize it with all the nodes from @set
| set: | a node set |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPtrNewLocationSetNodes (xmlNodePtr start,
xmlNodePtr end)
Create a new xmlXPathObjectPtr of type LocationSet and initialize it with the single range made of the two nodes @start and @end
| start: | the start NodePtr value |
| end: | the end NodePtr value or NULL |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPtrNewRange (xmlNodePtr start,
int startindex,
xmlNodePtr end,
int endindex)
Create a new xmlXPathObjectPtr of type range
| start: | the starting node |
| startindex: | the start index |
| end: | the ending point |
| endindex: | the ending index |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPtrNewRangeNodeObject (xmlNodePtr start,
xmlXPathObjectPtr end)
Create a new xmlXPathObjectPtr of type range from a not to an object
| start: | the starting node |
| end: | the ending object |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPtrNewRangeNodePoint (xmlNodePtr start,
xmlXPathObjectPtr end)
Create a new xmlXPathObjectPtr of type range from a node to a point
| start: | the starting node |
| end: | the ending point |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPtrNewRangeNodes (xmlNodePtr start,
xmlNodePtr end)
Create a new xmlXPathObjectPtr of type range using 2 nodes
| start: | the starting node |
| end: | the ending node |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
xmlNodePtr end)
Create a new xmlXPathObjectPtr of type range from a point to a node
| start: | the starting point |
| end: | the ending node |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
xmlXPathObjectPtr end)
Create a new xmlXPathObjectPtr of type range using 2 Points
| start: | the starting point |
| end: | the ending point |
| Returns: | the newly created object. |
void xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the range-to() XPointer function Obsolete. range-to is not a real function but a special type of location step which is handled in xpath.c.
| ctxt: | the XPointer Parser context |
| nargs: | the number of args |
xmlXPathObjectPtr xmlXPtrWrapLocationSet (xmlLocationSetPtr val)
Wrap the LocationSet @val in a new xmlXPathObjectPtr
| val: | the LocationSet value |
| Returns: | the newly created object. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
debugXML - Tree debugging APIs
Interfaces to a set of routines used for debugging the tree produced by the XML parser.
Author(s): Daniel Veillard
typedef struct _xmlShellCtxt xmlShellCtxt; typedef xmlShellCtxt * xmlShellCtxtPtr; void xmlDebugDumpAttrList (FILE * output,
xmlAttrPtr attr,
int depth); void xmlLsOneNode (FILE * output,
xmlNodePtr node); typedef char * xmlShellReadlineFunc (char * prompt); int xmlShellSave (xmlShellCtxtPtr ctxt,
char * filename,
xmlNodePtr node,
xmlNodePtr node2); const char * xmlBoolToText (int boolval); int xmlShellWrite (xmlShellCtxtPtr ctxt,
char * filename,
xmlNodePtr node,
xmlNodePtr node2); int xmlShellDu (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr tree,
xmlNodePtr node2); int xmlShellValidate (xmlShellCtxtPtr ctxt,
char * dtd,
xmlNodePtr node,
xmlNodePtr node2); int xmlDebugCheckDocument (FILE * output,
xmlDocPtr doc); void xmlShellPrintXPathResult (xmlXPathObjectPtr list); typedef int xmlShellCmd (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2); int xmlShellLoad (xmlShellCtxtPtr ctxt,
char * filename,
xmlNodePtr node,
xmlNodePtr node2); void xmlDebugDumpString (FILE * output,
const xmlChar * str); int xmlShellBase (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2); int xmlShellCat (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2); void xmlDebugDumpDTD (FILE * output,
xmlDtdPtr dtd); void xmlDebugDumpNode (FILE * output,
xmlNodePtr node,
int depth); void xmlDebugDumpEntities (FILE * output,
xmlDocPtr doc); void xmlShellPrintNode (xmlNodePtr node); int xmlShellPwd (xmlShellCtxtPtr ctxt,
char * buffer,
xmlNodePtr node,
xmlNodePtr node2); void xmlDebugDumpNodeList (FILE * output,
xmlNodePtr node,
int depth); void xmlDebugDumpAttr (FILE * output,
xmlAttrPtr attr,
int depth); void xmlDebugDumpDocument (FILE * output,
xmlDocPtr doc); int xmlLsCountNode (xmlNodePtr node); void xmlShellPrintXPathError (int errorType,
const char * arg); int xmlShellDir (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2); void xmlDebugDumpOneNode (FILE * output,
xmlNodePtr node,
int depth); int xmlShellList (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2); void xmlDebugDumpDocumentHead (FILE * output,
xmlDocPtr doc); void xmlShell (xmlDocPtr doc,
char * filename,
xmlShellReadlineFunc input,
FILE * output);
struct _xmlShellCtxt {
char * filename
xmlDocPtr doc
xmlNodePtr node
xmlXPathContextPtr pctxt
int loaded
FILE * output
xmlShellReadlineFunc input
} xmlShellCtxt;
xmlShellCtxt * xmlShellCtxtPtr;
int xmlShellCmd (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2)
This is a generic signature for the XML shell functions.
| ctxt: | a shell context |
| arg: | a string argument |
| node: | a first node |
| node2: | a second node |
| Returns: | an int, negative returns indicating errors. |
char * xmlShellReadlineFunc (char * prompt)
This is a generic signature for the XML shell input function.
| prompt: | a string prompt |
| Returns: | a string which will be freed by the Shell. |
const char * xmlBoolToText (int boolval)
Convenient way to turn bool into text
| boolval: | a bool to turn into text |
| Returns: | a pointer to either "True" or "False" |
int xmlDebugCheckDocument (FILE * output,
xmlDocPtr doc)
Check the document for potential content problems, and output the errors to @output
| output: | the FILE * for the output |
| doc: | the document |
| Returns: | the number of errors found |
void xmlDebugDumpAttr (FILE * output,
xmlAttrPtr attr,
int depth)
Dumps debug information for the attribute
| output: | the FILE * for the output |
| attr: | the attribute |
| depth: | the indentation level. |
void xmlDebugDumpAttrList (FILE * output,
xmlAttrPtr attr,
int depth)
Dumps debug information for the attribute list
| output: | the FILE * for the output |
| attr: | the attribute list |
| depth: | the indentation level. |
void xmlDebugDumpDTD (FILE * output,
xmlDtdPtr dtd)
Dumps debug information for the DTD
| output: | the FILE * for the output |
| dtd: | the DTD |
void xmlDebugDumpDocument (FILE * output,
xmlDocPtr doc)
Dumps debug information for the document, it's recursive
| output: | the FILE * for the output |
| doc: | the document |
void xmlDebugDumpDocumentHead (FILE * output,
xmlDocPtr doc)
Dumps debug information cncerning the document, not recursive
| output: | the FILE * for the output |
| doc: | the document |
void xmlDebugDumpEntities (FILE * output,
xmlDocPtr doc)
Dumps debug information for all the entities in use by the document
| output: | the FILE * for the output |
| doc: | the document |
void xmlDebugDumpNode (FILE * output,
xmlNodePtr node,
int depth)
Dumps debug information for the element node, it is recursive
| output: | the FILE * for the output |
| node: | the node |
| depth: | the indentation level. |
void xmlDebugDumpNodeList (FILE * output,
xmlNodePtr node,
int depth)
Dumps debug information for the list of element node, it is recursive
| output: | the FILE * for the output |
| node: | the node list |
| depth: | the indentation level. |
void xmlDebugDumpOneNode (FILE * output,
xmlNodePtr node,
int depth)
Dumps debug information for the element node, it is not recursive
| output: | the FILE * for the output |
| node: | the node |
| depth: | the indentation level. |
void xmlDebugDumpString (FILE * output,
const xmlChar * str)
Dumps informations about the string, shorten it if necessary
| output: | the FILE * for the output |
| str: | the string |
int xmlLsCountNode (xmlNodePtr node)
Count the children of @node.
| node: | the node to count |
| Returns: | the number of children of @node. |
void xmlLsOneNode (FILE * output,
xmlNodePtr node)
Dump to @output the type and name of @node.
| output: | the FILE * for the output |
| node: | the node to dump |
void xmlShell (xmlDocPtr doc,
char * filename,
xmlShellReadlineFunc input,
FILE * output)
Implements the XML shell This allow to load, validate, view, modify and save a document using a environment similar to a UNIX commandline.
| doc: | the initial document |
| filename: | the output buffer |
| input: | the line reading function |
| output: | the output FILE*, defaults to stdout if NULL |
int xmlShellBase (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "base" dumps the current XML base of the node
| ctxt: | the shell context |
| arg: | unused |
| node: | a node |
| node2: | unused |
| Returns: | 0 |
int xmlShellCat (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "cat" dumps the serialization node content (XML or HTML).
| ctxt: | the shell context |
| arg: | unused |
| node: | a node |
| node2: | unused |
| Returns: | 0 |
int xmlShellDir (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "dir" dumps informations about the node (namespace, attributes, content).
| ctxt: | the shell context |
| arg: | unused |
| node: | a node |
| node2: | unused |
| Returns: | 0 |
int xmlShellDu (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr tree,
xmlNodePtr node2)
Implements the XML shell function "du" show the structure of the subtree under node @tree If @tree is null, the command works on the current node.
| ctxt: | the shell context |
| arg: | unused |
| tree: | a node defining a subtree |
| node2: | unused |
| Returns: | 0 or -1 in case of error |
int xmlShellList (xmlShellCtxtPtr ctxt,
char * arg,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "ls" Does an Unix like listing of the given node (like a directory)
| ctxt: | the shell context |
| arg: | unused |
| node: | a node |
| node2: | unused |
| Returns: | 0 |
int xmlShellLoad (xmlShellCtxtPtr ctxt,
char * filename,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "load" loads a new document specified by the filename
| ctxt: | the shell context |
| filename: | the file name |
| node: | unused |
| node2: | unused |
| Returns: | 0 or -1 if loading failed |
void xmlShellPrintNode (xmlNodePtr node)
Print node to the output FILE
| node: | a non-null node to print to the output FILE |
void xmlShellPrintXPathError (int errorType,
const char * arg)
Print the xpath error to libxml default error channel
| errorType: | valid xpath error id |
| arg: | the argument that cause xpath to fail |
void xmlShellPrintXPathResult (xmlXPathObjectPtr list)
Prints result to the output FILE
| list: | a valid result generated by an xpath evaluation |
int xmlShellPwd (xmlShellCtxtPtr ctxt,
char * buffer,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "pwd" Show the full path from the root to the node, if needed building thumblers when similar elements exists at a given ancestor level. The output is compatible with XPath commands.
| ctxt: | the shell context |
| buffer: | the output buffer |
| node: | a node |
| node2: | unused |
| Returns: | 0 or -1 in case of error |
int xmlShellSave (xmlShellCtxtPtr ctxt,
char * filename,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "save" Write the current document to the filename, or it's original name
| ctxt: | the shell context |
| filename: | the file name (optional) |
| node: | unused |
| node2: | unused |
| Returns: | 0 or -1 in case of error |
int xmlShellValidate (xmlShellCtxtPtr ctxt,
char * dtd,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "validate" Validate the document, if a DTD path is provided, then the validation is done against the given DTD.
| ctxt: | the shell context |
| dtd: | the DTD URI (optional) |
| node: | unused |
| node2: | unused |
| Returns: | 0 or -1 in case of error |
int xmlShellWrite (xmlShellCtxtPtr ctxt,
char * filename,
xmlNodePtr node,
xmlNodePtr node2)
Implements the XML shell function "write" Write the current node to the filename, it saves the serialization of the subtree under the @node specified
| ctxt: | the shell context |
| filename: | the file name |
| node: | a node in the tree |
| node2: | unused |
| Returns: | 0 or -1 in case of error |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlstring - set of routines to process strings
type and interfaces needed for the internal string handling of the library, especially UTF8 processing.
Author(s): Daniel Veillard
#define BAD_CAST; typedef unsigned char xmlChar; int xmlStrcmp (const xmlChar * str1,
const xmlChar * str2); xmlChar * xmlCharStrndup (const char * cur,
int len); const xmlChar * xmlStrcasestr (const xmlChar * str,
const xmlChar * val); xmlChar * xmlStrcat (xmlChar * cur,
const xmlChar * add); int xmlStrPrintf (xmlChar * buf,
int len,
const char * msg,
... ...); const xmlChar * xmlStrstr (const xmlChar * str,
const xmlChar * val); int xmlUTF8Size (const xmlChar * utf); int xmlStrQEqual (const xmlChar * pref,
const xmlChar * name,
const xmlChar * str); xmlChar * xmlStrncatNew (const xmlChar * str1,
const xmlChar * str2,
int len); const xmlChar * xmlUTF8Strpos (const xmlChar * utf,
int pos); xmlChar * xmlStrdup (const xmlChar * cur); xmlChar * xmlCharStrdup (const char * cur); const xmlChar * xmlStrchr (const xmlChar * str,
xmlChar val); int xmlStrlen (const xmlChar * str); int xmlStrncmp (const xmlChar * str1,
const xmlChar * str2,
int len); xmlChar * xmlStrsub (const xmlChar * str,
int start,
int len); xmlChar * xmlStrncat (xmlChar * cur,
const xmlChar * add,
int len); int xmlGetUTF8Char (const unsigned char * utf,
int * len); int xmlStrcasecmp (const xmlChar * str1,
const xmlChar * str2); xmlChar * xmlStrndup (const xmlChar * cur,
int len); int xmlStrVPrintf (xmlChar * buf,
int len,
const char * msg,
va_list ap); int xmlUTF8Strsize (const xmlChar * utf,
int len); int xmlCheckUTF8 (const unsigned char * utf); int xmlStrncasecmp (const xmlChar * str1,
const xmlChar * str2,
int len); int xmlUTF8Strlen (const xmlChar * utf); xmlChar * xmlUTF8Strsub (const xmlChar * utf,
int start,
int len); int xmlStrEqual (const xmlChar * str1,
const xmlChar * str2); int xmlUTF8Charcmp (const xmlChar * utf1,
const xmlChar * utf2); xmlChar * xmlUTF8Strndup (const xmlChar * utf,
int len); int xmlUTF8Strloc (const xmlChar * utf,
const xmlChar * utfchar);
unsigned char xmlChar;
This is a basic byte in an UTF-8 encoded string. It's unsigned allowing to pinpoint case where char * are assigned to xmlChar * (possibly making serialization back impossible).
xmlChar * xmlCharStrdup (const char * cur)
a strdup for char's to xmlChar's
| cur: | the input char * |
| Returns: | a new xmlChar * or NULL |
xmlChar * xmlCharStrndup (const char * cur,
int len)
a strndup for char's to xmlChar's
| cur: | the input char * |
| len: | the len of @cur |
| Returns: | a new xmlChar * or NULL |
int xmlCheckUTF8 (const unsigned char * utf)
Checks @utf for being valid UTF-8. @utf is assumed to be null-terminated. This function is not super-strict, as it will allow longer UTF-8 sequences than necessary. Note that Java is capable of producing these sequences if provoked. Also note, this routine checks for the 4-byte maximum size, but does not check for 0x10ffff maximum value.
| utf: | Pointer to putative UTF-8 encoded string. |
| Returns: | value: true if @utf is valid. |
int xmlGetUTF8Char (const unsigned char * utf,
int * len)
Read the first UTF8 character from @utf
| utf: | a sequence of UTF-8 encoded bytes |
| len: | a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence. |
| Returns: | the char value or -1 in case of error, and sets *len to the actual number of bytes consumed (0 in case of error) |
int xmlStrEqual (const xmlChar * str1,
const xmlChar * str2)
Check if both strings are equal of have same content. Should be a bit more readable and faster than xmlStrcmp()
int xmlStrPrintf (xmlChar * buf,
int len,
const char * msg,
... ...)
Formats @msg and places result into @buf.
| buf: | the result buffer. |
| len: | the result buffer length. |
| msg: | the message with printf formatting. |
| ...: | extra parameters for the message. |
| Returns: | the number of characters written to @buf or -1 if an error occurs. |
int xmlStrQEqual (const xmlChar * pref,
const xmlChar * name,
const xmlChar * str)
Check if a QName is Equal to a given string
| pref: | the prefix of the QName |
| name: | the localname of the QName |
| str: | the second xmlChar * |
| Returns: | 1 if they are equal, 0 if they are different |
int xmlStrVPrintf (xmlChar * buf,
int len,
const char * msg,
va_list ap)
Formats @msg and places result into @buf.
| buf: | the result buffer. |
| len: | the result buffer length. |
| msg: | the message with printf formatting. |
| ap: | extra parameters for the message. |
| Returns: | the number of characters written to @buf or -1 if an error occurs. |
int xmlStrcasecmp (const xmlChar * str1,
const xmlChar * str2)
a strcasecmp for xmlChar's
const xmlChar * xmlStrcasestr (const xmlChar * str,
const xmlChar * val)
a case-ignoring strstr for xmlChar's
xmlChar * xmlStrcat (xmlChar * cur,
const xmlChar * add)
a strcat for array of xmlChar's. Since they are supposed to be encoded in UTF-8 or an encoding with 8bit based chars, we assume a termination mark of '0'.
xmlChar * xmlStrdup (const xmlChar * cur)
a strdup for array of xmlChar's. Since they are supposed to be encoded in UTF-8 or an encoding with 8bit based chars, we assume a termination mark of '0'.
int xmlStrncasecmp (const xmlChar * str1,
const xmlChar * str2,
int len)
a strncasecmp for xmlChar's
xmlChar * xmlStrncat (xmlChar * cur,
const xmlChar * add,
int len)
a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add. Note that if @len < 0 then this is an API error and NULL will be returned.
xmlChar * xmlStrncatNew (const xmlChar * str1,
const xmlChar * str2,
int len)
same as xmlStrncat, but creates a new string. The original two strings are not freed. If @len is < 0 then the length will be calculated automatically.
int xmlStrncmp (const xmlChar * str1,
const xmlChar * str2,
int len)
a strncmp for xmlChar's
const xmlChar * xmlStrstr (const xmlChar * str,
const xmlChar * val)
a strstr for xmlChar's
xmlChar * xmlStrsub (const xmlChar * str,
int start,
int len)
Extract a substring of a given string
int xmlUTF8Charcmp (const xmlChar * utf1,
const xmlChar * utf2)
compares the two UCS4 values
| utf1: | pointer to first UTF8 char |
| utf2: | pointer to second UTF8 char |
| Returns: | result of the compare as with xmlStrncmp |
int xmlUTF8Size (const xmlChar * utf)
calculates the internal size of a UTF8 character
| utf: | pointer to the UTF8 character |
| Returns: | the numbers of bytes in the character, -1 on format error |
int xmlUTF8Strlen (const xmlChar * utf)
compute the length of an UTF8 string, it doesn't do a full UTF8 checking of the content of the string.
| utf: | a sequence of UTF-8 encoded bytes |
| Returns: | the number of characters in the string or -1 in case of error |
int xmlUTF8Strloc (const xmlChar * utf,
const xmlChar * utfchar)
a function to provide the relative location of a UTF8 char
| utf: | the input UTF8 * |
| utfchar: | the UTF8 character to be found |
| Returns: | the relative character position of the desired char or -1 if not found |
xmlChar * xmlUTF8Strndup (const xmlChar * utf,
int len)
a strndup for array of UTF8's
| utf: | the input UTF8 * |
| len: | the len of @utf (in chars) |
| Returns: | a new UTF8 * or NULL |
const xmlChar * xmlUTF8Strpos (const xmlChar * utf,
int pos)
a function to provide the equivalent of fetching a character from a string array
| utf: | the input UTF8 * |
| pos: | the position of the desired UTF8 char (in chars) |
| Returns: | a pointer to the UTF8 character or NULL |
int xmlUTF8Strsize (const xmlChar * utf,
int len)
storage size of an UTF8 string the behaviour is not guaranteed if the input string is not UTF-8
| utf: | a sequence of UTF-8 encoded bytes |
| len: | the number of characters in the array |
| Returns: | the storage size of the first 'len' characters of ARRAY |
xmlChar * xmlUTF8Strsub (const xmlChar * utf,
int start,
int len)
Create a substring from a given UTF-8 string Note: positions are given in units of UTF-8 chars
| utf: | a sequence of UTF-8 encoded bytes |
| start: | relative pos of first char |
| len: | total number to copy |
| Returns: | a pointer to a newly created string or NULL if any problem |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xpathInternals - internal interfaces for XML Path Language implementation
internal interfaces for XML Path Language implementation used to build new modules on top of XPath like XPointer and XSLT
Author(s): Daniel Veillard
#define xmlXPathStackIsExternal(ctxt); #define xmlXPathReturnEmptyString(ctxt); #define XP_ERROR0(X); #define xmlXPathSetTypeError(ctxt); #define xmlXPathReturnEmptyNodeSet(ctxt); #define xmlXPathReturnTrue(ctxt); #define xmlXPathReturnBoolean(ctxt, val); #define xmlXPathGetContextNode(ctxt); #define CAST_TO_NUMBER; #define CHECK_ARITY(x); #define CHECK_TYPE0(typeval); #define CAST_TO_STRING; #define xmlXPathReturnExternal(ctxt, val); #define xmlXPathStackIsNodeSet(ctxt); #define xmlXPathCheckError(ctxt); #define xmlXPathSetError(ctxt, err); #define CHECK_ERROR; #define xmlXPathReturnString(ctxt, str); #define CAST_TO_BOOLEAN; #define xmlXPathSetArityError(ctxt); #define CHECK_TYPE(typeval); #define xmlXPathReturnFalse(ctxt); #define xmlXPathReturnNumber(ctxt, val); #define CHECK_ERROR0; #define xmlXPathGetDocument(ctxt); #define xmlXPathGetError(ctxt); #define XP_ERROR(X); #define xmlXPathEmptyNodeSet(ns); #define xmlXPathReturnNodeSet(ctxt, ns); xmlNodeSetPtr xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
xmlNodeSetPtr val2); void xmlXPathNumberFunction (xmlXPathParserContextPtr ctxt,
int nargs); const xmlChar * xmlXPathNsLookup (xmlXPathContextPtr ctxt,
const xmlChar * prefix); xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val); xmlNodePtr xmlXPathNextAncestorOrSelf (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); void xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
int val); xmlXPathObjectPtr xmlXPathNewNodeSetList (xmlNodeSetPtr val); int xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); xmlXPathObjectPtr xmlXPathNewString (const xmlChar * val); xmlNodeSetPtr xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node); xmlNodePtr xmlXPathNextChild (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); xmlNodePtr xmlXPathNextFollowingSibling (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); xmlChar * xmlXPathPopString (xmlXPathParserContextPtr ctxt); void xmlXPathNamespaceURIFunction (xmlXPathParserContextPtr ctxt,
int nargs); int xmlXPathCompareValues (xmlXPathParserContextPtr ctxt,
int inf,
int strict); void xmlXPathConcatFunction (xmlXPathParserContextPtr ctxt,
int nargs); int xmlXPathNodeSetContains (xmlNodeSetPtr cur,
xmlNodePtr val); void xmlXPatherror (xmlXPathParserContextPtr ctxt,
const char * file,
int line,
int no); xmlNodePtr xmlXPathNextAncestor (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); void xmlXPathBooleanFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathRoot (xmlXPathParserContextPtr ctxt); void xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); int xmlXPathIsNodeType (const xmlChar * name); xmlNodePtr xmlXPathNextFollowing (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); void xmlXPathAddValues (xmlXPathParserContextPtr ctxt); int xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
const xmlChar * name,
xmlXPathObjectPtr value); xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt); void xmlXPathCeilingFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlNodeSetPtr xmlXPathIntersection (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2); void xmlXPathContainsFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathNodeSetSort (xmlNodeSetPtr set); void xmlXPathStartsWithFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlNodeSetPtr xmlXPathNodeLeading (xmlNodeSetPtr nodes,
xmlNodePtr node); void xmlXPathSumFunction (xmlXPathParserContextPtr ctxt,
int nargs); int xmlXPathNotEqualValues (xmlXPathParserContextPtr ctxt); int xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr res); void xmlXPathErr (xmlXPathParserContextPtr ctxt,
int error); xmlNodePtr xmlXPathNextPreceding (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); xmlXPathFunction xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
const xmlChar * name,
const xmlChar * ns_uri); void xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); void xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); xmlXPathFunction xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
const xmlChar * name); void xmlXPathPositionFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathSubstringBeforeFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathRegisteredVariablesCleanup (xmlXPathContextPtr ctxt); xmlXPathObjectPtr xmlXPathNewFloat (double val); int xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
const xmlChar * prefix,
const xmlChar * ns_uri); xmlNodePtr xmlXPathNextParent (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); void xmlXPathNodeSetFreeNs (xmlNsPtr ns); int xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2); xmlNodeSetPtr xmlXPathDistinctSorted (xmlNodeSetPtr nodes); int valuePush (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr value); void xmlXPathSubstringFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathStringFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathFloorFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathLastFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathStringLengthFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlNodePtr xmlXPathNextSelf (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); void xmlXPathDebugDumpCompExpr (FILE * output,
xmlXPathCompExprPtr comp,
int depth); void xmlXPathFalseFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathValueFlipSign (xmlXPathParserContextPtr ctxt); void xmlXPathTranslateFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
xmlXPathFuncLookupFunc f,
void * funcCtxt); double xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); void xmlXPathRoundFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlNodeSetPtr xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); void xmlXPathCountFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlChar * xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); void xmlXPathTrueFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlXPathObjectPtr xmlXPathNewBoolean (int val); void xmlXPathSubValues (xmlXPathParserContextPtr ctxt); int xmlXPathEqualValues (xmlXPathParserContextPtr ctxt); xmlNodeSetPtr xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2); void xmlXPathMultValues (xmlXPathParserContextPtr ctxt); void xmlXPathModValues (xmlXPathParserContextPtr ctxt); xmlXPathParserContextPtr xmlXPathNewParserContext (const xmlChar * str,
xmlXPathContextPtr ctxt); xmlXPathObjectPtr xmlXPathWrapNodeSet (xmlNodeSetPtr val); xmlXPathObjectPtr xmlXPathWrapString (xmlChar * val); void xmlXPathLangFunction (xmlXPathParserContextPtr ctxt,
int nargs); int xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
const xmlChar * name,
const xmlChar * ns_uri,
xmlXPathFunction f); int xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
xmlNodePtr node,
xmlNsPtr ns); void xmlXPathLocalNameFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlNodeSetPtr xmlXPathDifference (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2); xmlNodeSetPtr xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2); xmlNodePtr xmlXPathNextPrecedingSibling (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); void * xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); void xmlXPathNormalizeFunction (xmlXPathParserContextPtr ctxt,
int nargs); void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
xmlXPathVariableLookupFunc f,
void * data); void xmlXPathNodeSetDel (xmlNodeSetPtr cur,
xmlNodePtr val); xmlNodeSetPtr xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node); xmlXPathObjectPtr xmlXPathNewCString (const char * val); int xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
const xmlChar * name,
xmlXPathFunction f); void xmlXPathSubstringAfterFunction (xmlXPathParserContextPtr ctxt,
int nargs); xmlNodePtr xmlXPathNextDescendant (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); xmlNodePtr xmlXPathNextNamespace (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); xmlXPathObjectPtr xmlXPathWrapCString (char * val); void xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); xmlNodeSetPtr xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
xmlNodePtr node); int xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
xmlNodePtr val); int xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
xmlNodePtr val); xmlXPathObjectPtr xmlXPathNewValueTree (xmlNodePtr val); xmlNodeSetPtr xmlXPathDistinct (xmlNodeSetPtr nodes); xmlXPathObjectPtr xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
const xmlChar * name); void xmlXPathNotFunction (xmlXPathParserContextPtr ctxt,
int nargs); double xmlXPathStringEvalNumber (const xmlChar * str); xmlNodePtr xmlXPathNextDescendantOrSelf (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); xmlXPathObjectPtr xmlXPathWrapExternal (void * val); xmlNodePtr xmlXPathNextAttribute (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur); void xmlXPathDivValues (xmlXPathParserContextPtr ctxt); xmlXPathObjectPtr xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
const xmlChar * name,
const xmlChar * ns_uri); int xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
const xmlChar * name,
const xmlChar * ns_uri,
xmlXPathObjectPtr value); xmlNodeSetPtr xmlXPathTrailing (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2); void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); void xmlXPathDebugDumpObject (FILE * output,
xmlXPathObjectPtr cur,
int depth); xmlNodeSetPtr xmlXPathLeading (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2); xmlChar * xmlXPathParseName (xmlXPathParserContextPtr ctxt);
#define CAST_TO_BOOLEAN;
Macro to try to cast the value on the top of the XPath stack to a boolean.
#define CAST_TO_NUMBER;
Macro to try to cast the value on the top of the XPath stack to a number.
#define CAST_TO_STRING;
Macro to try to cast the value on the top of the XPath stack to a string.
#define CHECK_ARITY(x);
Macro to check that the number of args passed to an XPath function matches.
| x: | the number of expected args |
#define CHECK_ERROR;
Macro to return from the function if an XPath error was detected.
#define CHECK_ERROR0;
Macro to return 0 from the function if an XPath error was detected.
#define CHECK_TYPE(typeval);
Macro to check that the value on top of the XPath stack is of a given type.
| typeval: | the XPath type |
#define CHECK_TYPE0(typeval);
Macro to check that the value on top of the XPath stack is of a given type. Return(0) in case of failure
| typeval: | the XPath type |
#define xmlXPathCheckError(ctxt);
Check if an XPath error was raised. Returns true if an error has been raised, false otherwise.
| ctxt: | an XPath parser context |
#define xmlXPathGetContextNode(ctxt);
Get the context node of an XPath context. Returns the context node.
| ctxt: | an XPath parser context |
#define xmlXPathGetDocument(ctxt);
Get the document of an XPath context. Returns the context document.
| ctxt: | an XPath parser context |
#define xmlXPathGetError(ctxt);
Get the error code of an XPath context. Returns the context error.
| ctxt: | an XPath parser context |
#define xmlXPathReturnBoolean(ctxt, val);
Pushes the boolean @val on the context stack.
| ctxt: | an XPath parser context |
| val: | a boolean |
#define xmlXPathReturnEmptyNodeSet(ctxt);
Pushes an empty node-set on the context stack.
| ctxt: | an XPath parser context |
#define xmlXPathReturnEmptyString(ctxt);
Pushes an empty string on the stack.
| ctxt: | an XPath parser context |
#define xmlXPathReturnExternal(ctxt, val);
Pushes user data on the context stack.
| ctxt: | an XPath parser context |
| val: | user data |
#define xmlXPathReturnFalse(ctxt);
Pushes false on the context stack.
| ctxt: | an XPath parser context |
#define xmlXPathReturnNodeSet(ctxt, ns);
Pushes the node-set @ns on the context stack.
| ctxt: | an XPath parser context |
| ns: | a node-set |
#define xmlXPathReturnNumber(ctxt, val);
Pushes the double @val on the context stack.
| ctxt: | an XPath parser context |
| val: | a double |
#define xmlXPathReturnString(ctxt, str);
Pushes the string @str on the context stack.
| ctxt: | an XPath parser context |
| str: | a string |
#define xmlXPathReturnTrue(ctxt);
Pushes true on the context stack.
| ctxt: | an XPath parser context |
#define xmlXPathSetArityError(ctxt);
Raises an XPATH_INVALID_ARITY error.
| ctxt: | an XPath parser context |
#define xmlXPathSetError(ctxt, err);
Raises an error.
| ctxt: | an XPath parser context |
| err: | an xmlXPathError code |
#define xmlXPathSetTypeError(ctxt);
Raises an XPATH_INVALID_TYPE error.
| ctxt: | an XPath parser context |
#define xmlXPathStackIsExternal(ctxt);
Checks if the current value on the XPath stack is an external object. Returns true if the current object on the stack is an external object.
| ctxt: | an XPath parser context |
#define xmlXPathStackIsNodeSet(ctxt);
Check if the current value on the XPath stack is a node set or an XSLT value tree. Returns true if the current object on the stack is a node-set.
| ctxt: | an XPath parser context |
xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt)
Pops the top XPath object from the value stack
| ctxt: | an XPath evaluation context |
| Returns: | the XPath object just removed |
int valuePush (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr value)
Pushes a new XPath object on top of the value stack
| ctxt: | an XPath evaluation context |
| value: | the XPath object |
| Returns: | the number of items on the value stack |
void xmlXPathAddValues (xmlXPathParserContextPtr ctxt)
Implement the add operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.
| ctxt: | the XPath Parser context |
void xmlXPathBooleanFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the boolean() XPath function boolean boolean(object) The boolean function converts its argument to a boolean as follows: - a number is true if and only if it is neither positive or negative zero nor NaN - a node-set is true if and only if it is non-empty - a string is true if and only if its length is non-zero
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathCeilingFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the ceiling() XPath function number ceiling(number) The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
int xmlXPathCompareValues (xmlXPathParserContextPtr ctxt,
int inf,
int strict)
Implement the compare operation on XPath objects: @arg1 < @arg2 (1, 1, ... @arg1 <= @arg2 (1, 0, ... @arg1 > @arg2 (0, 1, ... @arg1 >= @arg2 (0, 0, ... When neither object to be compared is a node-set and the operator is <=, <, >=, >, then the objects are compared by converted both objects to numbers and comparing the numbers according to IEEE 754. The < comparison will be true if and only if the first number is less than the second number. The <= comparison will be true if and only if the first number is less than or equal to the second number. The > comparison will be true if and only if the first number is greater than the second number. The >= comparison will be true if and only if the first number is greater than or equal to the second number.
| ctxt: | the XPath Parser context |
| inf: | less than (1) or greater than (0) |
| strict: | is the comparison strict |
| Returns: | 1 if the comparison succeeded, 0 if it failed |
void xmlXPathConcatFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the concat() XPath function string concat(string, string, string*) The concat function returns the concatenation of its arguments.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathContainsFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the contains() XPath function boolean contains(string, string) The contains function returns true if the first argument string contains the second argument string, and otherwise returns false.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathCountFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the count() XPath function number count(node-set)
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathDebugDumpCompExpr (FILE * output,
xmlXPathCompExprPtr comp,
int depth)
Dumps the tree of the compiled XPath expression.
| output: | the FILE * for the output |
| comp: | the precompiled XPath expression |
| depth: | the indentation level. |
void xmlXPathDebugDumpObject (FILE * output,
xmlXPathObjectPtr cur,
int depth)
Dump the content of the object for debugging purposes
| output: | the FILE * to dump the output |
| cur: | the object to inspect |
| depth: | indentation level |
xmlNodeSetPtr xmlXPathDifference (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2)
Implements the EXSLT - Sets difference() function: node-set set:difference (node-set, node-set)
| nodes1: | a node-set |
| nodes2: | a node-set |
| Returns: | the difference between the two node sets, or nodes1 if nodes2 is empty |
xmlNodeSetPtr xmlXPathDistinct (xmlNodeSetPtr nodes)
Implements the EXSLT - Sets distinct() function: node-set set:distinct (node-set) @nodes is sorted by document order, then #exslSetsDistinctSorted is called with the sorted node-set
| nodes: | a node-set |
| Returns: | a subset of the nodes contained in @nodes, or @nodes if it is empty |
xmlNodeSetPtr xmlXPathDistinctSorted (xmlNodeSetPtr nodes)
Implements the EXSLT - Sets distinct() function: node-set set:distinct (node-set)
| nodes: | a node-set, sorted by document order |
| Returns: | a subset of the nodes contained in @nodes, or @nodes if it is empty |
void xmlXPathDivValues (xmlXPathParserContextPtr ctxt)
Implement the div operation on XPath objects @arg1 / @arg2: The numeric operators convert their operands to numbers as if by calling the number function.
| ctxt: | the XPath Parser context |
int xmlXPathEqualValues (xmlXPathParserContextPtr ctxt)
Implement the equal operation on XPath objects content: @arg1 == @arg2
| ctxt: | the XPath Parser context |
| Returns: | 0 or 1 depending on the results of the test. |
void xmlXPathErr (xmlXPathParserContextPtr ctxt,
int error)
Handle an XPath error
| ctxt: | a XPath parser context |
| error: | the error code |
void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt)
Parse and evaluate an XPath expression in the given context, then push the result on the context stack
| ctxt: | the XPath Parser context |
int xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr res)
Evaluate a predicate result for the current node. A PredicateExpr is evaluated by evaluating the Expr and converting the result to a boolean. If the result is a number, the result will be converted to true if the number is equal to the position of the context node in the context node list (as returned by the position function) and will be converted to false otherwise; if the result is not a number, then the result will be converted as if by a call to the boolean function.
| ctxt: | the XPath Parser context |
| res: | the Predicate Expression evaluation result |
| Returns: | 1 if predicate is true, 0 otherwise |
void xmlXPathFalseFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the false() XPath function boolean false()
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathFloorFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the floor() XPath function number floor(number) The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt)
Free up an xmlXPathParserContext
| ctxt: | the context to free |
xmlXPathFunction xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
const xmlChar * name)
Search in the Function array of the context for the given function.
| ctxt: | the XPath context |
| name: | the function name |
| Returns: | the xmlXPathFunction or NULL if not found |
xmlXPathFunction xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
const xmlChar * name,
const xmlChar * ns_uri)
Search in the Function array of the context for the given function.
| ctxt: | the XPath context |
| name: | the function name |
| ns_uri: | the function namespace URI |
| Returns: | the xmlXPathFunction or NULL if not found |
int xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2)
Implements the EXSLT - Sets has-same-nodes function: boolean set:has-same-node(node-set, node-set)
| nodes1: | a node-set |
| nodes2: | a node-set |
| Returns: | true (1) if @nodes1 shares any node with @nodes2, false (0) otherwise |
void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the id() XPath function node-set id(object) The id function selects elements by their unique ID (see [5.2.1 Unique IDs]). When the argument to id is of type node-set, then the result is the union of the result of applying id to the string value of each of the nodes in the argument node-set. When the argument to id is of any other type, the argument is converted to a string as if by a call to the string function; the string is split into a whitespace-separated list of tokens (whitespace is any sequence of characters matching the production S); the result is a node-set containing the elements in the same document as the context node that have a unique ID equal to any of the tokens in the list.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
xmlNodeSetPtr xmlXPathIntersection (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2)
Implements the EXSLT - Sets intersection() function: node-set set:intersection (node-set, node-set)
| nodes1: | a node-set |
| nodes2: | a node-set |
| Returns: | a node set comprising the nodes that are within both the node sets passed as arguments |
int xmlXPathIsNodeType (const xmlChar * name)
Is the name given a NodeType one. [38] NodeType ::= 'comment' | 'text' | 'processing-instruction' | 'node'
| name: | a name string |
| Returns: | 1 if true 0 otherwise |
void xmlXPathLangFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the lang() XPath function boolean lang(string) The lang function returns true or false depending on whether the language of the context node as specified by xml:lang attributes is the same as or is a sublanguage of the language specified by the argument string. The language of the context node is determined by the value of the xml:lang attribute on the context node, or, if the context node has no xml:lang attribute, by the value of the xml:lang attribute on the nearest ancestor of the context node that has an xml:lang attribute. If there is no such attribute, then lang
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathLastFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the last() XPath function number last() The last function returns the number of nodes in the context node list.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
xmlNodeSetPtr xmlXPathLeading (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2)
Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set) @nodes1 and @nodes2 are sorted by document order, then #exslSetsLeadingSorted is called.
| nodes1: | a node-set |
| nodes2: | a node-set |
| Returns: | the nodes in @nodes1 that precede the first node in @nodes2 in document order, @nodes1 if @nodes2 is NULL or empty or an empty node-set if @nodes1 doesn't contain @nodes2 |
xmlNodeSetPtr xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2)
Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set)
| nodes1: | a node-set, sorted by document order |
| nodes2: | a node-set, sorted by document order |
| Returns: | the nodes in @nodes1 that precede the first node in @nodes2 in document order, @nodes1 if @nodes2 is NULL or empty or an empty node-set if @nodes1 doesn't contain @nodes2 |
void xmlXPathLocalNameFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the local-name() XPath function string local-name(node-set?) The local-name function returns a string containing the local part of the name of the node in the argument node-set that is first in document order. If the node-set is empty or the first node has no name, an empty string is returned. If the argument is omitted it defaults to the context node.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathModValues (xmlXPathParserContextPtr ctxt)
Implement the mod operation on XPath objects: @arg1 / @arg2 The numeric operators convert their operands to numbers as if by calling the number function.
| ctxt: | the XPath Parser context |
void xmlXPathMultValues (xmlXPathParserContextPtr ctxt)
Implement the multiply operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.
| ctxt: | the XPath Parser context |
void xmlXPathNamespaceURIFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the namespace-uri() XPath function string namespace-uri(node-set?) The namespace-uri function returns a string containing the namespace URI of the expanded name of the node in the argument node-set that is first in document order. If the node-set is empty, the first node has no name, or the expanded name has no namespace URI, an empty string is returned. If the argument is omitted it defaults to the context node.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
xmlXPathObjectPtr xmlXPathNewBoolean (int val)
Create a new xmlXPathObjectPtr of type boolean and of value @val
| val: | the boolean value |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPathNewCString (const char * val)
Create a new xmlXPathObjectPtr of type string and of value @val
| val: | the char * value |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPathNewFloat (double val)
Create a new xmlXPathObjectPtr of type double and of value @val
| val: | the double value |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val)
Create a new xmlXPathObjectPtr of type NodeSet and initialize it with the single Node @val
| val: | the NodePtr value |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPathNewNodeSetList (xmlNodeSetPtr val)
Create a new xmlXPathObjectPtr of type NodeSet and initialize it with the Nodeset @val
| val: | an existing NodeSet |
| Returns: | the newly created object. |
xmlXPathParserContextPtr xmlXPathNewParserContext (const xmlChar * str,
xmlXPathContextPtr ctxt)
Create a new xmlXPathParserContext
| str: | the XPath expression |
| ctxt: | the XPath context |
| Returns: | the xmlXPathParserContext just allocated. |
xmlXPathObjectPtr xmlXPathNewString (const xmlChar * val)
Create a new xmlXPathObjectPtr of type string and of value @val
| val: | the xmlChar * value |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPathNewValueTree (xmlNodePtr val)
Create a new xmlXPathObjectPtr of type Value Tree (XSLT) and initialize it with the tree root @val
| val: | the NodePtr value |
| Returns: | the newly created object. |
xmlNodePtr xmlXPathNextAncestor (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "ancestor" direction the ancestor axis contains the ancestors of the context node; the ancestors of the context node consist of the parent of context node and the parent's parent and so on; the nodes are ordered in reverse document order; thus the parent is the first node on the axis, and the parent's parent is the second node on the axis
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextAncestorOrSelf (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "ancestor-or-self" direction he ancestor-or-self axis contains the context node and ancestors of the context node in reverse document order; thus the context node is the first node on the axis, and the context node's parent the second; parent here is defined the same as with the parent axis.
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextAttribute (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "attribute" direction TODO: support DTD inherited default attributes
| ctxt: | the XPath Parser context |
| cur: | the current attribute in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextChild (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "child" direction The child axis contains the children of the context node in document order.
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextDescendant (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "descendant" direction the descendant axis contains the descendants of the context node in document order; a descendant is a child or a child of a child and so on.
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextDescendantOrSelf (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "descendant-or-self" direction the descendant-or-self axis contains the context node and the descendants of the context node in document order; thus the context node is the first node on the axis, and the first child of the context node is the second node on the axis
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextFollowing (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "following" direction The following axis contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes and namespace nodes; the nodes are ordered in document order
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextFollowingSibling (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "following-sibling" direction The following-sibling axis contains the following siblings of the context node in document order.
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextNamespace (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "namespace" direction the namespace axis contains the namespace nodes of the context node; the order of nodes on this axis is implementation-defined; the axis will be empty unless the context node is an element We keep the XML namespace node at the end of the list.
| ctxt: | the XPath Parser context |
| cur: | the current attribute in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextParent (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "parent" direction The parent axis contains the parent of the context node, if there is one.
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextPreceding (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "preceding" direction the preceding axis contains all nodes in the same document as the context node that are before the context node in document order, excluding any ancestors and excluding attribute nodes and namespace nodes; the nodes are ordered in reverse document order
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextPrecedingSibling (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "preceding-sibling" direction The preceding-sibling axis contains the preceding siblings of the context node in reverse document order; the first preceding sibling is first on the axis; the sibling preceding that node is the second on the axis and so on.
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodePtr xmlXPathNextSelf (xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
Traversal function for the "self" direction The self axis contains just the context node itself
| ctxt: | the XPath Parser context |
| cur: | the current node in the traversal |
| Returns: | the next element following that axis |
xmlNodeSetPtr xmlXPathNodeLeading (xmlNodeSetPtr nodes,
xmlNodePtr node)
Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set) @nodes is sorted by document order, then #exslSetsNodeLeadingSorted is called.
| nodes: | a node-set |
| node: | a node |
| Returns: | the nodes in @nodes that precede @node in document order, @nodes if @node is NULL or an empty node-set if @nodes doesn't contain @node |
xmlNodeSetPtr xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node)
Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set)
| nodes: | a node-set, sorted by document order |
| node: | a node |
| Returns: | the nodes in @nodes that precede @node in document order, @nodes if @node is NULL or an empty node-set if @nodes doesn't contain @node |
int xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
xmlNodePtr val)
add a new xmlNodePtr to an existing NodeSet
| cur: | the initial node set |
| val: | a new xmlNodePtr |
| Returns: | 0 in case of success, and -1 in case of error |
int xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
xmlNodePtr node,
xmlNsPtr ns)
add a new namespace node to an existing NodeSet
| cur: | the initial node set |
| node: | the hosting node |
| ns: | a the namespace node |
| Returns: | 0 in case of success and -1 in case of error |
int xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
xmlNodePtr val)
add a new xmlNodePtr to an existing NodeSet, optimized version when we are sure the node is not already in the set.
| cur: | the initial node set |
| val: | a new xmlNodePtr |
| Returns: | 0 in case of success and -1 in case of failure |
int xmlXPathNodeSetContains (xmlNodeSetPtr cur,
xmlNodePtr val)
checks whether @cur contains @val
| cur: | the node-set |
| val: | the node |
| Returns: | true (1) if @cur contains @val, false (0) otherwise |
void xmlXPathNodeSetDel (xmlNodeSetPtr cur,
xmlNodePtr val)
Removes an xmlNodePtr from an existing NodeSet
| cur: | the initial node set |
| val: | an xmlNodePtr |
void xmlXPathNodeSetFreeNs (xmlNsPtr ns)
Namespace nodes in libxml don't match the XPath semantic. In a node set the namespace nodes are duplicated and the next pointer is set to the parent node in the XPath semantic. Check if such a node needs to be freed
| ns: | the XPath namespace node found in a nodeset. |
xmlNodeSetPtr xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
xmlNodeSetPtr val2)
Merges two nodesets, all nodes from @val2 are added to @val1 if @val1 is NULL, a new set is created and copied from @val2
| val1: | the first NodeSet or NULL |
| val2: | the second NodeSet |
| Returns: | @val1 once extended or NULL in case of error. |
void xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
int val)
Removes an entry from an existing NodeSet list.
| cur: | the initial node set |
| val: | the index to remove |
void xmlXPathNodeSetSort (xmlNodeSetPtr set)
Sort the node set in document order
| set: | the node set |
xmlNodeSetPtr xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
xmlNodePtr node)
Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set) @nodes is sorted by document order, then #xmlXPathNodeTrailingSorted is called.
| nodes: | a node-set |
| node: | a node |
| Returns: | the nodes in @nodes that follow @node in document order, @nodes if @node is NULL or an empty node-set if @nodes doesn't contain @node |
xmlNodeSetPtr xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node)
Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set)
| nodes: | a node-set, sorted by document order |
| node: | a node |
| Returns: | the nodes in @nodes that follow @node in document order, @nodes if @node is NULL or an empty node-set if @nodes doesn't contain @node |
void xmlXPathNormalizeFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the normalize-space() XPath function string normalize-space(string?) The normalize-space function returns the argument string with white space normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space. Whitespace characters are the same allowed by the S production in XML. If the argument is omitted, it defaults to the context node converted to a string, in other words the value of the context node.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
int xmlXPathNotEqualValues (xmlXPathParserContextPtr ctxt)
Implement the equal operation on XPath objects content: @arg1 == @arg2
| ctxt: | the XPath Parser context |
| Returns: | 0 or 1 depending on the results of the test. |
void xmlXPathNotFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the not() XPath function boolean not(boolean) The not function returns true if its argument is false, and false otherwise.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
const xmlChar * xmlXPathNsLookup (xmlXPathContextPtr ctxt,
const xmlChar * prefix)
Search in the namespace declaration array of the context for the given namespace name associated to the given prefix
| ctxt: | the XPath context |
| prefix: | the namespace prefix value |
| Returns: | the value or NULL if not found |
void xmlXPathNumberFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the number() XPath function number number(object?)
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
xmlChar * xmlXPathParseNCName (xmlXPathParserContextPtr ctxt)
parse an XML namespace non qualified name. [NS 3] NCName ::= (Letter | '_') (NCNameChar)* [NS 4] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
| ctxt: | the XPath Parser context |
| Returns: | the namespace name or NULL |
xmlChar * xmlXPathParseName (xmlXPathParserContextPtr ctxt)
parse an XML name [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::= (Letter | '_' | ':') (NameChar)*
| ctxt: | the XPath Parser context |
| Returns: | the namespace name or NULL |
int xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt)
Pops a boolean from the stack, handling conversion if needed. Check error with #xmlXPathCheckError.
| ctxt: | an XPath parser context |
| Returns: | the boolean |
void * xmlXPathPopExternal (xmlXPathParserContextPtr ctxt)
Pops an external object from the stack, handling conversion if needed. Check error with #xmlXPathCheckError.
| ctxt: | an XPath parser context |
| Returns: | the object |
xmlNodeSetPtr xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt)
Pops a node-set from the stack, handling conversion if needed. Check error with #xmlXPathCheckError.
| ctxt: | an XPath parser context |
| Returns: | the node-set |
double xmlXPathPopNumber (xmlXPathParserContextPtr ctxt)
Pops a number from the stack, handling conversion if needed. Check error with #xmlXPathCheckError.
| ctxt: | an XPath parser context |
| Returns: | the number |
xmlChar * xmlXPathPopString (xmlXPathParserContextPtr ctxt)
Pops a string from the stack, handling conversion if needed. Check error with #xmlXPathCheckError.
| ctxt: | an XPath parser context |
| Returns: | the string |
void xmlXPathPositionFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the position() XPath function number position() The position function returns the position of the context node in the context node list. The first position is 1, and so the last position will be equal to last().
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt)
Registers all default XPath functions in this context
| ctxt: | the XPath context |
int xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
const xmlChar * name,
xmlXPathFunction f)
Register a new function. If @f is NULL it unregisters the function
| ctxt: | the XPath context |
| name: | the function name |
| f: | the function implementation or NULL |
| Returns: | 0 in case of success, -1 in case of error |
void xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
xmlXPathFuncLookupFunc f,
void * funcCtxt)
Registers an external mechanism to do function lookup.
| ctxt: | the XPath context |
| f: | the lookup function |
| funcCtxt: | the lookup data |
int xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
const xmlChar * name,
const xmlChar * ns_uri,
xmlXPathFunction f)
Register a new function. If @f is NULL it unregisters the function
| ctxt: | the XPath context |
| name: | the function name |
| ns_uri: | the function namespace URI |
| f: | the function implementation or NULL |
| Returns: | 0 in case of success, -1 in case of error |
int xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
const xmlChar * prefix,
const xmlChar * ns_uri)
Register a new namespace. If @ns_uri is NULL it unregisters the namespace
| ctxt: | the XPath context |
| prefix: | the namespace prefix cannot be NULL or empty string |
| ns_uri: | the namespace name |
| Returns: | 0 in case of success, -1 in case of error |
int xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
const xmlChar * name,
xmlXPathObjectPtr value)
Register a new variable value. If @value is NULL it unregisters the variable
| ctxt: | the XPath context |
| name: | the variable name |
| value: | the variable value or NULL |
| Returns: | 0 in case of success, -1 in case of error |
void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
xmlXPathVariableLookupFunc f,
void * data)
register an external mechanism to do variable lookup
| ctxt: | the XPath context |
| f: | the lookup function |
| data: | the lookup data |
int xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
const xmlChar * name,
const xmlChar * ns_uri,
xmlXPathObjectPtr value)
Register a new variable value. If @value is NULL it unregisters the variable
| ctxt: | the XPath context |
| name: | the variable name |
| ns_uri: | the variable namespace URI |
| value: | the variable value or NULL |
| Returns: | 0 in case of success, -1 in case of error |
void xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt)
Cleanup the XPath context data associated to registered functions
| ctxt: | the XPath context |
void xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt)
Cleanup the XPath context data associated to registered variables
| ctxt: | the XPath context |
void xmlXPathRegisteredVariablesCleanup (xmlXPathContextPtr ctxt)
Cleanup the XPath context data associated to registered variables
| ctxt: | the XPath context |
void xmlXPathRoot (xmlXPathParserContextPtr ctxt)
Initialize the context to the root of the document
| ctxt: | the XPath Parser context |
void xmlXPathRoundFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the round() XPath function number round(number) The round function returns the number that is closest to the argument and that is an integer. If there are two such numbers, then the one that is closest to positive infinity is returned.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathStartsWithFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the starts-with() XPath function boolean starts-with(string, string) The starts-with function returns true if the first argument string starts with the second argument string, and otherwise returns false.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
double xmlXPathStringEvalNumber (const xmlChar * str)
[30a] Float ::= Number ('e' Digits?)? [30] Number ::= Digits ('.' Digits?)? | '.' Digits [31] Digits ::= [0-9]+ Compile a Number in the string In complement of the Number expression, this function also handles negative values : '-' Number.
| str: | A string to scan |
| Returns: | the double value. |
void xmlXPathStringFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the string() XPath function string string(object?) The string function converts an object to a string as follows: - A node-set is converted to a string by returning the value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned. - A number is converted to a string as follows + NaN is converted to the string NaN + positive zero is converted to the string 0 + negative zero is converted to the string 0 + positive infinity is converted to the string Infinity + negative infinity is converted to the string -Infinity + if the number is an integer, the number is represented in decimal form as a Number with no decimal point and no leading zeros, preceded by a minus sign (-) if the number is negative + otherwise, the number is represented in decimal form as a Number including a decimal point with at least one digit before the decimal point and at least one digit after the decimal point, preceded by a minus sign (-) if the number is negative; there must be no leading zeros before the decimal point apart possibly from the one required digit immediately before the decimal point; beyond the one required digit after the decimal point there must be as many, but only as many, more digits as are needed to uniquely distinguish the number from all other IEEE 754 numeric values. - The boolean false value is converted to the string false. The boolean true value is converted to the string true. If the argument is omitted, it defaults to a node-set with the context node as its only member.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathStringLengthFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the string-length() XPath function number string-length(string?) The string-length returns the number of characters in the string (see [3.6 Strings]). If the argument is omitted, it defaults to the context node converted to a string, in other words the value of the context node.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathSubValues (xmlXPathParserContextPtr ctxt)
Implement the subtraction operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.
| ctxt: | the XPath Parser context |
void xmlXPathSubstringAfterFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the substring-after() XPath function string substring-after(string, string) The substring-after function returns the substring of the first argument string that follows the first occurrence of the second argument string in the first argument string, or the empty stringi if the first argument string does not contain the second argument string. For example, substring-after("1999/04/01","/") returns 04/01, and substring-after("1999/04/01","19") returns 99/04/01.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathSubstringBeforeFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the substring-before() XPath function string substring-before(string, string) The substring-before function returns the substring of the first argument string that precedes the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string. For example, substring-before("1999/04/01","/") returns 1999.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathSubstringFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the substring() XPath function string substring(string, number, number?) The substring function returns the substring of the first argument starting at the position specified in the second argument with length specified in the third argument. For example, substring("12345",2,3) returns "234". If the third argument is not specified, it returns the substring starting at the position specified in the second argument and continuing to the end of the string. For example, substring("12345",2) returns "2345". More precisely, each character in the string (see [3.6 Strings]) is considered to have a numeric position: the position of the first character is 1, the position of the second character is 2 and so on. The returned substring contains those characters for which the position of the character is greater than or equal to the second argument and, if the third argument is specified, less than the sum of the second and third arguments; the comparisons and addition used for the above follow the standard IEEE 754 rules. Thus: - substring("12345", 1.5, 2.6) returns "234" - substring("12345", 0, 3) returns "12" - substring("12345", 0 div 0, 3) returns "" - substring("12345", 1, 0 div 0) returns "" - substring("12345", -42, 1 div 0) returns "12345" - substring("12345", -1 div 0, 1 div 0) returns ""
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathSumFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the sum() XPath function number sum(node-set) The sum function returns the sum of the values of the nodes in the argument node-set.
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
xmlNodeSetPtr xmlXPathTrailing (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2)
Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set) @nodes1 and @nodes2 are sorted by document order, then #xmlXPathTrailingSorted is called.
| nodes1: | a node-set |
| nodes2: | a node-set |
| Returns: | the nodes in @nodes1 that follow the first node in @nodes2 in document order, @nodes1 if @nodes2 is NULL or empty or an empty node-set if @nodes1 doesn't contain @nodes2 |
xmlNodeSetPtr xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2)
Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set)
| nodes1: | a node-set, sorted by document order |
| nodes2: | a node-set, sorted by document order |
| Returns: | the nodes in @nodes1 that follow the first node in @nodes2 in document order, @nodes1 if @nodes2 is NULL or empty or an empty node-set if @nodes1 doesn't contain @nodes2 |
void xmlXPathTranslateFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the translate() XPath function string translate(string, string, string) The translate function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string. For example, translate("bar","abc","ABC") returns the string BAr. If there is a character in the second argument string with no character at a corresponding position in the third argument string (because the second argument string is longer than the third argument string), then occurrences of that character in the first argument string are removed. For example, translate("--aaa--","abc-","ABC")
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathTrueFunction (xmlXPathParserContextPtr ctxt,
int nargs)
Implement the true() XPath function boolean true()
| ctxt: | the XPath Parser context |
| nargs: | the number of arguments |
void xmlXPathValueFlipSign (xmlXPathParserContextPtr ctxt)
Implement the unary - operation on an XPath object The numeric operators convert their operands to numbers as if by calling the number function.
| ctxt: | the XPath Parser context |
xmlXPathObjectPtr xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
const xmlChar * name)
Search in the Variable array of the context for the given variable value.
| ctxt: | the XPath context |
| name: | the variable name |
| Returns: | a copy of the value or NULL if not found |
xmlXPathObjectPtr xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
const xmlChar * name,
const xmlChar * ns_uri)
Search in the Variable array of the context for the given variable value.
| ctxt: | the XPath context |
| name: | the variable name |
| ns_uri: | the variable namespace URI |
| Returns: | the a copy of the value or NULL if not found |
xmlXPathObjectPtr xmlXPathWrapCString (char * val)
Wraps a string into an XPath object.
| val: | the char * value |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPathWrapExternal (void * val)
Wraps the @val data into an XPath object.
| val: | the user data |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPathWrapNodeSet (xmlNodeSetPtr val)
Wrap the Nodeset @val in a new xmlXPathObjectPtr
| val: | the NodePtr value |
| Returns: | the newly created object. |
xmlXPathObjectPtr xmlXPathWrapString (xmlChar * val)
Wraps the @val string into an XPath object.
| val: | the xmlChar * value |
| Returns: | the newly created object. |
void xmlXPatherror (xmlXPathParserContextPtr ctxt,
const char * file,
int line,
int no)
Formats an error message.
| ctxt: | the XPath Parser context |
| file: | the file name |
| line: | the line number |
| no: | the error number |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlexports - macros for marking symbols as exportable/importable.
macros for marking symbols as exportable/importable.
Author(s): Igor Zlatovic <igor@zlatkovic.com>
#define _REENTRANT; #define XMLCDECL; #define XMLPUBVAR; #define LIBXML_DLL_IMPORT; #define XMLCALL; #define XMLPUBFUN;
|
|
|
|
|
libxml2 Reference Manual |
|---|
pattern - pattern expression handling
allows to compile and test pattern expressions for nodes either in a tree or based on a parser state.
Author(s): Daniel Veillard
typedef xmlStreamCtxt * xmlStreamCtxtPtr; typedef enum xmlPatternFlags; typedef struct _xmlStreamCtxt xmlStreamCtxt; typedef struct _xmlPattern xmlPattern; typedef xmlPattern * xmlPatternPtr; int xmlPatternMinDepth (xmlPatternPtr comp); xmlStreamCtxtPtr xmlPatternGetStreamCtxt (xmlPatternPtr comp); int xmlPatternFromRoot (xmlPatternPtr comp); void xmlFreePatternList (xmlPatternPtr comp); int xmlPatternStreamable (xmlPatternPtr comp); int xmlStreamPushAttr (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns); int xmlPatternMatch (xmlPatternPtr comp,
xmlNodePtr node); int xmlStreamWantsAnyNode (xmlStreamCtxtPtr streamCtxt); int xmlStreamPop (xmlStreamCtxtPtr stream); void xmlFreePattern (xmlPatternPtr comp); int xmlStreamPush (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns); int xmlPatternMaxDepth (xmlPatternPtr comp); xmlPatternPtr xmlPatterncompile (const xmlChar * pattern,
xmlDict * dict,
int flags,
const xmlChar ** namespaces); int xmlStreamPushNode (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns,
int nodeType); void xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
struct _xmlPattern {
The content of this structure is not made public by the API.
} xmlPattern;
enum xmlPatternFlags { XML_PATTERN_DEFAULT = 0 /* simple pattern match */ XML_PATTERN_XPATH = 1 /* standard XPath pattern */ XML_PATTERN_XSSEL = 2 /* XPath subset for schema selector */ XML_PATTERN_XSFIELD = 4 /* XPath subset for schema field */ };
xmlPattern * xmlPatternPtr;
struct _xmlStreamCtxt {
The content of this structure is not made public by the API.
} xmlStreamCtxt;
xmlStreamCtxt * xmlStreamCtxtPtr;
void xmlFreePattern (xmlPatternPtr comp)
Free up the memory allocated by @comp
| comp: | an XSLT comp |
void xmlFreePatternList (xmlPatternPtr comp)
Free up the memory allocated by all the elements of @comp
| comp: | an XSLT comp list |
void xmlFreeStreamCtxt (xmlStreamCtxtPtr stream)
Free the stream context
| stream: | the stream context |
int xmlPatternFromRoot (xmlPatternPtr comp)
Check if the pattern must be looked at from the root.
| comp: | the precompiled pattern |
| Returns: | 1 if true, 0 if false and -1 in case of error |
xmlStreamCtxtPtr xmlPatternGetStreamCtxt (xmlPatternPtr comp)
Get a streaming context for that pattern Use xmlFreeStreamCtxt to free the context.
| comp: | the precompiled pattern |
| Returns: | a pointer to the context or NULL in case of failure |
int xmlPatternMatch (xmlPatternPtr comp,
xmlNodePtr node)
Test whether the node matches the pattern
| comp: | the precompiled pattern |
| node: | a node |
| Returns: | 1 if it matches, 0 if it doesn't and -1 in case of failure |
int xmlPatternMaxDepth (xmlPatternPtr comp)
Check the maximum depth reachable by a pattern
| comp: | the precompiled pattern |
| Returns: | -2 if no limit (using //), otherwise the depth, and -1 in case of error |
int xmlPatternMinDepth (xmlPatternPtr comp)
Check the minimum depth reachable by a pattern, 0 mean the / or . are part of the set.
| comp: | the precompiled pattern |
| Returns: | -1 in case of error otherwise the depth, |
int xmlPatternStreamable (xmlPatternPtr comp)
Check if the pattern is streamable i.e. xmlPatternGetStreamCtxt() should work.
| comp: | the precompiled pattern |
| Returns: | 1 if streamable, 0 if not and -1 in case of error. |
xmlPatternPtr xmlPatterncompile (const xmlChar * pattern,
xmlDict * dict,
int flags,
const xmlChar ** namespaces)
Compile a pattern.
| pattern: | the pattern to compile |
| dict: | an optional dictionary for interned strings |
| flags: | compilation flags, see xmlPatternFlags |
| namespaces: | the prefix definitions, array of [URI, prefix] or NULL |
| Returns: | the compiled form of the pattern or NULL in case of error |
int xmlStreamPop (xmlStreamCtxtPtr stream)
push one level from the stream.
| stream: | the stream context |
| Returns: | -1 in case of error, 0 otherwise. |
int xmlStreamPush (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns)
Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an element-node.
| stream: | the stream context |
| name: | the current name |
| ns: | the namespace name |
| Returns: | -1 in case of error, 1 if the current state in the stream is a match and 0 otherwise. |
int xmlStreamPushAttr (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns)
Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Otherwise the function will act as if it has been given an attribute-node.
| stream: | the stream context |
| name: | the current name |
| ns: | the namespace name |
| Returns: | -1 in case of error, 1 if the current state in the stream is a match and 0 otherwise. |
int xmlStreamPushNode (xmlStreamCtxtPtr stream,
const xmlChar * name,
const xmlChar * ns,
int nodeType)
Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset. Different from xmlStreamPush() this function can be fed with nodes of type: element-, attribute-, text-, cdata-section-, comment- and processing-instruction-node.
| stream: | the stream context |
| name: | the current name |
| ns: | the namespace name |
| nodeType: | the type of the node being pushed |
| Returns: | -1 in case of error, 1 if the current state in the stream is a match and 0 otherwise. |
int xmlStreamWantsAnyNode (xmlStreamCtxtPtr streamCtxt)
Query if the streaming pattern additionally needs to be fed with text-, cdata-section-, comment- and processing-instruction-nodes. If the result is 0 then only element-nodes and attribute-nodes need to be pushed.
| streamCtxt: | the stream context |
| Returns: | 1 in case of need of nodes of the above described types, 0 otherwise. -1 on API errors. |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlautomata - API to build regexp automata
the API to build regexp automata
Author(s): Daniel Veillard
typedef xmlAutomataState * xmlAutomataStatePtr; typedef struct _xmlAutomata xmlAutomata; typedef xmlAutomata * xmlAutomataPtr; typedef struct _xmlAutomataState xmlAutomataState; void xmlFreeAutomata (xmlAutomataPtr am); int xmlAutomataNewCounter (xmlAutomataPtr am,
int min,
int max); xmlAutomataStatePtr xmlAutomataGetInitState (xmlAutomataPtr am); xmlAutomataStatePtr xmlAutomataNewTransition2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
const xmlChar * token2,
void * data); xmlAutomataStatePtr xmlAutomataNewState (xmlAutomataPtr am); xmlAutomataStatePtr xmlAutomataNewCountTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
int min,
int max,
void * data); xmlAutomataStatePtr xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
const xmlChar * token2,
int min,
int max,
void * data); xmlAutomataStatePtr xmlAutomataNewAllTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int lax); xmlAutomataStatePtr xmlAutomataNewCountedTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter); xmlAutomataStatePtr xmlAutomataNewCounterTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter); xmlRegexpPtr xmlAutomataCompile (xmlAutomataPtr am); xmlAutomataStatePtr xmlAutomataNewNegTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
const xmlChar * token2,
void * data); xmlAutomataStatePtr xmlAutomataNewEpsilon (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to); xmlAutomataStatePtr xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
const xmlChar * token2,
int min,
int max,
void * data); xmlAutomataPtr xmlNewAutomata (void); int xmlAutomataSetFinalState (xmlAutomataPtr am,
xmlAutomataStatePtr state); xmlAutomataStatePtr xmlAutomataNewOnceTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
int min,
int max,
void * data); xmlAutomataStatePtr xmlAutomataNewTransition (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
void * data); int xmlAutomataIsDeterminist (xmlAutomataPtr am);
struct _xmlAutomata {
The content of this structure is not made public by the API.
} xmlAutomata;
xmlAutomata * xmlAutomataPtr;
A libxml automata description, It can be compiled into a regexp
struct _xmlAutomataState {
The content of this structure is not made public by the API.
} xmlAutomataState;
xmlAutomataState * xmlAutomataStatePtr;
A state int the automata description,
xmlRegexpPtr xmlAutomataCompile (xmlAutomataPtr am)
Compile the automata into a Reg Exp ready for being executed. The automata should be free after this point.
| am: | an automata |
| Returns: | the compiled regexp or NULL in case of error |
xmlAutomataStatePtr xmlAutomataGetInitState (xmlAutomataPtr am)
Initial state lookup
| am: | an automata |
| Returns: | the initial state of the automata |
int xmlAutomataIsDeterminist (xmlAutomataPtr am)
Checks if an automata is determinist.
| am: | an automata |
| Returns: | 1 if true, 0 if not, and -1 in case of error |
xmlAutomataStatePtr xmlAutomataNewAllTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int lax)
If @to is NULL, this creates first a new target state in the automata and then adds a an ALL transition from the @from state to the target state. That transition is an epsilon transition allowed only when all transitions from the @from node have been activated.
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| lax: | allow to transition if not all all transitions have been activated |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewCountTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
int min,
int max,
void * data)
If @to is NULL, this creates first a new target state in the automata and then adds a transition from the @from state to the target state activated by a succession of input of value @token and whose number is between @min and @max
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| token: | the input string associated to that transition |
| min: | the minimum successive occurences of token |
| max: | the maximum successive occurences of token |
| data: | data associated to the transition |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
const xmlChar * token2,
int min,
int max,
void * data)
If @to is NULL, this creates first a new target state in the automata and then adds a transition from the @from state to the target state activated by a succession of input of value @token and @token2 and whose number is between @min and @max
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| token: | the input string associated to that transition |
| token2: | the second input string associated to that transition |
| min: | the minimum successive occurences of token |
| max: | the maximum successive occurences of token |
| data: | data associated to the transition |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewCountedTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter)
If @to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the @from state to the target state which will increment the counter provided
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| counter: | the counter associated to that transition |
| Returns: | the target state or NULL in case of error |
int xmlAutomataNewCounter (xmlAutomataPtr am,
int min,
int max)
Create a new counter
| am: | an automata |
| min: | the minimal value on the counter |
| max: | the maximal value on the counter |
| Returns: | the counter number or -1 in case of error |
xmlAutomataStatePtr xmlAutomataNewCounterTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter)
If @to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the @from state to the target state which will be allowed only if the counter is within the right range.
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| counter: | the counter associated to that transition |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewEpsilon (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to)
If @to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the @from state to the target state
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewNegTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
const xmlChar * token2,
void * data)
If @to is NULL, this creates first a new target state in the automata and then adds a transition from the @from state to the target state activated by any value except (@token,@token2) Note that if @token2 is not NULL, then (X, NULL) won't match to follow # the semantic of XSD ##other
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| token: | the first input string associated to that transition |
| token2: | the second input string associated to that transition |
| data: | data passed to the callback function if the transition is activated |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewOnceTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
int min,
int max,
void * data)
If @to is NULL, this creates first a new target state in the automata and then adds a transition from the @from state to the target state activated by a succession of input of value @token and whose number is between @min and @max, moreover that transition can only be crossed once.
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| token: | the input string associated to that transition |
| min: | the minimum successive occurences of token |
| max: | the maximum successive occurences of token |
| data: | data associated to the transition |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
const xmlChar * token2,
int min,
int max,
void * data)
If @to is NULL, this creates first a new target state in the automata and then adds a transition from the @from state to the target state activated by a succession of input of value @token and @token2 and whose number is between @min and @max, moreover that transition can only be crossed once.
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| token: | the input string associated to that transition |
| token2: | the second input string associated to that transition |
| min: | the minimum successive occurences of token |
| max: | the maximum successive occurences of token |
| data: | data associated to the transition |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewState (xmlAutomataPtr am)
Create a new disconnected state in the automata
| am: | an automata |
| Returns: | the new state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewTransition (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
void * data)
If @to is NULL, this creates first a new target state in the automata and then adds a transition from the @from state to the target state activated by the value of @token
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| token: | the input string associated to that transition |
| data: | data passed to the callback function if the transition is activated |
| Returns: | the target state or NULL in case of error |
xmlAutomataStatePtr xmlAutomataNewTransition2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar * token,
const xmlChar * token2,
void * data)
If @to is NULL, this creates first a new target state in the automata and then adds a transition from the @from state to the target state activated by the value of @token
| am: | an automata |
| from: | the starting point of the transition |
| to: | the target point of the transition or NULL |
| token: | the first input string associated to that transition |
| token2: | the second input string associated to that transition |
| data: | data passed to the callback function if the transition is activated |
| Returns: | the target state or NULL in case of error |
int xmlAutomataSetFinalState (xmlAutomataPtr am,
xmlAutomataStatePtr state)
Makes that state a final state
| am: | an automata |
| state: | a state in this automata |
| Returns: | 0 or -1 in case of error |
xmlAutomataPtr xmlNewAutomata (void)
Create a new automata
| Returns: | the new object or NULL in case of failure |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlwriter - text writing API for XML
text writing API for XML
Author(s): Alfred Mickautsch <alfred@mickautsch.de>
#define xmlTextWriterWriteProcessingInstruction; #define xmlTextWriterWriteDocType; typedef struct _xmlTextWriter xmlTextWriter; typedef xmlTextWriter * xmlTextWriterPtr; int xmlTextWriterStartDocument (xmlTextWriterPtr writer,
const char * version,
const char * encoding,
const char * standalone); int xmlTextWriterEndPI (xmlTextWriterPtr writer); int xmlTextWriterWriteBase64 (xmlTextWriterPtr writer,
const char * data,
int start,
int len); int xmlTextWriterSetIndentString (xmlTextWriterPtr writer,
const xmlChar * str); int xmlTextWriterStartAttribute (xmlTextWriterPtr writer,
const xmlChar * name); int xmlTextWriterEndComment (xmlTextWriterPtr writer); int xmlTextWriterWriteRawLen (xmlTextWriterPtr writer,
const xmlChar * content,
int len); int xmlTextWriterWriteDTDExternalEntityContents (xmlTextWriterPtr writer,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid); int xmlTextWriterWriteVFormatCDATA (xmlTextWriterPtr writer,
const char * format,
va_list argptr); int xmlTextWriterStartAttributeNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI); xmlTextWriterPtr xmlNewTextWriterPushParser (xmlParserCtxtPtr ctxt,
int compression); int xmlTextWriterWriteFormatAttributeNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char * format,
... ...); int xmlTextWriterWriteDTDEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid,
const xmlChar * content); int xmlTextWriterWriteVFormatPI (xmlTextWriterPtr writer,
const xmlChar * target,
const char * format,
va_list argptr); int xmlTextWriterWriteBinHex (xmlTextWriterPtr writer,
const char * data,
int start,
int len); int xmlTextWriterEndAttribute (xmlTextWriterPtr writer); int xmlTextWriterSetIndent (xmlTextWriterPtr writer,
int indent); int xmlTextWriterWriteFormatPI (xmlTextWriterPtr writer,
const xmlChar * target,
const char * format,
... ...); int xmlTextWriterEndDocument (xmlTextWriterPtr writer); int xmlTextWriterWriteDTDAttlist (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * content); int xmlTextWriterStartComment (xmlTextWriterPtr writer); int xmlTextWriterWriteVFormatDTD (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char * format,
va_list argptr); int xmlTextWriterEndCDATA (xmlTextWriterPtr writer); int xmlTextWriterStartElementNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI); int xmlTextWriterEndDTDEntity (xmlTextWriterPtr writer); xmlTextWriterPtr xmlNewTextWriter (xmlOutputBufferPtr out); void xmlFreeTextWriter (xmlTextWriterPtr writer); int xmlTextWriterWriteVFormatDTDAttlist (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
va_list argptr); int xmlTextWriterStartPI (xmlTextWriterPtr writer,
const xmlChar * target); int xmlTextWriterStartElement (xmlTextWriterPtr writer,
const xmlChar * name); int xmlTextWriterWriteDTDExternalEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid); int xmlTextWriterWriteFormatRaw (xmlTextWriterPtr writer,
const char * format,
... ...); int xmlTextWriterWriteCDATA (xmlTextWriterPtr writer,
const xmlChar * content); int xmlTextWriterWriteVFormatDTDInternalEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char * format,
va_list argptr); int xmlTextWriterWriteVFormatAttribute (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
va_list argptr); int xmlTextWriterEndDTDElement (xmlTextWriterPtr writer); int xmlTextWriterEndDTD (xmlTextWriterPtr writer); int xmlTextWriterWriteElement (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * content); int xmlTextWriterEndElement (xmlTextWriterPtr writer); int xmlTextWriterWriteVFormatComment (xmlTextWriterPtr writer,
const char * format,
va_list argptr); int xmlTextWriterStartCDATA (xmlTextWriterPtr writer); xmlTextWriterPtr xmlNewTextWriterFilename (const char * uri,
int compression); int xmlTextWriterWriteVFormatElement (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
va_list argptr); int xmlTextWriterWriteFormatComment (xmlTextWriterPtr writer,
const char * format,
... ...); int xmlTextWriterWriteAttributeNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const xmlChar * content); int xmlTextWriterWritePI (xmlTextWriterPtr writer,
const xmlChar * target,
const xmlChar * content); int xmlTextWriterWriteFormatDTDInternalEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char * format,
... ...); int xmlTextWriterWriteVFormatString (xmlTextWriterPtr writer,
const char * format,
va_list argptr); int xmlTextWriterWriteDTDInternalEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * content); int xmlTextWriterWriteVFormatElementNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char * format,
va_list argptr); int xmlTextWriterWriteDTDNotation (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid); int xmlTextWriterWriteFormatElement (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
... ...); int xmlTextWriterSetQuoteChar (xmlTextWriterPtr writer,
xmlChar quotechar); int xmlTextWriterWriteString (xmlTextWriterPtr writer,
const xmlChar * content); int xmlTextWriterWriteElementNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const xmlChar * content); int xmlTextWriterFullEndElement (xmlTextWriterPtr writer); int xmlTextWriterWriteVFormatAttributeNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char * format,
va_list argptr); int xmlTextWriterFlush (xmlTextWriterPtr writer); int xmlTextWriterStartDTD (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid); int xmlTextWriterWriteAttribute (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * content); xmlTextWriterPtr xmlNewTextWriterDoc (xmlDocPtr * doc,
int compression); int xmlTextWriterWriteFormatDTDElement (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
... ...); int xmlTextWriterEndDTDAttlist (xmlTextWriterPtr writer); xmlTextWriterPtr xmlNewTextWriterTree (xmlDocPtr doc,
xmlNodePtr node,
int compression); xmlTextWriterPtr xmlNewTextWriterMemory (xmlBufferPtr buf,
int compression); int xmlTextWriterWriteFormatCDATA (xmlTextWriterPtr writer,
const char * format,
... ...); int xmlTextWriterStartDTDAttlist (xmlTextWriterPtr writer,
const xmlChar * name); int xmlTextWriterWriteFormatString (xmlTextWriterPtr writer,
const char * format,
... ...); int xmlTextWriterWriteComment (xmlTextWriterPtr writer,
const xmlChar * content); int xmlTextWriterWriteVFormatRaw (xmlTextWriterPtr writer,
const char * format,
va_list argptr); int xmlTextWriterWriteFormatDTD (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char * format,
... ...); int xmlTextWriterWriteFormatDTDAttlist (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
... ...); int xmlTextWriterWriteRaw (xmlTextWriterPtr writer,
const xmlChar * content); int xmlTextWriterWriteDTDElement (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * content); int xmlTextWriterWriteDTD (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * subset); int xmlTextWriterWriteFormatAttribute (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
... ...); int xmlTextWriterStartDTDEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name); int xmlTextWriterWriteVFormatDTDElement (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
va_list argptr); int xmlTextWriterStartDTDElement (xmlTextWriterPtr writer,
const xmlChar * name); int xmlTextWriterWriteFormatElementNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char * format,
... ...);
#define xmlTextWriterWriteDocType;
this macro maps to xmlTextWriterWriteDTD
#define xmlTextWriterWriteProcessingInstruction;
This macro maps to xmlTextWriterWritePI
struct _xmlTextWriter {
The content of this structure is not made public by the API.
} xmlTextWriter;
xmlTextWriter * xmlTextWriterPtr;
void xmlFreeTextWriter (xmlTextWriterPtr writer)
Deallocate all the resources associated to the writer
| writer: | the xmlTextWriterPtr |
xmlTextWriterPtr xmlNewTextWriter (xmlOutputBufferPtr out)
Create a new xmlNewTextWriter structure using an xmlOutputBufferPtr NOTE: the @out parameter will be deallocated when the writer is closed (if the call succeed.)
| out: | an xmlOutputBufferPtr |
| Returns: | the new xmlTextWriterPtr or NULL in case of error |
xmlTextWriterPtr xmlNewTextWriterDoc (xmlDocPtr * doc,
int compression)
Create a new xmlNewTextWriter structure with @*doc as output
| doc: | address of a xmlDocPtr to hold the new XML document tree |
| compression: | compress the output? |
| Returns: | the new xmlTextWriterPtr or NULL in case of error |
xmlTextWriterPtr xmlNewTextWriterFilename (const char * uri,
int compression)
Create a new xmlNewTextWriter structure with @uri as output
| uri: | the URI of the resource for the output |
| compression: | compress the output? |
| Returns: | the new xmlTextWriterPtr or NULL in case of error |
xmlTextWriterPtr xmlNewTextWriterMemory (xmlBufferPtr buf,
int compression)
Create a new xmlNewTextWriter structure with @buf as output TODO: handle compression
| buf: | xmlBufferPtr |
| compression: | compress the output? |
| Returns: | the new xmlTextWriterPtr or NULL in case of error |
xmlTextWriterPtr xmlNewTextWriterPushParser (xmlParserCtxtPtr ctxt,
int compression)
Create a new xmlNewTextWriter structure with @ctxt as output NOTE: the @ctxt context will be freed with the resulting writer (if the call succeeds). TODO: handle compression
| ctxt: | xmlParserCtxtPtr to hold the new XML document tree |
| compression: | compress the output? |
| Returns: | the new xmlTextWriterPtr or NULL in case of error |
xmlTextWriterPtr xmlNewTextWriterTree (xmlDocPtr doc,
xmlNodePtr node,
int compression)
Create a new xmlNewTextWriter structure with @doc as output starting at @node
| doc: | xmlDocPtr |
| node: | xmlNodePtr or NULL for doc->children |
| compression: | compress the output? |
| Returns: | the new xmlTextWriterPtr or NULL in case of error |
int xmlTextWriterEndAttribute (xmlTextWriterPtr writer)
End the current xml element.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterEndCDATA (xmlTextWriterPtr writer)
End an xml CDATA section.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterEndComment (xmlTextWriterPtr writer)
End the current xml coment.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterEndDTD (xmlTextWriterPtr writer)
End an xml DTD.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterEndDTDAttlist (xmlTextWriterPtr writer)
End an xml DTD attribute list.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterEndDTDElement (xmlTextWriterPtr writer)
End an xml DTD element.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterEndDTDEntity (xmlTextWriterPtr writer)
End an xml DTD entity.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterEndDocument (xmlTextWriterPtr writer)
End an xml document. All open elements are closed, and the content is flushed to the output.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written or -1 in case of error |
int xmlTextWriterEndElement (xmlTextWriterPtr writer)
End the current xml element.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterEndPI (xmlTextWriterPtr writer)
End the current xml PI.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterFlush (xmlTextWriterPtr writer)
Flush the output buffer.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterFullEndElement (xmlTextWriterPtr writer)
End the current xml element. Writes an end tag even if the element is empty
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterSetIndent (xmlTextWriterPtr writer,
int indent)
Set indentation output. indent = 0 do not indentation. indent > 0 do indentation.
| writer: | the xmlTextWriterPtr |
| indent: | do indentation? |
| Returns: | -1 on error or 0 otherwise. |
int xmlTextWriterSetIndentString (xmlTextWriterPtr writer,
const xmlChar * str)
Set string indentation.
| writer: | the xmlTextWriterPtr |
| str: | the xmlChar string |
| Returns: | -1 on error or 0 otherwise. |
int xmlTextWriterSetQuoteChar (xmlTextWriterPtr writer,
xmlChar quotechar)
Set the character used for quoting attributes.
| writer: | the xmlTextWriterPtr |
| quotechar: | the quote character |
| Returns: | -1 on error or 0 otherwise. |
int xmlTextWriterStartAttribute (xmlTextWriterPtr writer,
const xmlChar * name)
Start an xml attribute.
| writer: | the xmlTextWriterPtr |
| name: | element name |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartAttributeNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI)
Start an xml attribute with namespace support.
| writer: | the xmlTextWriterPtr |
| prefix: | namespace prefix or NULL |
| name: | element local name |
| namespaceURI: | namespace URI or NULL |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartCDATA (xmlTextWriterPtr writer)
Start an xml CDATA section.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartComment (xmlTextWriterPtr writer)
Start an xml comment.
| writer: | the xmlTextWriterPtr |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartDTD (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid)
Start an xml DTD.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD |
| pubid: | the public identifier, which is an alternative to the system identifier |
| sysid: | the system identifier, which is the URI of the DTD |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartDTDAttlist (xmlTextWriterPtr writer,
const xmlChar * name)
Start an xml DTD ATTLIST.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD ATTLIST |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartDTDElement (xmlTextWriterPtr writer,
const xmlChar * name)
Start an xml DTD element.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD element |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartDTDEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name)
Start an xml DTD ATTLIST.
| writer: | the xmlTextWriterPtr |
| pe: | TRUE if this is a parameter entity, FALSE if not |
| name: | the name of the DTD ATTLIST |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartDocument (xmlTextWriterPtr writer,
const char * version,
const char * encoding,
const char * standalone)
Start a new xml document
| writer: | the xmlTextWriterPtr |
| version: | the xml version ("1.0") or NULL for default ("1.0") |
| encoding: | the encoding or NULL for default |
| standalone: | "yes" or "no" or NULL for default |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartElement (xmlTextWriterPtr writer,
const xmlChar * name)
Start an xml element.
| writer: | the xmlTextWriterPtr |
| name: | element name |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartElementNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI)
Start an xml element with namespace support.
| writer: | the xmlTextWriterPtr |
| prefix: | namespace prefix or NULL |
| name: | element local name |
| namespaceURI: | namespace URI or NULL |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterStartPI (xmlTextWriterPtr writer,
const xmlChar * target)
Start an xml PI.
| writer: | the xmlTextWriterPtr |
| target: | PI target |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteAttribute (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * content)
Write an xml attribute.
| writer: | the xmlTextWriterPtr |
| name: | attribute name |
| content: | attribute content |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteAttributeNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const xmlChar * content)
Write an xml attribute.
| writer: | the xmlTextWriterPtr |
| prefix: | namespace prefix |
| name: | attribute local name |
| namespaceURI: | namespace URI |
| content: | attribute content |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteBase64 (xmlTextWriterPtr writer,
const char * data,
int start,
int len)
Write an base64 encoded xml text.
| writer: | the xmlTextWriterPtr |
| data: | binary data |
| start: | the position within the data of the first byte to encode |
| len: | the number of bytes to encode |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteBinHex (xmlTextWriterPtr writer,
const char * data,
int start,
int len)
Write a BinHex encoded xml text.
| writer: | the xmlTextWriterPtr |
| data: | binary data |
| start: | the position within the data of the first byte to encode |
| len: | the number of bytes to encode |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteCDATA (xmlTextWriterPtr writer,
const xmlChar * content)
Write an xml CDATA.
| writer: | the xmlTextWriterPtr |
| content: | CDATA content |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteComment (xmlTextWriterPtr writer,
const xmlChar * content)
Write an xml comment.
| writer: | the xmlTextWriterPtr |
| content: | comment string |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteDTD (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * subset)
Write a DTD.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD |
| pubid: | the public identifier, which is an alternative to the system identifier |
| sysid: | the system identifier, which is the URI of the DTD |
| subset: | string content of the DTD |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteDTDAttlist (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * content)
Write a DTD ATTLIST.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD ATTLIST |
| content: | content of the ATTLIST |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteDTDElement (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * content)
Write a DTD element.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD element |
| content: | content of the element |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteDTDEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid,
const xmlChar * content)
Write a DTD entity.
| writer: | the xmlTextWriterPtr |
| pe: | TRUE if this is a parameter entity, FALSE if not |
| name: | the name of the DTD entity |
| pubid: | the public identifier, which is an alternative to the system identifier |
| sysid: | the system identifier, which is the URI of the DTD |
| ndataid: | the xml notation name. |
| content: | content of the entity |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteDTDExternalEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid)
Write a DTD external entity. The entity must have been started with xmlTextWriterStartDTDEntity
| writer: | the xmlTextWriterPtr |
| pe: | TRUE if this is a parameter entity, FALSE if not |
| name: | the name of the DTD entity |
| pubid: | the public identifier, which is an alternative to the system identifier |
| sysid: | the system identifier, which is the URI of the DTD |
| ndataid: | the xml notation name. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteDTDExternalEntityContents (xmlTextWriterPtr writer,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid)
Write the contents of a DTD external entity.
| writer: | the xmlTextWriterPtr |
| pubid: | the public identifier, which is an alternative to the system identifier |
| sysid: | the system identifier, which is the URI of the DTD |
| ndataid: | the xml notation name. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteDTDInternalEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * content)
Write a DTD internal entity.
| writer: | the xmlTextWriterPtr |
| pe: | TRUE if this is a parameter entity, FALSE if not |
| name: | the name of the DTD entity |
| content: | content of the entity |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteDTDNotation (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid)
Write a DTD entity.
| writer: | the xmlTextWriterPtr |
| name: | the name of the xml notation |
| pubid: | the public identifier, which is an alternative to the system identifier |
| sysid: | the system identifier, which is the URI of the DTD |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteElement (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * content)
Write an xml element.
| writer: | the xmlTextWriterPtr |
| name: | element name |
| content: | element content |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteElementNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const xmlChar * content)
Write an xml element with namespace support.
| writer: | the xmlTextWriterPtr |
| prefix: | namespace prefix |
| name: | element local name |
| namespaceURI: | namespace URI |
| content: | element content |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatAttribute (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
... ...)
Write a formatted xml attribute.
| writer: | the xmlTextWriterPtr |
| name: | attribute name |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatAttributeNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char * format,
... ...)
Write a formatted xml attribute.with namespace support
| writer: | the xmlTextWriterPtr |
| prefix: | namespace prefix |
| name: | attribute local name |
| namespaceURI: | namespace URI |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatCDATA (xmlTextWriterPtr writer,
const char * format,
... ...)
Write a formatted xml CDATA.
| writer: | the xmlTextWriterPtr |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatComment (xmlTextWriterPtr writer,
const char * format,
... ...)
Write an xml comment.
| writer: | the xmlTextWriterPtr |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatDTD (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char * format,
... ...)
Write a DTD with a formatted markup declarations part.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD |
| pubid: | the public identifier, which is an alternative to the system identifier |
| sysid: | the system identifier, which is the URI of the DTD |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatDTDAttlist (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
... ...)
Write a formatted DTD ATTLIST.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD ATTLIST |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatDTDElement (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
... ...)
Write a formatted DTD element.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD element |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatDTDInternalEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char * format,
... ...)
Write a formatted DTD internal entity.
| writer: | the xmlTextWriterPtr |
| pe: | TRUE if this is a parameter entity, FALSE if not |
| name: | the name of the DTD entity |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatElement (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
... ...)
Write a formatted xml element.
| writer: | the xmlTextWriterPtr |
| name: | element name |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatElementNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char * format,
... ...)
Write a formatted xml element with namespace support.
| writer: | the xmlTextWriterPtr |
| prefix: | namespace prefix |
| name: | element local name |
| namespaceURI: | namespace URI |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatPI (xmlTextWriterPtr writer,
const xmlChar * target,
const char * format,
... ...)
Write a formatted PI.
| writer: | the xmlTextWriterPtr |
| target: | PI target |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatRaw (xmlTextWriterPtr writer,
const char * format,
... ...)
Write a formatted raw xml text.
| writer: | the xmlTextWriterPtr |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteFormatString (xmlTextWriterPtr writer,
const char * format,
... ...)
Write a formatted xml text.
| writer: | the xmlTextWriterPtr |
| format: | format string (see printf) |
| ...: | extra parameters for the format |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWritePI (xmlTextWriterPtr writer,
const xmlChar * target,
const xmlChar * content)
Write an xml PI.
| writer: | the xmlTextWriterPtr |
| target: | PI target |
| content: | PI content |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteRaw (xmlTextWriterPtr writer,
const xmlChar * content)
Write a raw xml text.
| writer: | the xmlTextWriterPtr |
| content: | text string |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteRawLen (xmlTextWriterPtr writer,
const xmlChar * content,
int len)
Write an xml text. TODO: what about entities and special chars??
| writer: | the xmlTextWriterPtr |
| content: | text string |
| len: | length of the text string |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteString (xmlTextWriterPtr writer,
const xmlChar * content)
Write an xml text.
| writer: | the xmlTextWriterPtr |
| content: | text string |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatAttribute (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
va_list argptr)
Write a formatted xml attribute.
| writer: | the xmlTextWriterPtr |
| name: | attribute name |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatAttributeNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char * format,
va_list argptr)
Write a formatted xml attribute.with namespace support
| writer: | the xmlTextWriterPtr |
| prefix: | namespace prefix |
| name: | attribute local name |
| namespaceURI: | namespace URI |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatCDATA (xmlTextWriterPtr writer,
const char * format,
va_list argptr)
Write a formatted xml CDATA.
| writer: | the xmlTextWriterPtr |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatComment (xmlTextWriterPtr writer,
const char * format,
va_list argptr)
Write an xml comment.
| writer: | the xmlTextWriterPtr |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatDTD (xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char * format,
va_list argptr)
Write a DTD with a formatted markup declarations part.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD |
| pubid: | the public identifier, which is an alternative to the system identifier |
| sysid: | the system identifier, which is the URI of the DTD |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatDTDAttlist (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
va_list argptr)
Write a formatted DTD ATTLIST.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD ATTLIST |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatDTDElement (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
va_list argptr)
Write a formatted DTD element.
| writer: | the xmlTextWriterPtr |
| name: | the name of the DTD element |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatDTDInternalEntity (xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char * format,
va_list argptr)
Write a formatted DTD internal entity.
| writer: | the xmlTextWriterPtr |
| pe: | TRUE if this is a parameter entity, FALSE if not |
| name: | the name of the DTD entity |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatElement (xmlTextWriterPtr writer,
const xmlChar * name,
const char * format,
va_list argptr)
Write a formatted xml element.
| writer: | the xmlTextWriterPtr |
| name: | element name |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatElementNS (xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char * format,
va_list argptr)
Write a formatted xml element with namespace support.
| writer: | the xmlTextWriterPtr |
| prefix: | namespace prefix |
| name: | element local name |
| namespaceURI: | namespace URI |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatPI (xmlTextWriterPtr writer,
const xmlChar * target,
const char * format,
va_list argptr)
Write a formatted xml PI.
| writer: | the xmlTextWriterPtr |
| target: | PI target |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatRaw (xmlTextWriterPtr writer,
const char * format,
va_list argptr)
Write a formatted raw xml text.
| writer: | the xmlTextWriterPtr |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
int xmlTextWriterWriteVFormatString (xmlTextWriterPtr writer,
const char * format,
va_list argptr)
Write a formatted xml text.
| writer: | the xmlTextWriterPtr |
| format: | format string (see printf) |
| argptr: | pointer to the first member of the variable argument list. |
| Returns: | the bytes written (may be 0 because of buffering) or -1 in case of error |
|
|
|
|
|
libxml2 Reference Manual |
|---|
xmlreader - the XMLReader implementation
API of the XML streaming API based on C# interfaces.
Author(s): Daniel Veillard
typedef xmlTextReader * xmlTextReaderPtr; typedef enum xmlParserSeverities; typedef enum xmlParserProperties; typedef enum xmlTextReaderMode; typedef struct _xmlTextReader xmlTextReader; typedef void * xmlTextReaderLocatorPtr; typedef enum xmlReaderTypes; xmlTextReaderPtr xmlNewTextReaderFilename (const char * URI); int xmlTextReaderHasAttributes (xmlTextReaderPtr reader); int xmlTextReaderReadState (xmlTextReaderPtr reader); xmlTextReaderPtr xmlReaderForFile (const char * filename,
const char * encoding,
int options); const xmlChar * xmlTextReaderConstNamespaceUri (xmlTextReaderPtr reader); xmlDocPtr xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); int xmlTextReaderGetParserLineNumber (xmlTextReaderPtr reader); xmlNodePtr xmlTextReaderExpand (xmlTextReaderPtr reader); xmlChar * xmlTextReaderXmlLang (xmlTextReaderPtr reader); xmlTextReaderPtr xmlReaderForDoc (const xmlChar * cur,
const char * URL,
const char * encoding,
int options); int xmlReaderNewIO (xmlTextReaderPtr reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options); int xmlTextReaderClose (xmlTextReaderPtr reader); xmlChar * xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); const xmlChar * xmlTextReaderConstEncoding (xmlTextReaderPtr reader); int xmlTextReaderNormalization (xmlTextReaderPtr reader); int xmlTextReaderGetParserProp (xmlTextReaderPtr reader,
int prop); int xmlTextReaderMoveToAttribute (xmlTextReaderPtr reader,
const xmlChar * name); int xmlTextReaderQuoteChar (xmlTextReaderPtr reader); int xmlTextReaderSetSchema (xmlTextReaderPtr reader,
xmlSchemaPtr schema); xmlChar * xmlTextReaderValue (xmlTextReaderPtr reader); int xmlTextReaderIsValid (xmlTextReaderPtr reader); int xmlTextReaderMoveToFirstAttribute (xmlTextReaderPtr reader); int xmlTextReaderGetParserColumnNumber (xmlTextReaderPtr reader); const xmlChar * xmlTextReaderConstValue (xmlTextReaderPtr reader); xmlTextReaderPtr xmlNewTextReader (xmlParserInputBufferPtr input,
const char * URI); xmlChar * xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
int no); xmlChar * xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,
const xmlChar * localName,
const xmlChar * namespaceURI); const xmlChar * xmlTextReaderConstName (xmlTextReaderPtr reader); const xmlChar * xmlTextReaderConstString (xmlTextReaderPtr reader,
const xmlChar * str); const xmlChar * xmlTextReaderConstXmlVersion (xmlTextReaderPtr reader); int xmlTextReaderDepth (xmlTextReaderPtr reader); xmlChar * xmlTextReaderReadString (xmlTextReaderPtr reader); int xmlTextReaderIsDefault (xmlTextReaderPtr reader); int xmlTextReaderMoveToNextAttribute (xmlTextReaderPtr reader); int xmlReaderNewWalker (xmlTextReaderPtr reader,
xmlDocPtr doc); const xmlChar * xmlTextReaderConstPrefix (xmlTextReaderPtr reader); xmlTextReaderPtr xmlReaderWalker (xmlDocPtr doc); const xmlChar * xmlTextReaderConstLocalName (xmlTextReaderPtr reader); int xmlTextReaderNodeType (xmlTextReaderPtr reader); void xmlFreeTextReader (xmlTextReaderPtr reader); xmlChar * xmlTextReaderName (xmlTextReaderPtr reader); int xmlTextReaderRead (xmlTextReaderPtr reader); int xmlTextReaderIsEmptyElement (xmlTextReaderPtr reader); int xmlReaderNewMemory (xmlTextReaderPtr reader,
const char * buffer,
int size,
const char * URL,
const char * encoding,
int options); int xmlTextReaderSchemaValidateCtxt (xmlTextReaderPtr reader,
xmlSchemaValidCtxtPtr ctxt,
int options); int xmlTextReaderHasValue (xmlTextReaderPtr reader); const xmlChar * xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); xmlChar * xmlTextReaderBaseUri (xmlTextReaderPtr reader); int xmlTextReaderMoveToAttributeNo (xmlTextReaderPtr reader,
int no); int xmlTextReaderLocatorLineNumber (xmlTextReaderLocatorPtr locator); int xmlTextReaderMoveToAttributeNs (xmlTextReaderPtr reader,
const xmlChar * localName,
const xmlChar * namespaceURI); int xmlTextReaderNext (xmlTextReaderPtr reader); int xmlTextReaderAttributeCount (xmlTextReaderPtr reader); xmlChar * xmlTextReaderLookupNamespace (xmlTextReaderPtr reader,
const xmlChar * prefix); int xmlTextReaderMoveToElement (xmlTextReaderPtr reader); xmlTextReaderPtr xmlReaderForIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options); xmlChar * xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); int xmlTextReaderRelaxNGValidateCtxt (xmlTextReaderPtr reader,
xmlRelaxNGValidCtxtPtr ctxt,
int options); xmlChar * xmlTextReaderPrefix (xmlTextReaderPtr reader); int xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); int xmlTextReaderNextSibling (xmlTextReaderPtr reader); typedef void xmlTextReaderErrorFunc (void * arg,
const char * msg,
xmlParserSeverities severity,
xmlTextReaderLocatorPtr locator); xmlTextReaderPtr xmlReaderForFd (int fd,
const char * URL,
const char * encoding,
int options); xmlChar * xmlTextReaderGetAttribute (xmlTextReaderPtr reader,
const xmlChar * name); xmlChar * xmlTextReaderLocalName (xmlTextReaderPtr reader); xmlNodePtr xmlTextReaderPreserve (xmlTextReaderPtr reader); xmlNodePtr xmlTextReaderCurrentNode (xmlTextReaderPtr reader); int xmlTextReaderSetParserProp (xmlTextReaderPtr reader,
int prop,
int value); xmlParserInputBufferPtr xmlTextReaderGetRemainder (xmlTextReaderPtr reader); void xmlTextReaderSetErrorHandler (xmlTextReaderPtr reader,
xmlTextReaderErrorFunc f,
void * arg); int xmlTextReaderIsNamespaceDecl (xmlTextReaderPtr reader); int xmlReaderNewDoc (xmlTextReaderPtr reader,
const xmlChar * cur,
const char * URL,
const char * encoding,
int options); int xmlTextReaderPreservePattern (xmlTextReaderPtr reader,
const xmlChar * pattern,
const xmlChar ** namespaces); const xmlChar * xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); void xmlTextReaderGetErrorHandler (xmlTextReaderPtr reader,
xmlTextReaderErrorFunc * f,
void ** arg); void xmlTextReaderSetStructuredErrorHandler (xmlTextReaderPtr reader,
xmlStructuredErrorFunc f,
void * arg); int xmlReaderNewFile (xmlTextReaderPtr reader,
const char * filename,
const char * encoding,
int options); int xmlTextReaderRelaxNGSetSchema (xmlTextReaderPtr reader,
xmlRelaxNGPtr schema); int xmlReaderNewFd (xmlTextReaderPtr reader,
int fd,
const char * URL,
const char * encoding,
int options); int xmlTextReaderRelaxNGValidate (xmlTextReaderPtr reader,
const char * rng); xmlTextReaderPtr xmlReaderForMemory (const char * buffer,
int size,
const char * URL,
const char * encoding,
int options); int xmlTextReaderSetup (xmlTextReaderPtr reader,
xmlParserInputBufferPtr input,
const char * URL,
const char * encoding,
int options); long xmlTextReaderByteConsumed (xmlTextReaderPtr reader); xmlChar * xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); xmlChar * xmlTextReaderNamespaceUri (xmlTextReaderPtr reader); int xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
const char * xsd); int xmlTextReaderStandalone (xmlTextReaderPtr reader);
enum xmlParserProperties { XML_PARSER_LOADDTD = 1 XML_PARSER_DEFAULTATTRS = 2 XML_PARSER_VALIDATE = 3 XML_PARSER_SUBST_ENTITIES = 4 };
enum xmlParserSeverities { XML_PARSER_SEVERITY_VALIDITY_WARNING = 1 XML_PARSER_SEVERITY_VALIDITY_ERROR = 2 XML_PARSER_SEVERITY_WARNING = 3 XML_PARSER_SEVERITY_ERROR = 4 };
enum xmlReaderTypes { XML_READER_TYPE_NONE = 0 XML_READER_TYPE_ELEMENT = 1 XML_READER_TYPE_ATTRIBUTE = 2 XML_READER_TYPE_TEXT = 3 XML_READER_TYPE_CDATA = 4 XML_READER_TYPE_ENTITY_REFERENCE = 5 XML_READER_TYPE_ENTITY = 6 XML_READER_TYPE_PROCESSING_INSTRUCTION = 7 XML_READER_TYPE_COMMENT = 8 XML_READER_TYPE_DOCUMENT = 9 XML_READER_TYPE_DOCUMENT_TYPE = 10 XML_READER_TYPE_DOCUMENT_FRAGMENT = 11 XML_READER_TYPE_NOTATION = 12 XML_READER_TYPE_WHITESPACE = 13 XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14 XML_READER_TYPE_END_ELEMENT = 15 XML_READER_TYPE_END_ENTITY = 16 XML_READER_TYPE_XML_DECLARATION = 17 };
struct _xmlTextReader {
The content of this structure is not made public by the API.
} xmlTextReader;
void * xmlTextReaderLocatorPtr;
enum xmlTextReaderMode { XML_TEXTREADER_MODE_INITIAL = 0 XML_TEXTREADER_MODE_INTERACTIVE = 1 XML_TEXTREADER_MODE_ERROR = 2 XML_TEXTREADER_MODE_EOF = 3 XML_TEXTREADER_MODE_CLOSED = 4 XML_TEXTREADER_MODE_READING = 5 };
void xmlTextReaderErrorFunc (void * arg,
const char * msg,
xmlParserSeverities severity,
xmlTextReaderLocatorPtr locator)
Signature of an error callback from a reader parser
| arg: | the user argument |
| msg: | the message |
| severity: | the severity of the error |
| locator: | a locator indicating where the error occurred |
void xmlFreeTextReader (xmlTextReaderPtr reader)
Deallocate all the resources associated to the reader
| reader: | the xmlTextReaderPtr |
xmlTextReaderPtr xmlNewTextReader (xmlParserInputBufferPtr input,
const char * URI)
Create an xmlTextReader structure fed with @input
| input: | the xmlParserInputBufferPtr used to read data |
| URI: | the URI information for the source if available |
| Returns: | the new xmlTextReaderPtr or NULL in case of error |
xmlTextReaderPtr xmlNewTextReaderFilename (const char * URI)
Create an xmlTextReader structure fed with the resource at @URI
| URI: | the URI of the resource to process |
| Returns: | the new xmlTextReaderPtr or NULL in case of error |
xmlTextReaderPtr xmlReaderForDoc (const xmlChar * cur,
const char * URL,
const char * encoding,
int options)
Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption.
| cur: | a pointer to a zero terminated string |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | the new reader or NULL in case of error. |
xmlTextReaderPtr xmlReaderForFd (int fd,
const char * URL,
const char * encoding,
int options)
Create an xmltextReader for an XML from a file descriptor. The parsing flags @options are a combination of xmlParserOption. NOTE that the file descriptor will not be closed when the reader is closed or reset.
| fd: | an open file descriptor |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | the new reader or NULL in case of error. |
xmlTextReaderPtr xmlReaderForFile (const char * filename,
const char * encoding,
int options)
parse an XML file from the filesystem or the network. The parsing flags @options are a combination of xmlParserOption.
| filename: | a file or URL |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | the new reader or NULL in case of error. |
xmlTextReaderPtr xmlReaderForIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options)
Create an xmltextReader for an XML document from I/O functions and source. The parsing flags @options are a combination of xmlParserOption.
| ioread: | an I/O read function |
| ioclose: | an I/O close function |
| ioctx: | an I/O handler |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | the new reader or NULL in case of error. |
xmlTextReaderPtr xmlReaderForMemory (const char * buffer,
int size,
const char * URL,
const char * encoding,
int options)
Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption.
| buffer: | a pointer to a char array |
| size: | the size of the array |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | the new reader or NULL in case of error. |
int xmlReaderNewDoc (xmlTextReaderPtr reader,
const xmlChar * cur,
const char * URL,
const char * encoding,
int options)
Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.
| reader: | an XML reader |
| cur: | a pointer to a zero terminated string |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | 0 in case of success and -1 in case of error |
int xmlReaderNewFd (xmlTextReaderPtr reader,
int fd,
const char * URL,
const char * encoding,
int options)
Setup an xmltextReader to parse an XML from a file descriptor. NOTE that the file descriptor will not be closed when the reader is closed or reset. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.
| reader: | an XML reader |
| fd: | an open file descriptor |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | 0 in case of success and -1 in case of error |
int xmlReaderNewFile (xmlTextReaderPtr reader,
const char * filename,
const char * encoding,
int options)
parse an XML file from the filesystem or the network. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.
| reader: | an XML reader |
| filename: | a file or URL |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | 0 in case of success and -1 in case of error |
int xmlReaderNewIO (xmlTextReaderPtr reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options)
Setup an xmltextReader to parse an XML document from I/O functions and source. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.
| reader: | an XML reader |
| ioread: | an I/O read function |
| ioclose: | an I/O close function |
| ioctx: | an I/O handler |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | 0 in case of success and -1 in case of error |
int xmlReaderNewMemory (xmlTextReaderPtr reader,
const char * buffer,
int size,
const char * URL,
const char * encoding,
int options)
Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.
| reader: | an XML reader |
| buffer: | a pointer to a char array |
| size: | the size of the array |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | 0 in case of success and -1 in case of error |
int xmlReaderNewWalker (xmlTextReaderPtr reader,
xmlDocPtr doc)
Setup an xmltextReader to parse a preparsed XML document. This reuses the existing @reader xmlTextReader.
| reader: | an XML reader |
| doc: | a preparsed document |
| Returns: | 0 in case of success and -1 in case of error |
xmlTextReaderPtr xmlReaderWalker (xmlDocPtr doc)
Create an xmltextReader for a preparsed document.
| doc: | a preparsed document |
| Returns: | the new reader or NULL in case of error. |
int xmlTextReaderAttributeCount (xmlTextReaderPtr reader)
Provides the number of attributes of the current node
| reader: | the xmlTextReaderPtr used |
| Returns: | 0 i no attributes, -1 in case of error or the attribute count |
xmlChar * xmlTextReaderBaseUri (xmlTextReaderPtr reader)
The base URI of the node.
| reader: | the xmlTextReaderPtr used |
| Returns: | the base URI or NULL if not available, if non NULL it need to be freed by the caller. |
long xmlTextReaderByteConsumed (xmlTextReaderPtr reader)
This function provides the current index of the parser used by the reader, relative to the start of the current entity. This function actually just wraps a call to xmlBytesConsumed() for the parser context associated with the reader. See xmlBytesConsumed() for more information.
| reader: | an XML reader |
| Returns: | the index in bytes from the beginning of the entity or -1 in case the index could not be computed. |
int xmlTextReaderClose (xmlTextReaderPtr reader)
This method releases any resources allocated by the current instance changes the state to Closed and close any underlying input.
| reader: | the xmlTextReaderPtr used |
| Returns: | 0 or -1 in case of error |
const xmlChar * xmlTextReaderConstBaseUri (xmlTextReaderPtr reader)
The base URI of the node.
| reader: | the xmlTextReaderPtr used |
| Returns: | the base URI or NULL if not available, the string will be deallocated with the reader |
const xmlChar * xmlTextReaderConstEncoding (xmlTextReaderPtr reader)
Determine the encoding of the document being read.
| reader: | the xmlTextReaderPtr used |
| Returns: | a string containing the encoding of the document or NULL in case of error. The string is deallocated with the reader. |
const xmlChar * xmlTextReaderConstLocalName (xmlTextReaderPtr reader)
The local name of the node.
| reader: | the xmlTextReaderPtr used |
| Returns: | the local name or NULL if not available, the string will be deallocated with the reader. |
const xmlChar * xmlTextReaderConstName (xmlTextReaderPtr reader)
The qualified name of the node, equal to Prefix :LocalName.
| reader: | the xmlTextReaderPtr used |
| Returns: | the local name or NULL if not available, the string is deallocated with the reader. |
const xmlChar * xmlTextReaderConstNamespaceUri (xmlTextReaderPtr reader)
The URI defining the namespace associated with the node.
| reader: | the xmlTextReaderPtr used |
| Returns: | the namespace URI or NULL if not available, the string will be deallocated with the reader |
const xmlChar * xmlTextReaderConstPrefix (xmlTextReaderPtr reader)
A shorthand reference to the namespace associated with the node.
| reader: | the xmlTextReaderPtr used |
| Returns: | the prefix or NULL if not available, the string is deallocated with the reader. |
const xmlChar * xmlTextReaderConstString (xmlTextReaderPtr reader,
const xmlChar * str)
Get an interned string from the reader, allows for example to speedup string name comparisons
| reader: | the xmlTextReaderPtr used |
| str: | the string to intern. |
| Returns: | an interned copy of the string or NULL in case of error. The string will be deallocated with the reader. |
const xmlChar * xmlTextReaderConstValue (xmlTextReaderPtr reader)
Provides the text value of the node if present
| reader: | the xmlTextReaderPtr used |
| Returns: | the string or NULL if not available. The result will be deallocated on the next Read() operation. |
const xmlChar * xmlTextReaderConstXmlLang (xmlTextReaderPtr reader)
The xml:lang scope within which the node resides.
| reader: | the xmlTextReaderPtr used |
| Returns: | the xml:lang value or NULL if none exists. |
const xmlChar * xmlTextReaderConstXmlVersion (xmlTextReaderPtr reader)
Determine the XML version of the document being read.
| reader: | the xmlTextReaderPtr used |
| Returns: | a string containing the XML version of the document or NULL in case of error. The string is deallocated with the reader. |
xmlDocPtr xmlTextReaderCurrentDoc (xmlTextReaderPtr reader)
Hacking interface allowing to get the xmlDocPtr correponding to the current document being accessed by the xmlTextReader. NOTE: as a result of this call, the reader will not destroy the associated XML document and calling xmlFreeDoc() on the result is needed once the reader parsing has finished.
| reader: | the xmlTextReaderPtr used |
| Returns: | the xmlDocPtr or NULL in case of error. |
xmlNodePtr xmlTextReaderCurrentNode (xmlTextReaderPtr reader)
Hacking interface allowing to get the xmlNodePtr correponding to the current node being accessed by the xmlTextReader. This is dangerous because the underlying node may be destroyed on the next Reads.
| reader: | the xmlTextReaderPtr used |
| Returns: | the xmlNodePtr or NULL in case of error. |
int xmlTextReaderDepth (xmlTextReaderPtr reader)
The depth of the node in the tree.
| reader: | the xmlTextReaderPtr used |
| Returns: | the depth or -1 in case of error |
xmlNodePtr xmlTextReaderExpand (xmlTextReaderPtr reader)
Reads the contents of the current node and the full subtree. It then makes the subtree available until the next xmlTextReaderRead() call
| reader: | the xmlTextReaderPtr used |
| Returns: | a node pointer valid until the next xmlTextReaderRead() call or NULL in case of error. |
xmlChar * xmlTextReaderGetAttribute (xmlTextReaderPtr reader,
const xmlChar * name)
Provides the value of the attribute with the specified qualified name.
| reader: | the xmlTextReaderPtr used |
| name: | the qualified name of the attribute. |
| Returns: | a string containing the value of the specified attribute, or NULL in case of error. The string must be deallocated by the caller. |
xmlChar * xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
int no)
Provides the value of the attribute with the specified index relative to the containing element.
| reader: | the xmlTextReaderPtr used |
| no: | the zero-based index of the attribute relative to the containing element |
| Returns: | a string containing the value of the specified attribute, or NULL in case of error. The string must be deallocated by the caller. |
xmlChar * xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,
const xmlChar * localName,
const xmlChar * namespaceURI)
Provides the value of the specified attribute
| reader: | the xmlTextReaderPtr used |
| localName: | the local name of the attribute. |
| namespaceURI: | the namespace URI of the attribute. |
| Returns: | a string containing the value of the specified attribute, or NULL in case of error. The string must be deallocated by the caller. |
void xmlTextReaderGetErrorHandler (xmlTextReaderPtr reader,
xmlTextReaderErrorFunc * f,
void ** arg)
Retrieve the error callback function and user argument.
| reader: | the xmlTextReaderPtr used |
| f: | the callback function or NULL is no callback has been registered |
| arg: | a user argument |
int xmlTextReaderGetParserColumnNumber (xmlTextReaderPtr reader)
Provide the column number of the current parsing point.
| reader: | the user data (XML reader context) |
| Returns: | an int or 0 if not available |
int xmlTextReaderGetParserLineNumber (xmlTextReaderPtr reader)
Provide the line number of the current parsing point.
| reader: | the user data (XML reader context) |
| Returns: | an int or 0 if not available |
int xmlTextReaderGetParserProp (xmlTextReaderPtr reader,
int prop)
Read the parser internal property.
| reader: | the xmlTextReaderPtr used |
| prop: | the xmlParserProperties to get |
| Returns: | the value, usually 0 or 1, or -1 in case of error. |
xmlParserInputBufferPtr xmlTextReaderGetRemainder (xmlTextReaderPtr reader)
Method to get the remainder of the buffered XML. this method stops the parser, set its state to End Of File and return the input stream with what is left that the parser did not use. The implementation is not good, the parser certainly procgressed past what's left in reader->input, and there is an allocation problem. Best would be to rewrite it differently.
| reader: | the xmlTextReaderPtr used |
| Returns: | the xmlParserInputBufferPtr attached to the XML or NULL in case of error. |
int xmlTextReaderHasAttributes (xmlTextReaderPtr reader)
Whether the node has attributes.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 if true, 0 if false, and -1 in case or error |
int xmlTextReaderHasValue (xmlTextReaderPtr reader)
Whether the node can have a text value.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 if true, 0 if false, and -1 in case or error |
int xmlTextReaderIsDefault (xmlTextReaderPtr reader)
Whether an Attribute node was generated from the default value defined in the DTD or schema.
| reader: | the xmlTextReaderPtr used |
| Returns: | 0 if not defaulted, 1 if defaulted, and -1 in case of error |
int xmlTextReaderIsEmptyElement (xmlTextReaderPtr reader)
Check if the current node is empty
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 if empty, 0 if not and -1 in case of error |
int xmlTextReaderIsNamespaceDecl (xmlTextReaderPtr reader)
Determine whether the current node is a namespace declaration rather than a regular attribute.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 if the current node is a namespace declaration, 0 if it is a regular attribute or other type of node, or -1 in case of error. |
int xmlTextReaderIsValid (xmlTextReaderPtr reader)
Retrieve the validity status from the parser context
| reader: | the xmlTextReaderPtr used |
| Returns: | the flag value 1 if valid, 0 if no, and -1 in case of error |
xmlChar * xmlTextReaderLocalName (xmlTextReaderPtr reader)
The local name of the node.
| reader: | the xmlTextReaderPtr used |
| Returns: | the local name or NULL if not available, if non NULL it need to be freed by the caller. |
xmlChar * xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator)
Obtain the base URI for the given locator.
| locator: | the xmlTextReaderLocatorPtr used |
| Returns: | the base URI or NULL in case of error, if non NULL it need to be freed by the caller. |
int xmlTextReaderLocatorLineNumber (xmlTextReaderLocatorPtr locator)
Obtain the line number for the given locator.
| locator: | the xmlTextReaderLocatorPtr used |
| Returns: | the line number or -1 in case of error. |
xmlChar * xmlTextReaderLookupNamespace (xmlTextReaderPtr reader,
const xmlChar * prefix)
Resolves a namespace prefix in the scope of the current element.
| reader: | the xmlTextReaderPtr used |
| prefix: | the prefix whose namespace URI is to be resolved. To return the default namespace, specify NULL |
| Returns: | a string containing the namespace URI to which the prefix maps or NULL in case of error. The string must be deallocated by the caller. |
int xmlTextReaderMoveToAttribute (xmlTextReaderPtr reader,
const xmlChar * name)
Moves the position of the current instance to the attribute with the specified qualified name.
| reader: | the xmlTextReaderPtr used |
| name: | the qualified name of the attribute. |
| Returns: | 1 in case of success, -1 in case of error, 0 if not found |
int xmlTextReaderMoveToAttributeNo (xmlTextReaderPtr reader,
int no)
Moves the position of the current instance to the attribute with the specified index relative to the containing element.
| reader: | the xmlTextReaderPtr used |
| no: | the zero-based index of the attribute relative to the containing element. |
| Returns: | 1 in case of success, -1 in case of error, 0 if not found |
int xmlTextReaderMoveToAttributeNs (xmlTextReaderPtr reader,
const xmlChar * localName,
const xmlChar * namespaceURI)
Moves the position of the current instance to the attribute with the specified local name and namespace URI.
| reader: | the xmlTextReaderPtr used |
| localName: | the local name of the attribute. |
| namespaceURI: | the namespace URI of the attribute. |
| Returns: | 1 in case of success, -1 in case of error, 0 if not found |
int xmlTextReaderMoveToElement (xmlTextReaderPtr reader)
Moves the position of the current instance to the node that contains the current Attribute node.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 in case of success, -1 in case of error, 0 if not moved |
int xmlTextReaderMoveToFirstAttribute (xmlTextReaderPtr reader)
Moves the position of the current instance to the first attribute associated with the current node.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 in case of success, -1 in case of error, 0 if not found |
int xmlTextReaderMoveToNextAttribute (xmlTextReaderPtr reader)
Moves the position of the current instance to the next attribute associated with the current node.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 in case of success, -1 in case of error, 0 if not found |
xmlChar * xmlTextReaderName (xmlTextReaderPtr reader)
The qualified name of the node, equal to Prefix :LocalName.
| reader: | the xmlTextReaderPtr used |
| Returns: | the local name or NULL if not available, if non NULL it need to be freed by the caller. |
xmlChar * xmlTextReaderNamespaceUri (xmlTextReaderPtr reader)
The URI defining the namespace associated with the node.
| reader: | the xmlTextReaderPtr used |
| Returns: | the namespace URI or NULL if not available, if non NULL it need to be freed by the caller. |
int xmlTextReaderNext (xmlTextReaderPtr reader)
Skip to the node following the current one in document order while avoiding the subtree if any.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error |
int xmlTextReaderNextSibling (xmlTextReaderPtr reader)
Skip to the node following the current one in document order while avoiding the subtree if any. Currently implemented only for Readers built on a document
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error |
int xmlTextReaderNodeType (xmlTextReaderPtr reader)
Get the node type of the current node Reference: http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html
| reader: | the xmlTextReaderPtr used |
| Returns: | the xmlNodeType of the current node or -1 in case of error |
int xmlTextReaderNormalization (xmlTextReaderPtr reader)
The value indicating whether to normalize white space and attribute values. Since attribute value and end of line normalizations are a MUST in the XML specification only the value true is accepted. The broken bahaviour of accepting out of range character entities like � is of course not supported either.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 or -1 in case of error. |
xmlChar * xmlTextReaderPrefix (xmlTextReaderPtr reader)
A shorthand reference to the namespace associated with the node.
| reader: | the xmlTextReaderPtr used |
| Returns: | the prefix or NULL if not available, if non NULL it need to be freed by the caller. |
xmlNodePtr xmlTextReaderPreserve (xmlTextReaderPtr reader)
This tells the XML Reader to preserve the current node. The caller must also use xmlTextReaderCurrentDoc() to keep an handle on the resulting document once parsing has finished
| reader: | the xmlTextReaderPtr used |
| Returns: | the xmlNodePtr or NULL in case of error. |
int xmlTextReaderPreservePattern (xmlTextReaderPtr reader,
const xmlChar * pattern,
const xmlChar ** namespaces)
This tells the XML Reader to preserve all nodes matched by the pattern. The caller must also use xmlTextReaderCurrentDoc() to keep an handle on the resulting document once parsing has finished
| reader: | the xmlTextReaderPtr used |
| pattern: | an XPath subset pattern |
| namespaces: | the prefix definitions, array of [URI, prefix] or NULL |
| Returns: | a non-negative number in case of success and -1 in case of error |
int xmlTextReaderQuoteChar (xmlTextReaderPtr reader)
The quotation mark character used to enclose the value of an attribute.
| reader: | the xmlTextReaderPtr used |
| Returns: | " or ' and -1 in case of error |
int xmlTextReaderRead (xmlTextReaderPtr reader)
Moves the position of the current instance to the next node in the stream, exposing its properties.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error |
int xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader)
Parses an attribute value into one or more Text and EntityReference nodes.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 in case of success, 0 if the reader was not positionned on an ttribute node or all the attribute values have been read, or -1 in case of error. |
xmlChar * xmlTextReaderReadInnerXml (xmlTextReaderPtr reader)
Reads the contents of the current node, including child nodes and markup.
| reader: | the xmlTextReaderPtr used |
| Returns: | a string containing the XML content, or NULL if the current node is neither an element nor attribute, or has no child nodes. The string must be deallocated by the caller. |
xmlChar * xmlTextReaderReadOuterXml (xmlTextReaderPtr reader)
Reads the contents of the current node, including child nodes and markup.
| reader: | the xmlTextReaderPtr used |
| Returns: | a string containing the node and any XML content, or NULL if the current node cannot be serialized. The string must be deallocated by the caller. |
int xmlTextReaderReadState (xmlTextReaderPtr reader)
Gets the read state of the reader.
| reader: | the xmlTextReaderPtr used |
| Returns: | the state value, or -1 in case of error |
xmlChar * xmlTextReaderReadString (xmlTextReaderPtr reader)
Reads the contents of an element or a text node as a string.
| reader: | the xmlTextReaderPtr used |
| Returns: | a string containing the contents of the Element or Text node, or NULL if the reader is positioned on any other type of node. The string must be deallocated by the caller. |
int xmlTextReaderRelaxNGSetSchema (xmlTextReaderPtr reader,
xmlRelaxNGPtr schema)
Use RelaxNG to validate the document as it is processed. Activation is only possible before the first Read(). if @schema is NULL, then RelaxNG validation is desactivated. @ The @schema should not be freed until the reader is deallocated or its use has been deactivated.
| reader: | the xmlTextReaderPtr used |
| schema: | a precompiled RelaxNG schema |
| Returns: | 0 in case the RelaxNG validation could be (des)activated and -1 in case of error. |
int xmlTextReaderRelaxNGValidate (xmlTextReaderPtr reader,
const char * rng)
Use RelaxNG schema to validate the document as it is processed. Activation is only possible before the first Read(). If @rng is NULL, then RelaxNG schema validation is deactivated.
| reader: | the xmlTextReaderPtr used |
| rng: | the path to a RelaxNG schema or NULL |
| Returns: | 0 in case the schemas validation could be (de)activated and -1 in case of error. |
int xmlTextReaderRelaxNGValidateCtxt (xmlTextReaderPtr reader,
xmlRelaxNGValidCtxtPtr ctxt,
int options)
Use RelaxNG schema context to validate the document as it is processed. Activation is only possible before the first Read(). If @ctxt is NULL, then RelaxNG schema validation is deactivated.
| reader: | the xmlTextReaderPtr used |
| ctxt: | the RelaxNG schema validation context or NULL |
| options: | options (not used yet) |
| Returns: | 0 in case the schemas validation could be (de)activated and -1 in case of error. |
int xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
const char * xsd)
Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read(). If @xsd is NULL, then XML Schema validation is deactivated.
| reader: | the xmlTextReaderPtr used |
| xsd: | the path to a W3C XSD schema or NULL |
| Returns: | 0 in case the schemas validation could be (de)activated and -1 in case of error. |
int xmlTextReaderSchemaValidateCtxt (xmlTextReaderPtr reader,
xmlSchemaValidCtxtPtr ctxt,
int options)
Use W3C XSD schema context to validate the document as it is processed. Activation is only possible before the first Read(). If @ctxt is NULL, then XML Schema validation is deactivated.
| reader: | the xmlTextReaderPtr used |
| ctxt: | the XML Schema validation context or NULL |
| options: | options (not used yet) |
| Returns: | 0 in case the schemas validation could be (de)activated and -1 in case of error. |
void xmlTextReaderSetErrorHandler (xmlTextReaderPtr reader,
xmlTextReaderErrorFunc f,
void * arg)
Register a callback function that will be called on error and warnings. If @f is NULL, the default error and warning handlers are restored.
| reader: | the xmlTextReaderPtr used |
| f: | the callback function to call on error and warnings |
| arg: | a user argument to pass to the callback function |
int xmlTextReaderSetParserProp (xmlTextReaderPtr reader,
int prop,
int value)
Change the parser processing behaviour by changing some of its internal properties. Note that some properties can only be changed before any read has been done.
| reader: | the xmlTextReaderPtr used |
| prop: | the xmlParserProperties to set |
| value: | usually 0 or 1 to (de)activate it |
| Returns: | 0 if the call was successful, or -1 in case of error |
int xmlTextReaderSetSchema (xmlTextReaderPtr reader,
xmlSchemaPtr schema)
Use XSD Schema to validate the document as it is processed. Activation is only possible before the first Read(). if @schema is NULL, then Schema validation is desactivated. @ The @schema should not be freed until the reader is deallocated or its use has been deactivated.
| reader: | the xmlTextReaderPtr used |
| schema: | a precompiled Schema schema |
| Returns: | 0 in case the Schema validation could be (des)activated and -1 in case of error. |
void xmlTextReaderSetStructuredErrorHandler (xmlTextReaderPtr reader,
xmlStructuredErrorFunc f,
void * arg)
Register a callback function that will be called on error and warnings. If @f is NULL, the default error and warning handlers are restored.
| reader: | the xmlTextReaderPtr used |
| f: | the callback function to call on error and warnings |
| arg: | a user argument to pass to the callback function |
int xmlTextReaderSetup (xmlTextReaderPtr reader,
xmlParserInputBufferPtr input,
const char * URL,
const char * encoding,
int options)
Setup an XML reader with new options
| reader: | an XML reader |
| input: | xmlParserInputBufferPtr used to feed the reader, will be destroyed with it. |
| URL: | the base URL to use for the document |
| encoding: | the document encoding, or NULL |
| options: | a combination of xmlParserOption |
| Returns: | 0 in case of success and -1 in case of error. |
int xmlTextReaderStandalone (xmlTextReaderPtr reader)
Determine the standalone status of the document being read.
| reader: | the xmlTextReaderPtr used |
| Returns: | 1 if the document was declared to be standalone, 0 if it was declared to be not standalone, or -1 if the document did not specify its standalone status or in case of error. |
xmlChar * xmlTextReaderValue (xmlTextReaderPtr reader)
Provides the text value of the node if present
| reader: | the xmlTextReaderPtr used |
| Returns: | the string or NULL if not available. The result must be deallocated with xmlFree() |
xmlChar * xmlTextReaderXmlLang (xmlTextReaderPtr reader)
The xml:lang scope within which the node resides.
| reader: | the xmlTextReaderPtr used |
| Returns: | the xml:lang value or NULL if none exists., if non NULL it need to be freed by the caller. |