mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-12-25 23:21:26 +03:00
preparing a 2.6.0-beta2 release avoid a warning avoid duplicate code in
* configure.in: preparing a 2.6.0-beta2 release * xmlIO.c: avoid a warning * tree.c: avoid duplicate code in xmlReplaceNode as pointed out by Chris Ryland * include/libxml/dict.h: add a QName access lookup to the dictionary. * xmlreader.c include/libxml/xmlreader.h: adding const access based on the dictionary interface for string read from the reader, the node content access is still TODO, it's too different Daniel
This commit is contained in:
parent
d9e9c9d8f3
commit
e72c508cd0
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
Fri Sep 19 14:26:28 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* configure.in: preparing a 2.6.0-beta2 release
|
||||
* xmlIO.c: avoid a warning
|
||||
* tree.c: avoid duplicate code in xmlReplaceNode as pointed out
|
||||
by Chris Ryland
|
||||
* include/libxml/dict.h: add a QName access lookup to the
|
||||
dictionary.
|
||||
* xmlreader.c include/libxml/xmlreader.h: adding const access
|
||||
based on the dictionary interface for string read from the
|
||||
reader, the node content access is still TODO, it's too different
|
||||
|
||||
Fri Sep 19 00:01:08 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* SAX2.c: fixing namespace DTD validations
|
||||
|
@ -7,7 +7,7 @@ AC_CANONICAL_HOST
|
||||
LIBXML_MAJOR_VERSION=2
|
||||
LIBXML_MINOR_VERSION=6
|
||||
LIBXML_MICRO_VERSION=0
|
||||
LIBXML_MICRO_VERSION_SUFFIX=beta1
|
||||
LIBXML_MICRO_VERSION_SUFFIX=beta2
|
||||
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
|
||||
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
|
||||
|
||||
|
198
dict.c
198
dict.c
@ -114,6 +114,66 @@ found_pool:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* xmlDictAddQString:
|
||||
* @dict: the dictionnary
|
||||
* @prefix: the prefix of the userdata
|
||||
* @name: the name of the userdata
|
||||
* @len: the length of the name, if -1 it is recomputed
|
||||
*
|
||||
* Add the QName to the array[s]
|
||||
*
|
||||
* Returns the pointer of the local string, or NULL in case of error.
|
||||
*/
|
||||
static const xmlChar *
|
||||
xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix,
|
||||
const xmlChar *name, int namelen)
|
||||
{
|
||||
xmlDictStringsPtr pool;
|
||||
const xmlChar *ret;
|
||||
int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */
|
||||
int plen;
|
||||
|
||||
if (prefix == NULL) return(xmlDictAddString(dict, name, namelen));
|
||||
plen = xmlStrlen(prefix);
|
||||
|
||||
pool = dict->strings;
|
||||
while (pool != NULL) {
|
||||
if (pool->end - pool->free > namelen)
|
||||
goto found_pool;
|
||||
if (pool->size > size) size = pool->size;
|
||||
pool = pool->next;
|
||||
}
|
||||
/*
|
||||
* Not found, need to allocate
|
||||
*/
|
||||
if (pool == NULL) {
|
||||
if (size == 0) size = 1000;
|
||||
else size *= 4; /* exponential growth */
|
||||
if (size < 4 * namelen)
|
||||
size = 4 * namelen; /* just in case ! */
|
||||
pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size);
|
||||
if (pool == NULL)
|
||||
return(NULL);
|
||||
pool->size = size;
|
||||
pool->nbStrings = 0;
|
||||
pool->free = &pool->array[0];
|
||||
pool->end = &pool->array[size];
|
||||
pool->next = dict->strings;
|
||||
dict->strings = pool;
|
||||
}
|
||||
found_pool:
|
||||
ret = pool->free;
|
||||
memcpy(pool->free, prefix, plen);
|
||||
pool->free += plen;
|
||||
*(pool->free++) = ':';
|
||||
namelen -= plen + 1;
|
||||
memcpy(pool->free, name, namelen);
|
||||
pool->free += namelen;
|
||||
*(pool->free++) = 0;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* xmlDictComputeKey:
|
||||
* Calculate the hash key
|
||||
@ -141,16 +201,66 @@ xmlDictComputeKey(xmlDictPtr dict, const xmlChar *name, int namelen) {
|
||||
case 1: value += name[0];
|
||||
default: break;
|
||||
}
|
||||
#if 0
|
||||
while ((len++ < namelen) && ((ch = *name++) != 0)) {
|
||||
value += (unsigned long)ch;
|
||||
return (value % dict->size);
|
||||
}
|
||||
|
||||
/*
|
||||
* xmlDictComputeQKey:
|
||||
* Calculate the hash key
|
||||
*/
|
||||
static unsigned long
|
||||
xmlDictComputeQKey(xmlDictPtr dict, const xmlChar *prefix,
|
||||
const xmlChar *name, int len)
|
||||
{
|
||||
unsigned long value = 0L;
|
||||
int plen;
|
||||
|
||||
if (prefix == NULL)
|
||||
return(xmlDictComputeKey(dict, name, len));
|
||||
|
||||
plen = xmlStrlen(prefix);
|
||||
if (plen == 0)
|
||||
value += 30 * (unsigned long) ':';
|
||||
else
|
||||
value += 30 * (*prefix);
|
||||
|
||||
if (len > 10) {
|
||||
value += name[len - (plen + 1 + 1)];
|
||||
len = 10;
|
||||
if (plen > 10)
|
||||
plen = 10;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
while ((len++ < namelen) && ((ch = *name++) != 0)) {
|
||||
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
|
||||
switch (plen) {
|
||||
case 10: value += prefix[9];
|
||||
case 9: value += prefix[8];
|
||||
case 8: value += prefix[7];
|
||||
case 7: value += prefix[6];
|
||||
case 6: value += prefix[5];
|
||||
case 5: value += prefix[4];
|
||||
case 4: value += prefix[3];
|
||||
case 3: value += prefix[2];
|
||||
case 2: value += prefix[1];
|
||||
case 1: value += prefix[0];
|
||||
default: break;
|
||||
}
|
||||
len -= plen;
|
||||
if (len > 0) {
|
||||
value += (unsigned long) ':';
|
||||
len--;
|
||||
}
|
||||
switch (len) {
|
||||
case 10: value += name[9];
|
||||
case 9: value += name[8];
|
||||
case 8: value += name[7];
|
||||
case 7: value += name[6];
|
||||
case 6: value += name[5];
|
||||
case 5: value += name[4];
|
||||
case 4: value += name[3];
|
||||
case 3: value += name[2];
|
||||
case 2: value += name[1];
|
||||
case 1: value += name[0];
|
||||
default: break;
|
||||
}
|
||||
#endif
|
||||
return (value % dict->size);
|
||||
}
|
||||
|
||||
@ -389,6 +499,78 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlDictQLookup:
|
||||
* @dict: the dictionnary
|
||||
* @prefix: the prefix
|
||||
* @name: the name
|
||||
*
|
||||
* Add the QName @prefix:@name to the hash @dict if not present.
|
||||
*
|
||||
* Returns the internal copy of the QName or NULL in case of internal error
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
|
||||
unsigned long key, nbi = 0;
|
||||
xmlDictEntryPtr entry;
|
||||
xmlDictEntryPtr insert;
|
||||
const xmlChar *ret;
|
||||
int len;
|
||||
|
||||
if ((dict == NULL) || (name == NULL))
|
||||
return(NULL);
|
||||
|
||||
len = xmlStrlen(name);
|
||||
if (prefix != NULL)
|
||||
len += 1 + xmlStrlen(prefix);
|
||||
|
||||
/*
|
||||
* Check for duplicate and insertion location.
|
||||
*/
|
||||
key = xmlDictComputeQKey(dict, prefix, name, len);
|
||||
if (dict->dict[key].valid == 0) {
|
||||
insert = NULL;
|
||||
} else {
|
||||
for (insert = &(dict->dict[key]); insert->next != NULL;
|
||||
insert = insert->next) {
|
||||
if ((insert->len == len) &&
|
||||
(xmlStrQEqual(prefix, name, insert->name)))
|
||||
return(insert->name);
|
||||
nbi++;
|
||||
}
|
||||
if ((insert->len == len) &&
|
||||
(xmlStrQEqual(prefix, name, insert->name)))
|
||||
return(insert->name);
|
||||
}
|
||||
|
||||
ret = xmlDictAddQString(dict, prefix, name, len);
|
||||
if (ret == NULL)
|
||||
return(NULL);
|
||||
if (insert == NULL) {
|
||||
entry = &(dict->dict[key]);
|
||||
} else {
|
||||
entry = xmlMalloc(sizeof(xmlDictEntry));
|
||||
if (entry == NULL)
|
||||
return(NULL);
|
||||
}
|
||||
entry->name = ret;
|
||||
entry->len = len;
|
||||
entry->next = NULL;
|
||||
entry->valid = 1;
|
||||
|
||||
if (insert != NULL)
|
||||
insert->next = entry;
|
||||
|
||||
dict->nbElems++;
|
||||
|
||||
if ((nbi > MAX_HASH_LEN) &&
|
||||
(dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN)))
|
||||
xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size);
|
||||
/* Note that entry may have been freed at this point by xmlDictGrow */
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlDictOwns:
|
||||
* @dict: the dictionnary
|
||||
|
@ -518,7 +518,6 @@
|
||||
<exports symbol='docbDocPtr'/>
|
||||
<exports symbol='docbEncodeEntities'/>
|
||||
<exports symbol='docbFreeParserCtxt'/>
|
||||
<exports symbol='docbNodePtr'/>
|
||||
<exports symbol='docbParseChunk'/>
|
||||
<exports symbol='docbParseDoc'/>
|
||||
<exports symbol='docbParseDocument'/>
|
||||
@ -527,7 +526,6 @@
|
||||
<exports symbol='docbParserCtxtPtr'/>
|
||||
<exports symbol='docbParserInput'/>
|
||||
<exports symbol='docbParserInputPtr'/>
|
||||
<exports symbol='docbParserNodeInfo'/>
|
||||
<exports symbol='docbSAXHandler'/>
|
||||
<exports symbol='docbSAXHandlerPtr'/>
|
||||
<exports symbol='docbSAXParseDoc'/>
|
||||
@ -858,6 +856,7 @@
|
||||
<exports symbol='xmlParserInputBufferCreateFilename'/>
|
||||
<exports symbol='xmlParserInputBufferCreateIO'/>
|
||||
<exports symbol='xmlParserInputBufferCreateMem'/>
|
||||
<exports symbol='xmlParserInputBufferCreateStatic'/>
|
||||
<exports symbol='xmlParserInputBufferGrow'/>
|
||||
<exports symbol='xmlParserInputBufferPush'/>
|
||||
<exports symbol='xmlParserInputBufferRead'/>
|
||||
@ -1296,6 +1295,12 @@
|
||||
<exports symbol='xmlTextReaderAttributeCount'/>
|
||||
<exports symbol='xmlTextReaderBaseUri'/>
|
||||
<exports symbol='xmlTextReaderClose'/>
|
||||
<exports symbol='xmlTextReaderConstBaseUri'/>
|
||||
<exports symbol='xmlTextReaderConstLocalName'/>
|
||||
<exports symbol='xmlTextReaderConstName'/>
|
||||
<exports symbol='xmlTextReaderConstNamespaceUri'/>
|
||||
<exports symbol='xmlTextReaderConstPrefix'/>
|
||||
<exports symbol='xmlTextReaderConstXmlLang'/>
|
||||
<exports symbol='xmlTextReaderCurrentDoc'/>
|
||||
<exports symbol='xmlTextReaderCurrentNode'/>
|
||||
<exports symbol='xmlTextReaderDepth'/>
|
||||
@ -1469,7 +1474,9 @@
|
||||
<exports symbol='xmlDictCreate'/>
|
||||
<exports symbol='xmlDictFree'/>
|
||||
<exports symbol='xmlDictLookup'/>
|
||||
<exports symbol='xmlDictOwns'/>
|
||||
<exports symbol='xmlDictPtr'/>
|
||||
<exports symbol='xmlDictQLookup'/>
|
||||
<exports symbol='xmlDictSize'/>
|
||||
</file>
|
||||
<file name='xmlexports'>
|
||||
@ -1629,6 +1636,7 @@
|
||||
<exports symbol='XML_ERR_CHARREF_IN_PROLOG'/>
|
||||
<exports symbol='XML_ERR_COMMENT_NOT_FINISHED'/>
|
||||
<exports symbol='XML_ERR_CONDSEC_INVALID'/>
|
||||
<exports symbol='XML_ERR_CONDSEC_INVALID_KEYWORD'/>
|
||||
<exports symbol='XML_ERR_CONDSEC_NOT_FINISHED'/>
|
||||
<exports symbol='XML_ERR_CONDSEC_NOT_STARTED'/>
|
||||
<exports symbol='XML_ERR_DOCTYPE_NOT_FINISHED'/>
|
||||
@ -1707,8 +1715,13 @@
|
||||
<exports symbol='XML_ERR_URI_FRAGMENT'/>
|
||||
<exports symbol='XML_ERR_URI_REQUIRED'/>
|
||||
<exports symbol='XML_ERR_VALUE_REQUIRED'/>
|
||||
<exports symbol='XML_ERR_VERSION_MISSING'/>
|
||||
<exports symbol='XML_ERR_XMLDECL_NOT_FINISHED'/>
|
||||
<exports symbol='XML_ERR_XMLDECL_NOT_STARTED'/>
|
||||
<exports symbol='XML_NS_ERR_ATTRIBUTE_REDEFINED'/>
|
||||
<exports symbol='XML_NS_ERR_QNAME'/>
|
||||
<exports symbol='XML_NS_ERR_UNDEFINED_NAMESPACE'/>
|
||||
<exports symbol='XML_NS_ERR_XML_NAMESPACE'/>
|
||||
<exports symbol='XML_WAR_CATALOG_PI'/>
|
||||
<exports symbol='XML_WAR_UNDECLARED_ENTITY'/>
|
||||
<exports symbol='initGenericErrorDefaultFunc'/>
|
||||
@ -1743,6 +1756,7 @@
|
||||
<exports symbol='XML_ATTRIBUTE_REQUIRED'/>
|
||||
<exports symbol='XML_BUFFER_ALLOC_DOUBLEIT'/>
|
||||
<exports symbol='XML_BUFFER_ALLOC_EXACT'/>
|
||||
<exports symbol='XML_BUFFER_ALLOC_IMMUTABLE'/>
|
||||
<exports symbol='XML_CDATA_SECTION_NODE'/>
|
||||
<exports symbol='XML_COMMENT_NODE'/>
|
||||
<exports symbol='XML_DOCB_DOCUMENT_NODE'/>
|
||||
@ -1814,6 +1828,7 @@
|
||||
<exports symbol='xmlBufferContent'/>
|
||||
<exports symbol='xmlBufferCreate'/>
|
||||
<exports symbol='xmlBufferCreateSize'/>
|
||||
<exports symbol='xmlBufferCreateStatic'/>
|
||||
<exports symbol='xmlBufferDump'/>
|
||||
<exports symbol='xmlBufferEmpty'/>
|
||||
<exports symbol='xmlBufferFree'/>
|
||||
@ -2673,6 +2688,7 @@
|
||||
<enum name='XML_ATTRIBUTE_REQUIRED' file='tree' value='2' type='xmlAttributeDefault'/>
|
||||
<enum name='XML_BUFFER_ALLOC_DOUBLEIT' file='tree' value='1' type='xmlBufferAllocationScheme'/>
|
||||
<enum name='XML_BUFFER_ALLOC_EXACT' file='tree' value='2' type='xmlBufferAllocationScheme'/>
|
||||
<enum name='XML_BUFFER_ALLOC_IMMUTABLE' file='tree' value='3' type='xmlBufferAllocationScheme'/>
|
||||
<enum name='XML_CATA_ALLOW_ALL' file='catalog' value='3' type='xmlCatalogAllow'/>
|
||||
<enum name='XML_CATA_ALLOW_DOCUMENT' file='catalog' value='2' type='xmlCatalogAllow'/>
|
||||
<enum name='XML_CATA_ALLOW_GLOBAL' file='catalog' value='1' type='xmlCatalogAllow'/>
|
||||
@ -2742,6 +2758,7 @@
|
||||
<enum name='XML_ERR_CHARREF_IN_PROLOG' file='xmlerror' value='11' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_COMMENT_NOT_FINISHED' file='xmlerror' value='45' type='xmlParserErrors' info='45'/>
|
||||
<enum name='XML_ERR_CONDSEC_INVALID' file='xmlerror' value='83' type='xmlParserErrors' info='84'/>
|
||||
<enum name='XML_ERR_CONDSEC_INVALID_KEYWORD' file='xmlerror' value='99' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_CONDSEC_NOT_FINISHED' file='xmlerror' value='59' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_CONDSEC_NOT_STARTED' file='xmlerror' value='58' type='xmlParserErrors' info='59'/>
|
||||
<enum name='XML_ERR_DOCTYPE_NOT_FINISHED' file='xmlerror' value='61' type='xmlParserErrors' info='62'/>
|
||||
@ -2791,7 +2808,7 @@
|
||||
<enum name='XML_ERR_NOTATION_NOT_FINISHED' file='xmlerror' value='49' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_NOTATION_NOT_STARTED' file='xmlerror' value='48' type='xmlParserErrors' info='49'/>
|
||||
<enum name='XML_ERR_NOT_WELL_BALANCED' file='xmlerror' value='85' type='xmlParserErrors' info='86'/>
|
||||
<enum name='XML_ERR_NO_DTD' file='xmlerror' value='94' type='xmlParserErrors' info=' 94'/>
|
||||
<enum name='XML_ERR_NO_DTD' file='xmlerror' value='94' type='xmlParserErrors' info='94'/>
|
||||
<enum name='XML_ERR_NO_MEMORY' file='xmlerror' value='2' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_NS_DECL_ERROR' file='xmlerror' value='35' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_OK' file='xmlerror' value='0' type='xmlParserErrors'/>
|
||||
@ -2820,6 +2837,7 @@
|
||||
<enum name='XML_ERR_URI_FRAGMENT' file='xmlerror' value='92' type='xmlParserErrors' info='92'/>
|
||||
<enum name='XML_ERR_URI_REQUIRED' file='xmlerror' value='70' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_VALUE_REQUIRED' file='xmlerror' value='84' type='xmlParserErrors' info='85'/>
|
||||
<enum name='XML_ERR_VERSION_MISSING' file='xmlerror' value='100' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_XMLDECL_NOT_FINISHED' file='xmlerror' value='57' type='xmlParserErrors'/>
|
||||
<enum name='XML_ERR_XMLDECL_NOT_STARTED' file='xmlerror' value='56' type='xmlParserErrors' info='57'/>
|
||||
<enum name='XML_EXTERNAL_GENERAL_PARSED_ENTITY' file='entities' value='2' type='xmlEntityType'/>
|
||||
@ -2831,6 +2849,10 @@
|
||||
<enum name='XML_INTERNAL_PREDEFINED_ENTITY' file='entities' value='6' type='xmlEntityType'/>
|
||||
<enum name='XML_NAMESPACE_DECL' file='tree' value='18' type='xmlElementType'/>
|
||||
<enum name='XML_NOTATION_NODE' file='tree' value='12' type='xmlElementType'/>
|
||||
<enum name='XML_NS_ERR_ATTRIBUTE_REDEFINED' file='xmlerror' value='98' type='xmlParserErrors'/>
|
||||
<enum name='XML_NS_ERR_QNAME' file='xmlerror' value='97' type='xmlParserErrors'/>
|
||||
<enum name='XML_NS_ERR_UNDEFINED_NAMESPACE' file='xmlerror' value='96' type='xmlParserErrors'/>
|
||||
<enum name='XML_NS_ERR_XML_NAMESPACE' file='xmlerror' value='95' type='xmlParserErrors'/>
|
||||
<enum name='XML_PARSER_ATTRIBUTE_VALUE' file='parser' value='12' type='xmlParserInputState' info='within an attribute value'/>
|
||||
<enum name='XML_PARSER_CDATA_SECTION' file='parser' value='8' type='xmlParserInputState' info='within a CDATA section'/>
|
||||
<enum name='XML_PARSER_COMMENT' file='parser' value='5' type='xmlParserInputState' info='within a comment'/>
|
||||
@ -3020,12 +3042,10 @@
|
||||
<enum name='XPTR_SUB_RESOURCE_ERROR' file='xpath' value='18' type='xmlXPathError'/>
|
||||
<enum name='XPTR_SYNTAX_ERROR' file='xpath' value='16' type='xmlXPathError'/>
|
||||
<typedef name='docbDocPtr' file='DOCBparser' type='xmlDocPtr'/>
|
||||
<typedef name='docbNodePtr' file='DOCBparser' type='xmlNodePtr'/>
|
||||
<typedef name='docbParserCtxt' file='DOCBparser' type='xmlParserCtxt'/>
|
||||
<typedef name='docbParserCtxtPtr' file='DOCBparser' type='xmlParserCtxtPtr'/>
|
||||
<typedef name='docbParserInput' file='DOCBparser' type='xmlParserInput'/>
|
||||
<typedef name='docbParserInputPtr' file='DOCBparser' type='xmlParserInputPtr'/>
|
||||
<typedef name='docbParserNodeInfo' file='DOCBparser' type='xmlParserNodeInfo'/>
|
||||
<typedef name='docbSAXHandler' file='DOCBparser' type='xmlSAXHandler'/>
|
||||
<typedef name='docbSAXHandlerPtr' file='DOCBparser' type='xmlSAXHandlerPtr'/>
|
||||
<typedef name='htmlDocPtr' file='HTMLparser' type='xmlDocPtr'/>
|
||||
@ -3435,6 +3455,13 @@ actually an xmlCharEncoding'/>
|
||||
<field name='pushTab' type='void * *' info=' array of data for push'/>
|
||||
<field name='attsDefault' type='xmlHashTablePtr' info=' defaulted attributes if any'/>
|
||||
<field name='attsSpecial' type='xmlHashTablePtr' info=' non-CDATA attributes if any'/>
|
||||
<field name='nsWellFormed' type='int' info='* Those fields are needed only for treaming parsing so far
|
||||
*'/>
|
||||
<field name='dictNames' type='int' info=' Use dictionary names for the tree'/>
|
||||
<field name='freeElemsNr' type='int' info=' number of freed element nodes'/>
|
||||
<field name='freeElems' type='xmlNodePtr' info=' List of freed element nodes'/>
|
||||
<field name='freeAttrsNr' type='int' info=' number of freed attributes nodes'/>
|
||||
<field name='freeAttrs' type='xmlAttrPtr' info=' List of freed attributes nodes'/>
|
||||
</struct>
|
||||
<typedef name='xmlParserCtxtPtr' file='tree' type='xmlParserCtxt *'/>
|
||||
<typedef name='xmlParserErrors' file='xmlerror' type='enum'/>
|
||||
@ -3456,6 +3483,7 @@ actually an xmlCharEncoding'/>
|
||||
<field name='encoding' type='const xmlChar *' info=' the encoding string for entity'/>
|
||||
<field name='version' type='const xmlChar *' info=' the version string for entity'/>
|
||||
<field name='standalone' type='int' info=' Was that entity marked standalone'/>
|
||||
<field name='id' type='int' info=' an unique identifier for the entity'/>
|
||||
</struct>
|
||||
<struct name='xmlParserInputBuffer' file='tree' type='struct _xmlParserInputBuffer'>
|
||||
<field name='context' type='void *' info=''/>
|
||||
@ -5127,6 +5155,12 @@ actually an xmlCharEncoding'/>
|
||||
<return type='xmlBufferPtr' info='the new structure.'/>
|
||||
<arg name='size' type='size_t' info='initial size of buffer'/>
|
||||
</function>
|
||||
<function name='xmlBufferCreateStatic' file='tree'>
|
||||
<info>routine to create an XML buffer from an immutable memory area, The are won't be modified nor copied, and is expected to be present until the end of the buffer lifetime.</info>
|
||||
<return type='xmlBufferPtr' info='the new structure.'/>
|
||||
<arg name='mem' type='void *' info='the memory area'/>
|
||||
<arg name='size' type='size_t' info='the size in byte'/>
|
||||
</function>
|
||||
<function name='xmlBufferDump' file='tree'>
|
||||
<info>Dumps an XML buffer to a FILE *.</info>
|
||||
<return type='int' info='the number of #xmlChar written'/>
|
||||
@ -5754,6 +5788,19 @@ actually an xmlCharEncoding'/>
|
||||
<arg name='name' type='const xmlChar *' info='the name of the userdata'/>
|
||||
<arg name='len' type='int' info='the length of the name, if -1 it is recomputed'/>
|
||||
</function>
|
||||
<function name='xmlDictOwns' file='dict'>
|
||||
<info>check if a string is owned by the disctionary</info>
|
||||
<return type='int' info='1 if true, 0 if false and -1 in case of error -1 in case of error'/>
|
||||
<arg name='dict' type='xmlDictPtr' info='the dictionnary'/>
|
||||
<arg name='str' type='const xmlChar *' info='the string'/>
|
||||
</function>
|
||||
<function name='xmlDictQLookup' file='dict'>
|
||||
<info>Add the QName @prefix:@name to the hash @dict if not present.</info>
|
||||
<return type='const xmlChar *' info='the internal copy of the QName or NULL in case of internal error'/>
|
||||
<arg name='dict' type='xmlDictPtr' info='the dictionnary'/>
|
||||
<arg name='prefix' type='const xmlChar *' info='the prefix'/>
|
||||
<arg name='name' type='const xmlChar *' info='the name'/>
|
||||
</function>
|
||||
<function name='xmlDictSize' file='dict'>
|
||||
<info>Query the number of elements installed in the hash @dict.</info>
|
||||
<return type='int' info='the number of elements in the dictionnary or -1 in case of error'/>
|
||||
@ -7814,7 +7861,7 @@ actually an xmlCharEncoding'/>
|
||||
<info>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 ,).</info>
|
||||
<return type='xmlElementContentPtr' info='the tree of xmlElementContentPtr describing the element hierarchy.'/>
|
||||
<arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
|
||||
<arg name='inputchk' type='xmlParserInputPtr' info='the input used for the current entity, needed for boundary checks'/>
|
||||
<arg name='inputchk' type='int' info='the input used for the current entity, needed for boundary checks'/>
|
||||
</function>
|
||||
<function name='xmlParseElementContentDecl' file='parserInternals'>
|
||||
<info>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</info>
|
||||
@ -7832,7 +7879,7 @@ actually an xmlCharEncoding'/>
|
||||
<info>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.</info>
|
||||
<return type='xmlElementContentPtr' info='the list of the xmlElementContentPtr describing the element choices'/>
|
||||
<arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
|
||||
<arg name='inputchk' type='xmlParserInputPtr' info='the input used for the current entity, needed for boundary checks'/>
|
||||
<arg name='inputchk' type='int' info='the input used for the current entity, needed for boundary checks'/>
|
||||
</function>
|
||||
<function name='xmlParseEncName' file='parserInternals'>
|
||||
<info>parse the XML encoding name [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*</info>
|
||||
@ -8106,6 +8153,13 @@ actually an xmlCharEncoding'/>
|
||||
<arg name='size' type='int' info='the length of the memory block'/>
|
||||
<arg name='enc' type='xmlCharEncoding' info='the charset encoding if known'/>
|
||||
</function>
|
||||
<function name='xmlParserInputBufferCreateStatic' file='xmlIO'>
|
||||
<info>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.</info>
|
||||
<return type='xmlParserInputBufferPtr' info='the new parser input or NULL'/>
|
||||
<arg name='mem' type='const char *' info='the memory input'/>
|
||||
<arg name='size' type='int' info='the length of the memory block'/>
|
||||
<arg name='enc' type='xmlCharEncoding' info='the charset encoding if known'/>
|
||||
</function>
|
||||
<function name='xmlParserInputBufferGrow' file='xmlIO'>
|
||||
<info>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</info>
|
||||
<return type='int' info='the number of chars read and stored in the buffer, or -1 in case of error.'/>
|
||||
@ -9490,6 +9544,36 @@ actually an xmlCharEncoding'/>
|
||||
<return type='int' info='0 or -1 in case of error'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderConstBaseUri' file='xmlreader'>
|
||||
<info>The base URI of the node.</info>
|
||||
<return type='const xmlChar *' info='the base URI or NULL if not available, the string will be deallocated with the reader'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderConstLocalName' file='xmlreader'>
|
||||
<info>The local name of the node.</info>
|
||||
<return type='const xmlChar *' info='the local name or NULL if not available, the string will be deallocated with the reader.'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderConstName' file='xmlreader'>
|
||||
<info>The qualified name of the node, equal to Prefix :LocalName.</info>
|
||||
<return type='const xmlChar *' info='the local name or NULL if not available, the string is deallocated with the reader.'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderConstNamespaceUri' file='xmlreader'>
|
||||
<info>The URI defining the namespace associated with the node.</info>
|
||||
<return type='const xmlChar *' info='the namespace URI or NULL if not available, the string will be deallocated with the reader'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderConstPrefix' file='xmlreader'>
|
||||
<info>A shorthand reference to the namespace associated with the node.</info>
|
||||
<return type='const xmlChar *' info='the prefix or NULL if not available, the string is deallocated with the reader.'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderConstXmlLang' file='xmlreader'>
|
||||
<info></info>
|
||||
<return type='const xmlChar *' info=''/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info=''/>
|
||||
</function>
|
||||
<function name='xmlTextReaderCurrentDoc' file='xmlreader'>
|
||||
<info>Hacking interface allowing to get the xmlDocPtr correponding to the current document being accessed by the xmlTextReader. This is dangerous because the associated node may be destroyed on the next Reads.</info>
|
||||
<return type='xmlDocPtr' info='the xmlDocPtr or NULL in case of error.'/>
|
||||
|
@ -47,6 +47,10 @@ XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlDictLookup (xmlDictPtr dict,
|
||||
const xmlChar *name,
|
||||
int len);
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlDictQLookup (xmlDictPtr dict,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlDictOwns (xmlDictPtr dict,
|
||||
const xmlChar *str);
|
||||
|
@ -88,8 +88,6 @@ XMLPUBFUN int XMLCALL
|
||||
*/
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderDepth (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
@ -100,25 +98,39 @@ XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderIsDefault (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderNodeType (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderReadState (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderLocalName (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderName (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderNodeType (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderPrefix (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderValue (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderXmlLang (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderReadState (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlTextReaderValue (xmlTextReaderPtr reader);
|
||||
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlTextReaderConstLocalName (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlTextReaderConstName (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlTextReaderConstPrefix (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlTextReaderConstXmlLang (xmlTextReaderPtr reader);
|
||||
/*
|
||||
* Methods of the XmlTextReader
|
||||
*/
|
||||
|
@ -650,6 +650,12 @@ Class xmlTextReader(xmlTextReaderCore)
|
||||
AttributeCount()
|
||||
BaseUri()
|
||||
Close()
|
||||
ConstBaseUri()
|
||||
ConstLocalName()
|
||||
ConstName()
|
||||
ConstNamespaceUri()
|
||||
ConstPrefix()
|
||||
ConstXmlLang()
|
||||
CurrentDoc()
|
||||
CurrentNode()
|
||||
Depth()
|
||||
|
16
tree.c
16
tree.c
@ -3432,20 +3432,6 @@ xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlReplaceNode : Trying to replace a non-attribute node with attribute node\n");
|
||||
#endif
|
||||
return(old);
|
||||
}
|
||||
if ((old->type==XML_ATTRIBUTE_NODE) && (cur->type!=XML_ATTRIBUTE_NODE)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlReplaceNode : Trying to replace attribute node with other node type\n");
|
||||
#endif
|
||||
return(old);
|
||||
}
|
||||
if ((cur->type==XML_ATTRIBUTE_NODE) && (old->type!=XML_ATTRIBUTE_NODE)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlReplaceNode : Trying to replace a non-attribute node with attribute node\n");
|
||||
#endif
|
||||
return(old);
|
||||
}
|
||||
@ -6420,7 +6406,7 @@ xmlBufferEmpty(xmlBufferPtr buf) {
|
||||
if (buf->content == NULL) return;
|
||||
buf->use = 0;
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) {
|
||||
buf->content="";
|
||||
buf->content = "";
|
||||
} else {
|
||||
memset(buf->content, 0, buf->size);
|
||||
}
|
||||
|
2
xmlIO.c
2
xmlIO.c
@ -2039,7 +2039,7 @@ xmlParserInputBufferCreateStatic(const char *mem, int size,
|
||||
return(NULL);
|
||||
}
|
||||
memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
|
||||
ret->buffer = xmlBufferCreateStatic(mem, size);
|
||||
ret->buffer = xmlBufferCreateStatic((void *)mem, (size_t) size);
|
||||
if (ret->buffer == NULL) {
|
||||
xmlFree(ret);
|
||||
return(NULL);
|
||||
|
216
xmlreader.c
216
xmlreader.c
@ -135,6 +135,14 @@ struct _xmlTextReader {
|
||||
|
||||
static const char *xmlTextReaderIsEmpty = "This element is empty";
|
||||
|
||||
/**
|
||||
* CONSTSTR:
|
||||
*
|
||||
* Macro used to return an interned string
|
||||
*/
|
||||
#define CONSTSTR(str) xmlDictLookup(reader->ctxt->dict, (str), -1)
|
||||
#define CONSTQSTR(p, str) xmlDictQLookup(reader->ctxt->dict, (p), (str))
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Our own version of the freeing routines as we recycle nodes *
|
||||
@ -2447,6 +2455,37 @@ xmlTextReaderLocalName(xmlTextReaderPtr reader) {
|
||||
return(xmlStrdup(node->name));
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderConstLocalName:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
*
|
||||
* The local name of the node.
|
||||
*
|
||||
* Returns the local name or NULL if not available, the
|
||||
* string will be deallocated with the reader.
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlTextReaderConstLocalName(xmlTextReaderPtr reader) {
|
||||
xmlNodePtr node;
|
||||
if ((reader == NULL) || (reader->node == NULL))
|
||||
return(NULL);
|
||||
if (reader->curnode != NULL)
|
||||
node = reader->curnode;
|
||||
else
|
||||
node = reader->node;
|
||||
if (node->type == XML_NAMESPACE_DECL) {
|
||||
xmlNsPtr ns = (xmlNsPtr) node;
|
||||
if (ns->prefix == NULL)
|
||||
return(CONSTSTR(BAD_CAST "xmlns"));
|
||||
else
|
||||
return(ns->prefix);
|
||||
}
|
||||
if ((node->type != XML_ELEMENT_NODE) &&
|
||||
(node->type != XML_ATTRIBUTE_NODE))
|
||||
return(xmlTextReaderConstName(reader));
|
||||
return(node->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderName:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -2522,6 +2561,74 @@ xmlTextReaderName(xmlTextReaderPtr reader) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderConstName:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
*
|
||||
* The qualified name of the node, equal to Prefix :LocalName.
|
||||
*
|
||||
* Returns the local name or NULL if not available, the string is
|
||||
* deallocated with the reader.
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlTextReaderConstName(xmlTextReaderPtr reader) {
|
||||
xmlNodePtr node;
|
||||
|
||||
if ((reader == NULL) || (reader->node == NULL))
|
||||
return(NULL);
|
||||
if (reader->curnode != NULL)
|
||||
node = reader->curnode;
|
||||
else
|
||||
node = reader->node;
|
||||
switch (node->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
if ((node->ns == NULL) ||
|
||||
(node->ns->prefix == NULL))
|
||||
return(node->name);
|
||||
return(CONSTQSTR(node->ns->prefix, node->name));
|
||||
case XML_TEXT_NODE:
|
||||
return(CONSTSTR(BAD_CAST "#text"));
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
return(CONSTSTR(BAD_CAST "#cdata-section"));
|
||||
case XML_ENTITY_NODE:
|
||||
case XML_ENTITY_REF_NODE:
|
||||
return(CONSTSTR(node->name));
|
||||
case XML_PI_NODE:
|
||||
return(CONSTSTR(node->name));
|
||||
case XML_COMMENT_NODE:
|
||||
return(CONSTSTR(BAD_CAST "#comment"));
|
||||
case XML_DOCUMENT_NODE:
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
case XML_DOCB_DOCUMENT_NODE:
|
||||
#endif
|
||||
return(CONSTSTR(BAD_CAST "#document"));
|
||||
case XML_DOCUMENT_FRAG_NODE:
|
||||
return(CONSTSTR(BAD_CAST "#document-fragment"));
|
||||
case XML_NOTATION_NODE:
|
||||
return(CONSTSTR(node->name));
|
||||
case XML_DOCUMENT_TYPE_NODE:
|
||||
case XML_DTD_NODE:
|
||||
return(CONSTSTR(node->name));
|
||||
case XML_NAMESPACE_DECL: {
|
||||
xmlNsPtr ns = (xmlNsPtr) node;
|
||||
|
||||
if (ns->prefix == NULL)
|
||||
return(CONSTSTR(BAD_CAST "xmlns"));
|
||||
return(CONSTQSTR(BAD_CAST "xmlns", ns->prefix));
|
||||
}
|
||||
|
||||
case XML_ELEMENT_DECL:
|
||||
case XML_ATTRIBUTE_DECL:
|
||||
case XML_ENTITY_DECL:
|
||||
case XML_XINCLUDE_START:
|
||||
case XML_XINCLUDE_END:
|
||||
return(NULL);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderPrefix:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -2553,6 +2660,38 @@ xmlTextReaderPrefix(xmlTextReaderPtr reader) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderConstPrefix:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
*
|
||||
* A shorthand reference to the namespace associated with the node.
|
||||
*
|
||||
* Returns the prefix or NULL if not available, the string is deallocated
|
||||
* with the reader.
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlTextReaderConstPrefix(xmlTextReaderPtr reader) {
|
||||
xmlNodePtr node;
|
||||
if ((reader == NULL) || (reader->node == NULL))
|
||||
return(NULL);
|
||||
if (reader->curnode != NULL)
|
||||
node = reader->curnode;
|
||||
else
|
||||
node = reader->node;
|
||||
if (node->type == XML_NAMESPACE_DECL) {
|
||||
xmlNsPtr ns = (xmlNsPtr) node;
|
||||
if (ns->prefix == NULL)
|
||||
return(NULL);
|
||||
return(CONSTSTR(BAD_CAST "xmlns"));
|
||||
}
|
||||
if ((node->type != XML_ELEMENT_NODE) &&
|
||||
(node->type != XML_ATTRIBUTE_NODE))
|
||||
return(NULL);
|
||||
if ((node->ns != NULL) && (node->ns->prefix != NULL))
|
||||
return(CONSTSTR(node->ns->prefix));
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderNamespaceUri:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -2580,6 +2719,34 @@ xmlTextReaderNamespaceUri(xmlTextReaderPtr reader) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderConstNamespaceUri:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
*
|
||||
* The URI defining the namespace associated with the node.
|
||||
*
|
||||
* Returns the namespace URI or NULL if not available, the string
|
||||
* will be deallocated with the reader
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader) {
|
||||
xmlNodePtr node;
|
||||
if ((reader == NULL) || (reader->node == NULL))
|
||||
return(NULL);
|
||||
if (reader->curnode != NULL)
|
||||
node = reader->curnode;
|
||||
else
|
||||
node = reader->node;
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
return(CONSTSTR(BAD_CAST "http://www.w3.org/2000/xmlns/"));
|
||||
if ((node->type != XML_ELEMENT_NODE) &&
|
||||
(node->type != XML_ATTRIBUTE_NODE))
|
||||
return(NULL);
|
||||
if (node->ns != NULL)
|
||||
return(CONSTSTR(node->ns->href));
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderBaseUri:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -2595,6 +2762,30 @@ xmlTextReaderBaseUri(xmlTextReaderPtr reader) {
|
||||
return(xmlNodeGetBase(NULL, reader->node));
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderConstBaseUri:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
*
|
||||
* The base URI of the node.
|
||||
*
|
||||
* Returns the base URI or NULL if not available, the string
|
||||
* will be deallocated with the reader
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlTextReaderConstBaseUri(xmlTextReaderPtr reader) {
|
||||
xmlChar *tmp;
|
||||
const xmlChar *ret;
|
||||
|
||||
if ((reader == NULL) || (reader->node == NULL))
|
||||
return(NULL);
|
||||
tmp = xmlNodeGetBase(NULL, reader->node);
|
||||
if (tmp == NULL)
|
||||
return(NULL);
|
||||
ret = CONSTSTR(tmp);
|
||||
xmlFree(tmp);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderDepth:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -2775,6 +2966,31 @@ xmlTextReaderXmlLang(xmlTextReaderPtr reader) {
|
||||
return(xmlNodeGetLang(reader->node));
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderXmlLang:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
*
|
||||
* The xml:lang scope within which the node resides.
|
||||
*
|
||||
* Returns the xml:lang value or NULL if none exists.
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlTextReaderConstXmlLang(xmlTextReaderPtr reader) {
|
||||
xmlChar *tmp;
|
||||
const xmlChar *ret;
|
||||
|
||||
if (reader == NULL)
|
||||
return(NULL);
|
||||
if (reader->node == NULL)
|
||||
return(NULL);
|
||||
tmp = xmlNodeGetLang(reader->node);
|
||||
if (tmp == NULL)
|
||||
return(NULL);
|
||||
ret = CONSTSTR(tmp);
|
||||
xmlFree(tmp);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderNormalization:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
|
Loading…
Reference in New Issue
Block a user