#

## Module list from libxml2

API Menu

- Main Menu
- Developer Menu
- Code Examples
- API Menu
- Parser API
- Tree API
- Reader API
- XML Guidelines
- ChangeLog

API Indexes

- Alphabetic
- Constructors
- Functions/Types
- Modules
- Symbols

Related links

- Mail archive
- XSLT libxslt
- DOM gdome2
- XML-DSig xmlsec
- FTP
- Windows binaries
- Solaris binaries
- MacOsX binaries
- lxml Python bindings
- Perl bindings
- C++ bindings
- PHP bindings
- Pascal bindings
- Ruby bindings
- Tcl bindings
- Bug Tracker

this module implement the list support used in various place in the library.

## Table of Contents

    Structure xmlLink
    struct _xmlLink
    The content of this structure is not made public by the API.

    Typedef xmlLink * xmlLinkPtr

    Structure xmlList
    struct _xmlList
    The content of this structure is not made public by the API.

    Typedef xmlList * xmlListPtr

    void *	xmlLinkGetData			(xmlLinkPtr lk)

    int	xmlListAppend			(xmlListPtr l,
    					 void * data)

    void	xmlListClear			(xmlListPtr l)

    int	xmlListCopy			(xmlListPtr cur,
    					 const xmlListPtr old)

    xmlListPtr	xmlListCreate		(xmlListDeallocator deallocator,
    					 xmlListDataCompare compare)

    Function type: xmlListDataCompare
    int	xmlListDataCompare		(const void * data0,
    					 const void * data1)

    Function type: xmlListDeallocator
    void	xmlListDeallocator		(xmlLinkPtr lk)

    void	xmlListDelete			(xmlListPtr l)

    xmlListPtr	xmlListDup		(const xmlListPtr old)

    int	xmlListEmpty			(xmlListPtr l)

    xmlLinkPtr	xmlListEnd		(xmlListPtr l)

    xmlLinkPtr	xmlListFront		(xmlListPtr l)

    int	xmlListInsert			(xmlListPtr l,
    					 void * data)

    void	xmlListMerge			(xmlListPtr l1,
    					 xmlListPtr l2)

    void	xmlListPopBack			(xmlListPtr l)

    void	xmlListPopFront			(xmlListPtr l)

    int	xmlListPushBack			(xmlListPtr l,
    					 void * data)

    int	xmlListPushFront		(xmlListPtr l,
    					 void * data)

    int	xmlListRemoveAll		(xmlListPtr l,
    					 void * data)

    int	xmlListRemoveFirst		(xmlListPtr l,
    					 void * data)

    int	xmlListRemoveLast		(xmlListPtr l,
    					 void * data)

    void	xmlListReverse			(xmlListPtr l)

    void *	xmlListReverseSearch		(xmlListPtr l,
    					 void * data)

    void	xmlListReverseWalk		(xmlListPtr l,
    					 xmlListWalker walker,
    					 const void * user)

    void *	xmlListSearch			(xmlListPtr l,
    					 void * data)

    int	xmlListSize			(xmlListPtr l)

    void	xmlListSort			(xmlListPtr l)

    void	xmlListWalk			(xmlListPtr l,
    					 xmlListWalker walker,
    					 const void * user)

    Function type: xmlListWalker
    int	xmlListWalker			(const void * data,
    					 const void * user)

## Description

### Structure xmlLink

    Structure xmlLink
    struct _xmlLink {
    The content of this structure is not made public by the API.
    }

### Structure xmlList

    Structure xmlList
    struct _xmlList {
    The content of this structure is not made public by the API.
    }

### Function: xmlLinkGetData

    void *	xmlLinkGetData			(xmlLinkPtr lk)

See Returns.

`lk`: | a link
`Returns`: | a pointer to the data referenced from this link

### Function: xmlListAppend

    int	xmlListAppend			(xmlListPtr l,
    					 void * data)

Insert data in the ordered list at the end for this value

`l`: | a list
`data`: | the data
`Returns`: | 0 in case of success, 1 in case of failure

### Function: xmlListClear

    void	xmlListClear			(xmlListPtr l)

Remove the all data in the list

`l`: | a list

### Function: xmlListCopy

    int	xmlListCopy			(xmlListPtr cur,
    					 const xmlListPtr old)

Move all the element from the old list in the new list

`cur`: | the new list
`old`: | the old list
`Returns`: | 0 in case of success 1 in case of error

### Function: xmlListCreate

    xmlListPtr	xmlListCreate		(xmlListDeallocator deallocator,
    					 xmlListDataCompare compare)

Create a new list

`deallocator`: | an optional deallocator function
`compare`: | an optional comparison function
`Returns`: | the new list or NULL in case of error

### Function type: xmlListDataCompare

    Function type: xmlListDataCompare
    int	xmlListDataCompare		(const void * data0,
    					 const void * data1)

Callback function used to compare 2 data.

`data0`: | the first data
`data1`: | the second data
`Returns`: | 0 is equality, -1 or 1 otherwise depending on the ordering.

### Function type: xmlListDeallocator

    Function type: xmlListDeallocator
    void	xmlListDeallocator		(xmlLinkPtr lk)

Callback function used to free data from a list.

`lk`: | the data to deallocate

### Function: xmlListDelete

    void	xmlListDelete			(xmlListPtr l)

Deletes the list and its associated data

`l`: | a list

### Function: xmlListDup

    xmlListPtr	xmlListDup		(const xmlListPtr old)

Duplicate the list

`old`: | the list
`Returns`: | a new copy of the list or NULL in case of error

### Function: xmlListEmpty

    int	xmlListEmpty			(xmlListPtr l)

Is the list empty ?

`l`: | a list
`Returns`: | 1 if the list is empty, 0 if not empty and -1 in case of error

### Function: xmlListEnd

    xmlLinkPtr	xmlListEnd		(xmlListPtr l)

Get the last element in the list

`l`: | a list
`Returns`: | the last element in the list, or NULL

### Function: xmlListFront

    xmlLinkPtr	xmlListFront		(xmlListPtr l)

Get the first element in the list

`l`: | a list
`Returns`: | the first element in the list, or NULL

### Function: xmlListInsert

    int	xmlListInsert			(xmlListPtr l,
    					 void * data)

Insert data in the ordered list at the beginning for this value

`l`: | a list
`data`: | the data
`Returns`: | 0 in case of success, 1 in case of failure

### Function: xmlListMerge

    void	xmlListMerge			(xmlListPtr l1,
    					 xmlListPtr l2)

include all the elements of the second list in the first one and clear the second list

`l1`: | the original list
`l2`: | the new list

### Function: xmlListPopBack

    void	xmlListPopBack			(xmlListPtr l)

Removes the last element in the list

`l`: | a list

### Function: xmlListPopFront

    void	xmlListPopFront			(xmlListPtr l)

Removes the first element in the list

`l`: | a list

### Function: xmlListPushBack

    int	xmlListPushBack			(xmlListPtr l,
    					 void * data)

add the new data at the end of the list

`l`: | a list
`data`: | new data
`Returns`: | 1 if successful, 0 otherwise

### Function: xmlListPushFront

    int	xmlListPushFront		(xmlListPtr l,
    					 void * data)

add the new data at the beginning of the list

`l`: | a list
`data`: | new data
`Returns`: | 1 if successful, 0 otherwise

### Function: xmlListRemoveAll

    int	xmlListRemoveAll		(xmlListPtr l,
    					 void * data)

Remove the all instance associated to data in the list

`l`: | a list
`data`: | list data
`Returns`: | the number of deallocation, or 0 if not found

### Function: xmlListRemoveFirst

    int	xmlListRemoveFirst		(xmlListPtr l,
    					 void * data)

Remove the first instance associated to data in the list

`l`: | a list
`data`: | list data
`Returns`: | 1 if a deallocation occured, or 0 if not found

### Function: xmlListRemoveLast

    int	xmlListRemoveLast		(xmlListPtr l,
    					 void * data)

Remove the last instance associated to data in the list

`l`: | a list
`data`: | list data
`Returns`: | 1 if a deallocation occured, or 0 if not found

### Function: xmlListReverse

    void	xmlListReverse			(xmlListPtr l)

Reverse the order of the elements in the list

`l`: | a list

### Function: xmlListReverseSearch

    void *	xmlListReverseSearch		(xmlListPtr l,
    					 void * data)

Search the list in reverse order for an existing value of @data

`l`: | a list
`data`: | a search value
`Returns`: | the value associated to @data or NULL in case of error

### Function: xmlListReverseWalk

    void	xmlListReverseWalk		(xmlListPtr l,
    					 xmlListWalker walker,
    					 const void * user)

Walk all the element of the list in reverse order and apply the walker function to it

`l`: | a list
`walker`: | a processing function
`user`: | a user parameter passed to the walker function

### Function: xmlListSearch

    void *	xmlListSearch			(xmlListPtr l,
    					 void * data)

Search the list for an existing value of @data

`l`: | a list
`data`: | a search value
`Returns`: | the value associated to @data or NULL in case of error

### Function: xmlListSize

    int	xmlListSize			(xmlListPtr l)

Get the number of elements in the list

`l`: | a list
`Returns`: | the number of elements in the list or -1 in case of error

### Function: xmlListSort

    void	xmlListSort			(xmlListPtr l)

Sort all the elements in the list

`l`: | a list

### Function: xmlListWalk

    void	xmlListWalk			(xmlListPtr l,
    					 xmlListWalker walker,
    					 const void * user)

Walk all the element of the first from first to last and apply the walker function to it

`l`: | a list
`walker`: | a processing function
`user`: | a user parameter passed to the walker function

### Function type: xmlListWalker

    Function type: xmlListWalker
    int	xmlListWalker			(const void * data,
    					 const void * user)

Callback function used when walking a list with xmlListWalk().

`data`: | the data found in the list
`user`: | extra user provided data to the walker
`Returns`: | 0 to stop walking the list, 1 otherwise.

Daniel Veillard