diff --git a/ChangeLog b/ChangeLog index 543f0f8b..1340fa87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Nov 27 16:24:52 CET 2008 Daniel Veillard + + * include/libxml/tree.h tree.c python/generator.py: adds + element traversal support + * valid.c: avoid a warning + * doc/*: regenerated + Mon Nov 17 16:56:18 CET 2008 Daniel Veillard * SAX2.c parser.c: fix for CVE-2008-4226, a memory overflow diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html index 7062e5e8..ad39b56b 100644 --- a/doc/APIchunk11.html +++ b/doc/APIchunk11.html @@ -37,10 +37,15 @@ A:link, A:visited, A:active { text-decoration: underline } w-w x-x y-z -

Letter b:

back
xmlEntityReferenceFunc
+

Letter b:

back
xmlChildElementCount
+xmlEntityReferenceFunc
+xmlFirstElementChild
xmlKeepBlanksDefault
+xmlLastElementChild
xmlNanoFTPGet
xmlNanoFTPList
+xmlNextElementSibling
+xmlPreviousElementSibling
xmlRelaxNGDump
xmlSetEntityReferenceFunc
badly
xmlParseExternalID
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index ff1be472..41acac9d 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -302,7 +302,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextWriterEndDocument
closes
xmlNanoHTTPClose
xmlNanoHTTPSave
-
closest
xmlXPathCeilingFunction
+
closest
xmlNextElementSibling
+xmlPreviousElementSibling
+xmlXPathCeilingFunction
xmlXPathFloorFunction
xmlXPathRoundFunction
closing
htmlInitAutoClose
@@ -793,6 +795,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidateDtd
count
_xmlEntity
ftpListCallback
+xmlChildElementCount
xmlExpRef
xmlLsCountNode
xmlSaveDoc
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index 2e8417fe..a66dbb22 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -408,7 +408,12 @@ A:link, A:visited, A:active { text-decoration: underline } xmlACatalogAdd
xmlBuildQName
xmlCatalogAdd
+xmlChildElementCount
+xmlFirstElementChild
+xmlLastElementChild
+xmlNextElementSibling
xmlNodeGetBase
+xmlPreviousElementSibling
xmlStrEqual
xmlStrQEqual
differentiate
xmlXPathOrderDocElems
@@ -538,11 +543,16 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRegExecCallbacks
don
XML_SCHEMAS_ANY_LAX
xlinkIsLink
+xmlChildElementCount
xmlCreatePushParserCtxt
xmlDOMWrapCloneNode
+xmlFirstElementChild
+xmlLastElementChild
xmlNewDocNode
xmlNewDocNodeEatName
+xmlNextElementSibling
xmlParseStartTag
+xmlPreviousElementSibling
xmlRegExecErrInfo
xmlRegExecNextValues
xmlSearchNs
diff --git a/doc/APIchunk16.html b/doc/APIchunk16.html index 788a439f..b8e3fed6 100644 --- a/doc/APIchunk16.html +++ b/doc/APIchunk16.html @@ -201,15 +201,20 @@ A:link, A:visited, A:active { text-decoration: underline } attribute
attributeSAXFunc
htmlHandleOmittedElem
+xmlChildElementCount
+xmlFirstElementChild
xmlHandleEntity
+xmlLastElementChild
xmlNamespaceParseNCName
xmlNamespaceParseNSDef
xmlNamespaceParseQName
+xmlNextElementSibling
xmlNodeListGetRawString
xmlOutputBufferCreateFilenameDefault
xmlParserHandlePEReference
xmlParserHandleReference
xmlParserInputBufferCreateFilenameDefault
+xmlPreviousElementSibling
xmlRegNewExecCtxt
xmlRegisterInputCallbacks
xmlRegisterOutputCallbacks
diff --git a/doc/APIchunk2.html b/doc/APIchunk2.html index 19238899..aeb315a8 100644 --- a/doc/APIchunk2.html +++ b/doc/APIchunk2.html @@ -62,34 +62,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlIsPubidChar
xmlNewGlobalNs
DOCTYPE
xmlParseDocTypeDecl
-
DOM
LIBXML_TREE_ENABLED
-_xmlParserCtxt
-attribute
-attributeSAXFunc
-docbSAXParseDoc
-docbSAXParseFile
-htmlSAXParseDoc
-htmlSAXParseFile
-ignorableWhitespace
-ignorableWhitespaceSAXFunc
-resolveEntity
-resolveEntitySAXFunc
-xmlDOMWrapAcquireNsFunction
-xmlDOMWrapReconcileNamespaces
-xmlDOMWrapRemoveNode
-xmlDocDumpFormatMemoryEnc
-xmlDocDumpMemoryEnc
-xmlKeepBlanksDefault
-xmlSAX2IgnorableWhitespace
-xmlSAX2ResolveEntity
-xmlSAXParseDoc
-xmlSAXParseEntity
-xmlSAXParseFile
-xmlSAXParseFileWithData
-xmlSAXParseMemory
-xmlSAXParseMemoryWithData
-xmlXPathNodeSetGetLength
-xmlXPathNodeSetItem
DOM-wrapper
xmlDOMWrapFreeCtxt
xmlDOMWrapNewCtxt
DTDs
XML_COMPLETE_ATTRS
@@ -260,6 +232,8 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlElement
_xmlElementContent
htmlNodeStatus
+xmlFirstElementChild
+xmlLastElementChild
xmlParseAttributeType
xmlParseDocTypeDecl
xmlParseElement
diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html index c84804cc..6e3c9c4d 100644 --- a/doc/APIchunk22.html +++ b/doc/APIchunk22.html @@ -344,6 +344,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlKeepBlanksDefault
xmlLineNumbersDefault
xmlPedanticParserDefault
+xmlPreviousElementSibling
xmlPushInput
xmlSAXDefaultVersion
xmlSubstituteEntitiesDefault
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index 83f51111..845f9192 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -315,6 +315,8 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlNode
xmlAddNextSibling
xmlAddPrevSibling
+xmlNextElementSibling
+xmlPreviousElementSibling
xmlSchemaValueAppend
xmlSchemaValueGetNext
xmlXPathNextPrecedingSibling
@@ -364,10 +366,15 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSetStructuredErrorFunc
since
XML_SCHEMAS_TYPE_VARIETY_ABSENT
xmlBuildRelativeURI
+xmlChildElementCount
xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
xmlDOMWrapReconcileNamespaces
+xmlFirstElementChild
+xmlLastElementChild
+xmlNextElementSibling
xmlParseExternalID
+xmlPreviousElementSibling
xmlRelaxNGNewDocParserCtxt
single
IS_DIGIT_CH
xmlCurrentChar
@@ -486,7 +493,12 @@ A:link, A:visited, A:active { text-decoration: underline }
span
xmlCurrentChar
xmlStringCurrentChar
spec
xmlCatalogSetDefaultPrefer
+xmlChildElementCount
+xmlFirstElementChild
+xmlLastElementChild
+xmlNextElementSibling
xmlParseComment
+xmlPreviousElementSibling
spec:
IS_BASECHAR
IS_BLANK
IS_BYTE_CHAR
diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html index 2dce6a0c..6b0749db 100644 --- a/doc/APIchunk25.html +++ b/doc/APIchunk25.html @@ -109,25 +109,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStreamWantsAnyNode
text-node
xmlIsBlankNode
textDecl?
xmlParseExternalSubset
-
than
xmlCheckUTF8
-xmlExpExpDerive
-xmlExpGetLanguage
-xmlExpGetStart
-xmlNewNs
-xmlParseAttribute
-xmlParseAttributeType
-xmlParseElementDecl
-xmlParseElementMixedContentDecl
-xmlParseSDDecl
-xmlParseStartTag
-xmlSetGenericErrorFunc
-xmlStrEqual
-xmlTextReaderIsNamespaceDecl
-xmlXPathCeilingFunction
-xmlXPathCompareValues
-xmlXPathFloorFunction
-xmlXPathSubstringFunction
-xmlXPathTranslateFunction
their
xmlCharEncOutFunc
xmlEncodeEntities
xmlEncodeEntitiesReentrant
@@ -316,7 +297,12 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserValidityWarning
xmlParserWarning
transport
xmlNanoFTPClose
-
traversal
xmlXPathAxisFunc
+
traversal
xmlChildElementCount
+xmlFirstElementChild
+xmlLastElementChild
+xmlNextElementSibling
+xmlPreviousElementSibling
+xmlXPathAxisFunc
xmlXPathNextAncestor
xmlXPathNextAncestorOrSelf
xmlXPathNextAttribute
diff --git a/doc/APIchunk3.html b/doc/APIchunk3.html index 3f5646a3..958aefef 100644 --- a/doc/APIchunk3.html +++ b/doc/APIchunk3.html @@ -72,7 +72,12 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHashRemoveEntry3
xmlParserFindNodeInfo
xmlParserFindNodeInfoIndex
-
Finds
xmlExpIsNillable
+
Finds
xmlChildElementCount
+xmlExpIsNillable
+xmlFirstElementChild
+xmlLastElementChild
+xmlNextElementSibling
+xmlPreviousElementSibling
First
XML_SCHEMAS_TYPE_FIXUP_1
_xmlEntity
Fixed
xmlParseDefaultDecl
diff --git a/doc/APIchunk9.html b/doc/APIchunk9.html index fb32180c..ca0b6eb1 100644 --- a/doc/APIchunk9.html +++ b/doc/APIchunk9.html @@ -71,7 +71,12 @@ A:link, A:visited, A:active { text-decoration: underline }
VersionInfo?
xmlParseTextDecl
VersionNum
xmlParseVersionInfo
xmlParseVersionNum
-

Letter W:

W3C
xmlTextReaderSchemaValidate
+

Letter W:

W3C
xmlChildElementCount
+xmlFirstElementChild
+xmlLastElementChild
+xmlNextElementSibling
+xmlPreviousElementSibling
+xmlTextReaderSchemaValidate
xmlTextReaderSchemaValidateCtxt
WARNING:
xmlSchemaGetCanonValue
xmlSchemaNewStringValue
diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html index 300fc038..bebc3e1f 100644 --- a/doc/APIconstructors.html +++ b/doc/APIconstructors.html @@ -89,7 +89,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveTree
xmlTextReaderByteConsumed
xmlXPathOrderDocElems
-

Type unsigned long:

xmlParserFindNodeInfoIndex
+

Type unsigned long:

xmlChildElementCount
+xmlParserFindNodeInfoIndex
xmlSchemaGetFacetValueAsULong

Type void *:

xmlCatalogAddLocal
xmlFileOpen
@@ -363,7 +364,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDocCopyNodeList
xmlDocGetRootElement
xmlDocSetRootElement
+xmlFirstElementChild
xmlGetLastChild
+xmlLastElementChild
xmlNewCDataBlock
xmlNewCharRef
xmlNewChild
@@ -383,6 +386,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewText
xmlNewTextChild
xmlNewTextLen
+xmlNextElementSibling
+xmlPreviousElementSibling
xmlReplaceNode
xmlStringGetNodeList
xmlStringLenGetNodeList
diff --git a/doc/APIfiles.html b/doc/APIfiles.html index f4ef0e56..0c9934d3 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -1382,6 +1382,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlBufferWriteChar
xmlBufferWriteQuotedString
xmlBuildQName
+xmlChildElementCount
xmlChildrenNode
xmlCopyDoc
xmlCopyDtd
@@ -1429,6 +1430,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlEntityPtr
xmlEnumeration
xmlEnumerationPtr
+xmlFirstElementChild
xmlFreeDoc
xmlFreeDtd
xmlFreeNode
@@ -1454,6 +1456,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlIDPtr
xmlIsBlankNode
xmlIsXHTML
+xmlLastElementChild
xmlNewCDataBlock
xmlNewCharRef
xmlNewChild
@@ -1481,6 +1484,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewText
xmlNewTextChild
xmlNewTextLen
+xmlNextElementSibling
xmlNode
xmlNodeAddContent
xmlNodeAddContentLen
@@ -1514,6 +1518,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserInputBuffer
xmlParserInputBufferPtr
xmlParserInputPtr
+xmlPreviousElementSibling
xmlReconciliateNs
xmlRef
xmlRefPtr
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index 3cf9ced2..6cf73df5 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -1437,6 +1437,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAddPrevSibling
xmlAddSibling
xmlC14NIsVisibleCallback
+xmlChildElementCount
xmlCopyProp
xmlCopyPropList
xmlDOMWrapAcquireNsFunction
@@ -1451,6 +1452,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDocSetRootElement
xmlElemDump
xmlEntityReferenceFunc
+xmlFirstElementChild
xmlFreeNode
xmlFreeNodeList
xmlGetLastChild
@@ -1465,6 +1467,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlIsBlankNode
xmlIsID
xmlIsRef
+xmlLastElementChild
xmlLsCountNode
xmlLsOneNode
xmlNewChild
@@ -1474,6 +1477,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewProp
xmlNewTextChild
xmlNewTextWriterTree
+xmlNextElementSibling
xmlNodeAddContent
xmlNodeAddContentLen
xmlNodeBufGetContent
@@ -1494,6 +1498,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNodeSetSpacePreserve
xmlParseInNodeContext
xmlPatternMatch
+xmlPreviousElementSibling
xmlReconciliateNs
xmlRegisterNodeFunc
xmlRelaxNGValidateFullElement
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 9a1cf8ec..32bfe394 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -1820,6 +1820,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCheckLanguageID
xmlCheckUTF8
xmlCheckVersion
+xmlChildElementCount
xmlChildrenNode
xmlCleanupCharEncodingHandlers
xmlCleanupEncodingAliases
@@ -1998,6 +1999,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlFileOpen
xmlFileRead
xmlFindCharEncodingHandler
+xmlFirstElementChild
xmlFree
xmlFreeAttributeTable
xmlFreeAutomata
@@ -2172,6 +2174,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlIsXHTML
xmlKeepBlanksDefault
xmlKeepBlanksDefaultValue
+xmlLastElementChild
xmlLastError
xmlLineNumbersDefault
xmlLineNumbersDefaultValue
@@ -2342,6 +2345,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewTextWriterTree
xmlNewValidCtxt
xmlNextChar
+xmlNextElementSibling
xmlNoNetExternalEntityLoader
xmlNode
xmlNodeAddContent
@@ -2519,6 +2523,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlPedanticParserDefaultValue
xmlPopInput
xmlPopInputCallbacks
+xmlPreviousElementSibling
xmlPrintURI
xmlPushInput
xmlRMutex
diff --git a/doc/devhelp/libxml2-tree.html b/doc/devhelp/libxml2-tree.html index 188d43bd..6e709900 100644 --- a/doc/devhelp/libxml2-tree.html +++ b/doc/devhelp/libxml2-tree.html @@ -125,11 +125,12 @@ int xmlValidateQName (const 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); -int xmlUnsetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar * name); +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 (xmlDocPtr doc); int xmlNodeBufGetContent (xmlBufferPtr buffer,
xmlNodePtr 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); @@ -159,6 +160,8 @@ int xmlDOMWrapAdoptNode (xmlChar * xmlGetNodePath (xmlNodePtr 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 (xmlNodePtr node); xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
const xmlChar * href,
const xmlChar * prefix); @@ -179,6 +182,7 @@ void xmlFreeProp (xmlTextConcat (xmlNodePtr node,
const xmlChar * content,
int len); int xmlNodeGetSpacePreserve (xmlNodePtr 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); @@ -193,6 +197,7 @@ typedef xmlNsPtr xmlGetLineNo (xmlNodePtr node); const xmlChar * xmlBufferContent (const xmlBufferPtr buf); int xmlRemoveProp (xmlAttrPtr cur); +xmlNodePtr xmlLastElementChild (xmlNodePtr parent); xmlChar * xmlNodeGetLang (xmlNodePtr cur); int xmlGetDocCompressMode (xmlDocPtr doc); xmlChar * xmlGetNsProp (xmlNodePtr node,
const xmlChar * name,
const xmlChar * nameSpace); @@ -1002,6 +1007,10 @@ void xmlFreeNsList (

xmlBuildQName ()

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
+
+

xmlChildElementCount ()

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

xmlCopyDoc ()

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.

@@ -1106,6 +1115,10 @@ void xmlFreeNsList (

xmlElemDump ()

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
+
+

xmlFirstElementChild ()

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

xmlFreeDoc ()

void	xmlFreeDoc			(xmlDocPtr cur)

Free up all the structures used by a document, tree included.

@@ -1198,6 +1211,10 @@ void xmlFreeNsList (

xmlIsXHTML ()

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
+
+

xmlLastElementChild ()

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

xmlNewCDataBlock ()

xmlNodePtr	xmlNewCDataBlock	(xmlDocPtr doc, 
const xmlChar * content,
int len)

Creation of a new node containing a CDATA block.

@@ -1306,6 +1323,10 @@ void xmlFreeNsList (

xmlNewTextLen ()

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.
+
+

xmlNextElementSibling ()

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

xmlNodeAddContent ()

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.

@@ -1378,6 +1399,10 @@ void xmlFreeNsList (

xmlNodeSetSpacePreserve ()

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")
+
+

xmlPreviousElementSibling ()

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

xmlReconciliateNs ()

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.

diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp index 31a5d916..65bcbdaa 100644 --- a/doc/devhelp/libxml2.devhelp +++ b/doc/devhelp/libxml2.devhelp @@ -2134,6 +2134,7 @@ + @@ -2266,6 +2267,7 @@ + @@ -2395,6 +2397,7 @@ + @@ -2544,6 +2547,7 @@ + @@ -2676,6 +2680,7 @@ + diff --git a/doc/html/libxml-tree.html b/doc/html/libxml-tree.html index ab575669..87c415ca 100644 --- a/doc/html/libxml-tree.html +++ b/doc/html/libxml-tree.html @@ -87,6 +87,7 @@ A:link, A:visited, A:active { text-decoration: underline }
void	xmlBufferWriteChar		(xmlBufferPtr buf, 
const char * string)
void	xmlBufferWriteQuotedString	(xmlBufferPtr buf, 
const xmlChar * string)
xmlChar *	xmlBuildQName		(const xmlChar * ncname, 
const xmlChar * prefix,
xmlChar * memory,
int len)
+
unsigned long	xmlChildElementCount	(xmlNodePtr parent)
xmlDocPtr	xmlCopyDoc		(xmlDocPtr doc, 
int recursive)
xmlDtdPtr	xmlCopyDtd		(xmlDtdPtr dtd)
xmlNsPtr	xmlCopyNamespace	(xmlNsPtr cur)
@@ -116,6 +117,7 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlNodePtr	xmlDocGetRootElement	(xmlDocPtr doc)
xmlNodePtr	xmlDocSetRootElement	(xmlDocPtr doc, 
xmlNodePtr root)
void	xmlElemDump			(FILE * f, 
xmlDocPtr doc,
xmlNodePtr cur)
+
xmlNodePtr	xmlFirstElementChild	(xmlNodePtr parent)
void	xmlFreeDoc			(xmlDocPtr cur)
void	xmlFreeDtd			(xmlDtdPtr cur)
void	xmlFreeNode			(xmlNodePtr cur)
@@ -139,6 +141,7 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlAttrPtr	xmlHasProp		(xmlNodePtr node, 
const xmlChar * name)
int	xmlIsBlankNode			(xmlNodePtr node)
int	xmlIsXHTML			(const xmlChar * systemID, 
const xmlChar * publicID)
+
xmlNodePtr	xmlLastElementChild	(xmlNodePtr parent)
xmlNodePtr	xmlNewCDataBlock	(xmlDocPtr doc, 
const xmlChar * content,
int len)
xmlNodePtr	xmlNewCharRef		(xmlDocPtr doc, 
const xmlChar * name)
xmlNodePtr	xmlNewChild		(xmlNodePtr parent, 
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content)
@@ -166,6 +169,7 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlNodePtr	xmlNewText		(const xmlChar * content)
xmlNodePtr	xmlNewTextChild		(xmlNodePtr parent, 
xmlNsPtr ns,
const xmlChar * name,
const xmlChar * content)
xmlNodePtr	xmlNewTextLen		(const xmlChar * content, 
int len)
+
xmlNodePtr	xmlNextElementSibling	(xmlNodePtr node)
void	xmlNodeAddContent		(xmlNodePtr cur, 
const xmlChar * content)
void	xmlNodeAddContentLen		(xmlNodePtr cur, 
const xmlChar * content,
int len)
int	xmlNodeBufGetContent		(xmlBufferPtr buffer, 
xmlNodePtr cur)
@@ -184,6 +188,7 @@ A:link, A:visited, A:active { text-decoration: underline }
void	xmlNodeSetLang			(xmlNodePtr cur, 
const xmlChar * lang)
void	xmlNodeSetName			(xmlNodePtr cur, 
const xmlChar * name)
void	xmlNodeSetSpacePreserve		(xmlNodePtr cur, 
int val)
+
xmlNodePtr	xmlPreviousElementSibling	(xmlNodePtr node)
int	xmlReconciliateNs		(xmlDocPtr doc, 
xmlNodePtr tree)
int	xmlRemoveProp			(xmlAttrPtr cur)
xmlNodePtr	xmlReplaceNode		(xmlNodePtr old, 
xmlNodePtr cur)
@@ -681,7 +686,9 @@ A:link, A:visited, A:active { text-decoration: underline }

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

Function: xmlBuildQName

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

Function: xmlCopyDoc

xmlDocPtr	xmlCopyDoc		(xmlDocPtr doc, 
int recursive)
+
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

Function: xmlChildElementCount

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

Function: xmlCopyDoc

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.

Function: xmlCopyDtd

xmlDtdPtr	xmlCopyDtd		(xmlDtdPtr dtd)

Do a copy of the dtd.

@@ -736,7 +743,9 @@ A:link, A:visited, A:active { text-decoration: underline }

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

Function: xmlElemDump

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

Function: xmlFreeDoc

void	xmlFreeDoc			(xmlDocPtr cur)
+
f:the FILE * for the output
doc:the document
cur:the current node

Function: xmlFirstElementChild

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

Function: xmlFreeDoc

void	xmlFreeDoc			(xmlDocPtr cur)

Free up all the structures used by a document, tree included.

cur:pointer to the document

Function: xmlFreeDtd

void	xmlFreeDtd			(xmlDtdPtr cur)

Free a DTD structure.

@@ -782,7 +791,9 @@ A:link, A:visited, A:active { text-decoration: underline }

Checks whether this node is an empty or whitespace only (and possibly ignorable) text-node.

node:the node
Returns:1 yes, 0 no

Function: xmlIsXHTML

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

Function: xmlNewCDataBlock

xmlNodePtr	xmlNewCDataBlock	(xmlDocPtr doc, 
const xmlChar * content,
int len)
+
systemID:the system identifier
publicID:the public identifier
Returns:1 if true, 0 if not and -1 in case of error

Function: xmlLastElementChild

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

Function: xmlNewCDataBlock

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.

Function: xmlNewCharRef

xmlNodePtr	xmlNewCharRef		(xmlDocPtr doc, 
const xmlChar * name)

Creation of a new character reference node.

@@ -836,7 +847,9 @@ A:link, A:visited, A:active { text-decoration: underline }

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.

Function: xmlNewTextLen

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.

Function: xmlNodeAddContent

void	xmlNodeAddContent		(xmlNodePtr cur, 
const xmlChar * content)
+
content:the text content
len:the text len.
Returns:a pointer to the new node object.

Function: xmlNextElementSibling

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

Function: xmlNodeAddContent

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

Function: xmlNodeAddContentLen

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.

@@ -872,7 +885,9 @@ A:link, A:visited, A:active { text-decoration: underline }

Set (or reset) the name of a node.

cur:the node being changed
name:the new tag name

Function: xmlNodeSetSpacePreserve

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")

Function: xmlReconciliateNs

int	xmlReconciliateNs		(xmlDocPtr doc, 
xmlNodePtr tree)
+
cur:the node being changed
val:the xml:space value ("0": default, 1: "preserve")

Function: xmlPreviousElementSibling

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

Function: xmlReconciliateNs

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.

Function: xmlRemoveProp

int	xmlRemoveProp			(xmlAttrPtr cur)

Unlink and free one attribute, all the content is freed too Note this doesn't work for namespace definition attributes

diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index b396c3e4..a688847e 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -1543,11 +1543,12 @@ - + + @@ -1577,6 +1578,8 @@ + + @@ -1597,6 +1600,7 @@ + @@ -1611,6 +1615,7 @@ + @@ -8824,6 +8829,12 @@ Could we use @subtypes for this?'/> + + defined(LIBXML_TREE_ENABLED) + 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. + + + Cleanup the memory allocated for the char encoding support, it unregisters all the encoding handlers and the aliases. @@ -9718,6 +9729,12 @@ Could we use @subtypes for this?'/> + + defined(LIBXML_TREE_ENABLED) + 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. + + + Deallocate the memory used by an entities hash table. @@ -10550,6 +10567,12 @@ Could we use @subtypes for this?'/> + + defined(LIBXML_TREE_ENABLED) + 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. + + + Set and return the previous value for enabling line numbers in elements contents. This may break on old application and is turned off by default. @@ -11515,6 +11538,12 @@ Could we use @subtypes for this?'/> + + defined(LIBXML_TREE_ENABLED) + 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. + + + A specific entity loader disabling network accesses, though still allowing local catalog accesses for resolution. @@ -12375,6 +12404,12 @@ Could we use @subtypes for this?'/> Clear the top input callback from the input stack. this includes the compiled-in I/O. + + defined(LIBXML_TREE_ENABLED) + 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. + + + Prints the URI in the stream @stream. diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml index d5bfd8ef..148f426d 100644 --- a/doc/libxml2-refs.xml +++ b/doc/libxml2-refs.xml @@ -1814,6 +1814,7 @@ + @@ -1992,6 +1993,7 @@ + @@ -2166,6 +2168,7 @@ + @@ -2336,6 +2339,7 @@ + @@ -2513,6 +2517,7 @@ + @@ -5390,6 +5395,7 @@ + @@ -5568,6 +5574,7 @@ + @@ -5742,6 +5749,7 @@ + @@ -5912,6 +5920,7 @@ + @@ -6089,6 +6098,7 @@ + @@ -7200,6 +7210,7 @@ + @@ -7558,7 +7569,9 @@ + + @@ -7578,6 +7591,8 @@ + + @@ -9527,6 +9542,7 @@ + @@ -9541,6 +9557,7 @@ + @@ -9555,6 +9572,7 @@ + @@ -9564,6 +9582,7 @@ + @@ -9584,6 +9603,7 @@ + @@ -11979,6 +11999,7 @@ + @@ -12026,6 +12047,7 @@ + @@ -12051,6 +12073,7 @@ + @@ -12078,6 +12101,7 @@ + @@ -12111,6 +12135,7 @@ + @@ -15075,36 +15100,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -15368,6 +15363,8 @@ + + @@ -15659,7 +15656,12 @@ + + + + + @@ -18130,6 +18132,11 @@ + + + + + @@ -19308,10 +19315,15 @@ + + + + + @@ -20059,6 +20071,8 @@ + + @@ -20776,6 +20790,7 @@ + @@ -21396,7 +21411,12 @@ + + + + + @@ -21594,11 +21614,16 @@ + + + + + @@ -23130,15 +23155,20 @@ + + + + + @@ -26371,6 +26401,7 @@ + @@ -27993,6 +28024,8 @@ + + @@ -28062,10 +28095,15 @@ + + + + + @@ -28232,7 +28270,12 @@ + + + + + @@ -29013,27 +29056,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -29297,6 +29319,11 @@ + + + + + diff --git a/elfgcchack.h b/elfgcchack.h index a747fca3..14cad6da 100644 --- a/elfgcchack.h +++ b/elfgcchack.h @@ -1991,6 +1991,18 @@ extern __typeof (xmlCheckVersion) xmlCheckVersion__internal_alias __attribute((v #endif #endif +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlChildElementCount +extern __typeof (xmlChildElementCount) xmlChildElementCount __attribute((alias("xmlChildElementCount__internal_alias"))); +#else +#ifndef xmlChildElementCount +extern __typeof (xmlChildElementCount) xmlChildElementCount__internal_alias __attribute((visibility("hidden"))); +#define xmlChildElementCount xmlChildElementCount__internal_alias +#endif +#endif +#endif + #ifdef bottom_encoding #undef xmlCleanupCharEncodingHandlers extern __typeof (xmlCleanupCharEncodingHandlers) xmlCleanupCharEncodingHandlers __attribute((alias("xmlCleanupCharEncodingHandlers__internal_alias"))); @@ -3419,6 +3431,18 @@ extern __typeof (xmlFindCharEncodingHandler) xmlFindCharEncodingHandler__interna #endif #endif +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlFirstElementChild +extern __typeof (xmlFirstElementChild) xmlFirstElementChild __attribute((alias("xmlFirstElementChild__internal_alias"))); +#else +#ifndef xmlFirstElementChild +extern __typeof (xmlFirstElementChild) xmlFirstElementChild__internal_alias __attribute((visibility("hidden"))); +#define xmlFirstElementChild xmlFirstElementChild__internal_alias +#endif +#endif +#endif + #ifdef bottom_valid #undef xmlFreeAttributeTable extern __typeof (xmlFreeAttributeTable) xmlFreeAttributeTable __attribute((alias("xmlFreeAttributeTable__internal_alias"))); @@ -4759,6 +4783,18 @@ extern __typeof (xmlKeepBlanksDefault) xmlKeepBlanksDefault__internal_alias __at #endif #endif +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlLastElementChild +extern __typeof (xmlLastElementChild) xmlLastElementChild __attribute((alias("xmlLastElementChild__internal_alias"))); +#else +#ifndef xmlLastElementChild +extern __typeof (xmlLastElementChild) xmlLastElementChild__internal_alias __attribute((visibility("hidden"))); +#define xmlLastElementChild xmlLastElementChild__internal_alias +#endif +#endif +#endif + #ifdef bottom_parserInternals #undef xmlLineNumbersDefault extern __typeof (xmlLineNumbersDefault) xmlLineNumbersDefault __attribute((alias("xmlLineNumbersDefault__internal_alias"))); @@ -5161,6 +5197,16 @@ extern __typeof (xmlMemDisplay) xmlMemDisplay__internal_alias __attribute((visib #endif #endif +#ifdef bottom_xmlmemory +#undef xmlMemDisplayLast +extern __typeof (xmlMemDisplayLast) xmlMemDisplayLast __attribute((alias("xmlMemDisplayLast__internal_alias"))); +#else +#ifndef xmlMemDisplayLast +extern __typeof (xmlMemDisplayLast) xmlMemDisplayLast__internal_alias __attribute((visibility("hidden"))); +#define xmlMemDisplayLast xmlMemDisplayLast__internal_alias +#endif +#endif + #ifdef bottom_xmlmemory #undef xmlMemFree extern __typeof (xmlMemFree) xmlMemFree __attribute((alias("xmlMemFree__internal_alias"))); @@ -6043,6 +6089,16 @@ extern __typeof (xmlNewElementContent) xmlNewElementContent__internal_alias __at #endif #endif +#ifdef bottom_entities +#undef xmlNewEntity +extern __typeof (xmlNewEntity) xmlNewEntity __attribute((alias("xmlNewEntity__internal_alias"))); +#else +#ifndef xmlNewEntity +extern __typeof (xmlNewEntity) xmlNewEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlNewEntity xmlNewEntity__internal_alias +#endif +#endif + #ifdef bottom_parserInternals #undef xmlNewEntityInputStream extern __typeof (xmlNewEntityInputStream) xmlNewEntityInputStream __attribute((alias("xmlNewEntityInputStream__internal_alias"))); @@ -6367,6 +6423,18 @@ extern __typeof (xmlNextChar) xmlNextChar__internal_alias __attribute((visibilit #endif #endif +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNextElementSibling +extern __typeof (xmlNextElementSibling) xmlNextElementSibling __attribute((alias("xmlNextElementSibling__internal_alias"))); +#else +#ifndef xmlNextElementSibling +extern __typeof (xmlNextElementSibling) xmlNextElementSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlNextElementSibling xmlNextElementSibling__internal_alias +#endif +#endif +#endif + #ifdef bottom_xmlIO #undef xmlNoNetExternalEntityLoader extern __typeof (xmlNoNetExternalEntityLoader) xmlNoNetExternalEntityLoader __attribute((alias("xmlNoNetExternalEntityLoader__internal_alias"))); @@ -7769,6 +7837,18 @@ extern __typeof (xmlPopInputCallbacks) xmlPopInputCallbacks__internal_alias __at #endif #endif +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlPreviousElementSibling +extern __typeof (xmlPreviousElementSibling) xmlPreviousElementSibling __attribute((alias("xmlPreviousElementSibling__internal_alias"))); +#else +#ifndef xmlPreviousElementSibling +extern __typeof (xmlPreviousElementSibling) xmlPreviousElementSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlPreviousElementSibling xmlPreviousElementSibling__internal_alias +#endif +#endif +#endif + #ifdef bottom_uri #undef xmlPrintURI extern __typeof (xmlPrintURI) xmlPrintURI __attribute((alias("xmlPrintURI__internal_alias"))); diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 6a6a09d9..b733589b 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -1225,6 +1225,22 @@ XMLPUBFUN int XMLCALL int deep, int options); +#ifdef LIBXML_TREE_ENABLED +/* + * 5 interfaces from DOM ElementTraversal, but different in entities + * traversal. + */ +XMLPUBFUN unsigned long XMLCALL + xmlChildElementCount (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNextElementSibling (xmlNodePtr node); +XMLPUBFUN xmlNodePtr XMLCALL + xmlFirstElementChild (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlLastElementChild (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlPreviousElementSibling (xmlNodePtr node); +#endif #ifdef __cplusplus } #endif diff --git a/python/generator.py b/python/generator.py index 4e228153..92a3440a 100755 --- a/python/generator.py +++ b/python/generator.py @@ -725,6 +725,10 @@ functions_noexcept = { "xmlDocSetRootElement": 1, "xmlNodeGetNs": 1, "xmlNodeGetNsDefs": 1, + "xmlNextElementSibling": 1, + "xmlPreviousElementSibling": 1, + "xmlFirstElementChild": 1, + "xmlLastElementChild": 1, } reference_keepers = { diff --git a/python/libxml2class.txt b/python/libxml2class.txt index 68a2de13..1b8db595 100644 --- a/python/libxml2class.txt +++ b/python/libxml2class.txt @@ -457,6 +457,7 @@ Class xmlNode(xmlCore) docCopyNode() docCopyNodeList() docSetRootElement() + firstElementChild() freeNode() freeNodeList() getBase() @@ -468,6 +469,7 @@ Class xmlNode(xmlCore) isBlankNode() isText() lastChild() + lastElementChild() lineNo() listGetRawString() listGetString() @@ -477,9 +479,11 @@ Class xmlNode(xmlCore) newNsPropEatName() newProp() newTextChild() + nextElementSibling() noNsProp() nodePath() nsProp() + previousElementSibling() prop() reconciliateNs() replaceNode() diff --git a/testapi.c b/testapi.c index 6f85910d..37511d6b 100644 --- a/testapi.c +++ b/testapi.c @@ -19056,6 +19056,40 @@ test_xmlBuildQName(void) { } +static int +test_xmlChildElementCount(void) { + int test_ret = 0; + +#if defined(LIBXML_TREE_ENABLED) + int mem_base; + unsigned long ret_val; + xmlNodePtr parent; /* the parent node */ + int n_parent; + + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { + mem_base = xmlMemBlocks(); + parent = gen_xmlNodePtr(n_parent, 0); + + ret_val = xmlChildElementCount(parent); + desret_unsigned_long(ret_val); + call_tests++; + des_xmlNodePtr(n_parent, parent, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlChildElementCount", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_xmlCopyDoc(void) { int test_ret = 0; @@ -20170,6 +20204,40 @@ test_xmlElemDump(void) { } +static int +test_xmlFirstElementChild(void) { + int test_ret = 0; + +#if defined(LIBXML_TREE_ENABLED) + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr parent; /* the parent node */ + int n_parent; + + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { + mem_base = xmlMemBlocks(); + parent = gen_xmlNodePtr(n_parent, 0); + + ret_val = xmlFirstElementChild(parent); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_parent, parent, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlFirstElementChild", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_xmlGetBufferAllocationScheme(void) { int test_ret = 0; @@ -20672,6 +20740,40 @@ test_xmlIsXHTML(void) { } +static int +test_xmlLastElementChild(void) { + int test_ret = 0; + +#if defined(LIBXML_TREE_ENABLED) + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr parent; /* the parent node */ + int n_parent; + + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { + mem_base = xmlMemBlocks(); + parent = gen_xmlNodePtr(n_parent, 0); + + ret_val = xmlLastElementChild(parent); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_parent, parent, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlLastElementChild", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_xmlNewCDataBlock(void) { int test_ret = 0; @@ -21831,6 +21933,40 @@ test_xmlNewTextLen(void) { } +static int +test_xmlNextElementSibling(void) { + int test_ret = 0; + +#if defined(LIBXML_TREE_ENABLED) + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr node; /* the current node */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlNextElementSibling(node); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNextElementSibling", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_xmlNodeAddContent(void) { int test_ret = 0; @@ -22580,6 +22716,40 @@ test_xmlNodeSetSpacePreserve(void) { } +static int +test_xmlPreviousElementSibling(void) { + int test_ret = 0; + +#if defined(LIBXML_TREE_ENABLED) + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr node; /* the current node */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlPreviousElementSibling(node); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlPreviousElementSibling", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_xmlReconciliateNs(void) { int test_ret = 0; @@ -23845,7 +24015,7 @@ static int test_tree(void) { int test_ret = 0; - if (quiet == 0) printf("Testing tree : 133 of 152 functions ...\n"); + if (quiet == 0) printf("Testing tree : 138 of 157 functions ...\n"); test_ret += test_xmlAddChild(); test_ret += test_xmlAddChildList(); test_ret += test_xmlAddNextSibling(); @@ -23870,6 +24040,7 @@ test_tree(void) { test_ret += test_xmlBufferWriteChar(); test_ret += test_xmlBufferWriteQuotedString(); test_ret += test_xmlBuildQName(); + test_ret += test_xmlChildElementCount(); test_ret += test_xmlCopyDoc(); test_ret += test_xmlCopyDtd(); test_ret += test_xmlCopyNamespace(); @@ -23895,6 +24066,7 @@ test_tree(void) { test_ret += test_xmlDocGetRootElement(); test_ret += test_xmlDocSetRootElement(); test_ret += test_xmlElemDump(); + test_ret += test_xmlFirstElementChild(); test_ret += test_xmlGetBufferAllocationScheme(); test_ret += test_xmlGetCompressMode(); test_ret += test_xmlGetDocCompressMode(); @@ -23910,6 +24082,7 @@ test_tree(void) { test_ret += test_xmlHasProp(); test_ret += test_xmlIsBlankNode(); test_ret += test_xmlIsXHTML(); + test_ret += test_xmlLastElementChild(); test_ret += test_xmlNewCDataBlock(); test_ret += test_xmlNewCharRef(); test_ret += test_xmlNewChild(); @@ -23936,6 +24109,7 @@ test_tree(void) { test_ret += test_xmlNewText(); test_ret += test_xmlNewTextChild(); test_ret += test_xmlNewTextLen(); + test_ret += test_xmlNextElementSibling(); test_ret += test_xmlNodeAddContent(); test_ret += test_xmlNodeAddContentLen(); test_ret += test_xmlNodeBufGetContent(); @@ -23954,6 +24128,7 @@ test_tree(void) { test_ret += test_xmlNodeSetLang(); test_ret += test_xmlNodeSetName(); test_ret += test_xmlNodeSetSpacePreserve(); + test_ret += test_xmlPreviousElementSibling(); test_ret += test_xmlReconciliateNs(); test_ret += test_xmlRemoveProp(); test_ret += test_xmlReplaceNode(); diff --git a/tree.c b/tree.c index 5894da62..fe89dc48 100644 --- a/tree.c +++ b/tree.c @@ -3367,6 +3367,199 @@ xmlGetLastChild(xmlNodePtr parent) { return(parent->last); } +#ifdef LIBXML_TREE_ENABLED +/* + * 5 interfaces from DOM ElementTraversal + */ + +/** + * xmlChildElementCount: + * @parent: the parent node + * + * 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. + * + * Returns the count of element child or 0 if not available + */ +unsigned long +xmlChildElementCount(xmlNodePtr parent) { + unsigned long ret = 0; + xmlNodePtr cur = NULL; + + if (parent == NULL) + return(0); + switch (parent->type) { + case XML_ELEMENT_NODE: + case XML_ENTITY_NODE: + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + cur = parent->children; + break; + default: + return(0); + } + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) + ret++; + cur = cur->next; + } + return(ret); +} + +/** + * xmlFirstElementChild: + * @parent: the parent node + * + * 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. + * + * Returns the first element child or NULL if not available + */ +xmlNodePtr +xmlFirstElementChild(xmlNodePtr parent) { + xmlNodePtr cur = NULL; + + if (parent == NULL) + return(NULL); + switch (parent->type) { + case XML_ELEMENT_NODE: + case XML_ENTITY_NODE: + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + cur = parent->children; + break; + default: + return(NULL); + } + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) + return(cur); + cur = cur->next; + } + return(NULL); +} + +/** + * xmlLastElementChild: + * @parent: the parent node + * + * 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. + * + * Returns the last element child or NULL if not available + */ +xmlNodePtr +xmlLastElementChild(xmlNodePtr parent) { + xmlNodePtr cur = NULL; + + if (parent == NULL) + return(NULL); + switch (parent->type) { + case XML_ELEMENT_NODE: + case XML_ENTITY_NODE: + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + cur = parent->last; + break; + default: + return(NULL); + } + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) + return(cur); + cur = cur->prev; + } + return(NULL); +} + +/** + * xmlPreviousElementSibling: + * @node: the current 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. + * + * Returns the previous element sibling or NULL if not available + */ +xmlNodePtr +xmlPreviousElementSibling(xmlNodePtr node) { + if (node == NULL) + return(NULL); + switch (node->type) { + case XML_ELEMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_ENTITY_REF_NODE: + case XML_ENTITY_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + case XML_XINCLUDE_START: + case XML_XINCLUDE_END: + node = node->prev; + break; + default: + return(NULL); + } + while (node != NULL) { + if (node->type == XML_ELEMENT_NODE) + return(node); + node = node->next; + } + return(NULL); +} + +/** + * xmlNextElementSibling: + * @node: the current 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. + * + * Returns the next element sibling or NULL if not available + */ +xmlNodePtr +xmlNextElementSibling(xmlNodePtr node) { + if (node == NULL) + return(NULL); + switch (node->type) { + case XML_ELEMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_ENTITY_REF_NODE: + case XML_ENTITY_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + case XML_DTD_NODE: + case XML_XINCLUDE_START: + case XML_XINCLUDE_END: + node = node->next; + break; + default: + return(NULL); + } + while (node != NULL) { + if (node->type == XML_ELEMENT_NODE) + return(node); + node = node->next; + } + return(NULL); +} + +#endif /* LIBXML_TREE_ENABLED */ + /** * xmlFreeNodeList: * @cur: the first node in the list diff --git a/valid.c b/valid.c index 49fb720c..9baba3ba 100644 --- a/valid.c +++ b/valid.c @@ -3792,27 +3792,13 @@ xmlValidateNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc ATT } /** - * xmlValidateAttributeValue: + * xmlValidateAttributeValueInternal: + * @doc: the document * @type: an attribute type * @value: an attribute value * * Validate that the given attribute value match the proper production * - * [ VC: ID ] - * Values of type ID must match the Name production.... - * - * [ VC: IDREF ] - * Values of type IDREF must match the Name production, and values - * of type IDREFS must match Names ... - * - * [ VC: Entity Name ] - * Values of type ENTITY must match the Name production, values - * of type ENTITIES must match Names ... - * - * [ VC: Name Token ] - * Values of type NMTOKEN must match the Nmtoken production; values - * of type NMTOKENS must match Nmtokens. - * * returns 1 if valid or 0 otherwise */ @@ -3839,6 +3825,30 @@ xmlValidateAttributeValueInternal(xmlDocPtr doc, xmlAttributeType type, return(1); } +/** + * xmlValidateAttributeValue: + * @type: an attribute type + * @value: an attribute value + * + * Validate that the given attribute value match the proper production + * + * [ VC: ID ] + * Values of type ID must match the Name production.... + * + * [ VC: IDREF ] + * Values of type IDREF must match the Name production, and values + * of type IDREFS must match Names ... + * + * [ VC: Entity Name ] + * Values of type ENTITY must match the Name production, values + * of type ENTITIES must match Names ... + * + * [ VC: Name Token ] + * Values of type NMTOKEN must match the Nmtoken production; values + * of type NMTOKENS must match Nmtokens. + * + * returns 1 if valid or 0 otherwise + */ int xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value) { return(xmlValidateAttributeValueInternal(NULL, type, value)); diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src index f4c2c63f..995b790f 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -660,6 +660,7 @@ xmlCheckHTTPInput xmlCheckLanguageID xmlCheckUTF8 xmlCheckVersion +xmlChildElementCount xmlCleanupCharEncodingHandlers xmlCleanupEncodingAliases xmlCleanupGlobals @@ -854,6 +855,7 @@ xmlFileMatch xmlFileOpen xmlFileRead xmlFindCharEncodingHandler +xmlFirstElementChild xmlFreeAttributeTable #ifdef LIBXML_AUTOMATA_ENABLED xmlFreeAutomata @@ -1009,6 +1011,7 @@ xmlIsRef xmlIsXHTML #endif xmlKeepBlanksDefault +xmlLastElementChild xmlLineNumbersDefault xmlLinkGetData xmlListAppend @@ -1064,6 +1067,7 @@ xmlMallocLoc #endif xmlMemBlocks xmlMemDisplay +xmlMemDisplayLast xmlMemFree xmlMemGet xmlMemMalloc @@ -1226,6 +1230,7 @@ xmlNewDocText xmlNewDocTextLen xmlNewDtd xmlNewElementContent +xmlNewEntity xmlNewEntityInputStream xmlNewGlobalNs xmlNewIOInputStream @@ -1256,6 +1261,7 @@ xmlNewTextWriterPushParser xmlNewTextWriterTree xmlNewValidCtxt xmlNextChar +xmlNextElementSibling xmlNoNetExternalEntityLoader xmlNodeAddContent xmlNodeAddContentLen @@ -1390,6 +1396,7 @@ xmlPatterncompile xmlPedanticParserDefault xmlPopInput xmlPopInputCallbacks +xmlPreviousElementSibling xmlPrintURI xmlPushInput xmlRMutexLock