Libxml 2 – Parser Specifications




Дата канвертавання19.04.2016
Памер173.45 Kb.

LIBXML 2 – Parser Specifications

Extensible Markup Language (XML) is a simple, flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere.


LIBXML2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform); it is free software available under the MIT License. XML itself is a meta-language to design markup languages, i.e. text language where semantic and structure is added to the content using extra "markup" information enclosed between angle brackets. HTML is the most well-known markup language. Though the library is written in C a variety of language bindings make it available in other environments.
LIBXML2 parser was created to read an XML file, in this case nasa.xml, and generate a tree while parsing it. A relatively large section of our project included this parser. To begin the creation of the versioning scheme, we traversed the parser-created tree and assembled a tree of our own. We then linked each parser’s tree node to each of our own tree’s node. Given that now, our tree, has a left number and a right number with content node of size 100 characters, we can now visit each node and implement inserting and/or removing of any additional nodes.

Key points on LIBXML2:


  • Libxml2 exports Push (progressive) and Pull (blocking) type parser interfaces for both XML and HTML.

  • Libxml2 can do DTD validation at parse time, using a parsed document instance, or with an arbitrary DTD.

  • Libxml2 includes complete XPath, XPointer and XInclude implementations.

  • It is written in plain C, making as few assumptions as possible, and sticking closely to ANSI C/POSIX for easy embedding. Works on Linux/Unix/Windows, ported to a number of other platforms.

  • Basic support for HTTP and FTP client allowing applications to fetch remote resources.

  • The design is modular, most of the extensions can be compiled out.

  • The internal document representation is as close as possible to the DOM interfaces.

  • Libxml2 also has a SAX like interface; the interface is designed to be compatible with Expat parser.

  • This library is released under the MIT License. See the Copyright file in the distribution for the precise wording.



General node diagram for each element in a user-specified XML file:

Some of the most basic elements required for the parser to create and parse a tree structure are listed below.



Process of creating a tree structure node while parsing an XML document:
1. Test for correct version of installed LIBXML

Function: LIBXML_TEST_VERSION

Filename: xmlversion.h

Description: Function to check the LIBXML version in use is compatible with the version the software has been compiled against

Parameters: None




2. Create a new XML document

Function: xmlNewDoc (const xmlChar * version)

Filename: tree.h

Description: Function to create a new XML document

Parameters: 1. version – xmlChar string giving the version of XML "2.0"

Returns: a new document




3. Set the root element of the XML document

Function: xmlDocSetRootElement (xmlDocPtr doc, xmlNodePtr root)

Filename: tree.h

Description: Set the root element of the document, doc->children is a list containing possibly comments

Parameters: 1. doc – XML document

2. root – new XML document’s root element



Returns: the old root element if any was found




4. Create the internal subset of a document

Function: xmlCreateIntSubset (xmlDocPtr doc, const xmlChar * name, const xmlChar * ExternalID,
const xmlChar * SystemID)

Filename: tree.h

Description: Create the internal subset of a document

Parameters: 1. doc – pointer to the XML document

2. name – the DTD name

3. ExternalID – the external (public) ID

4. SystemID – the system’s ID



Returns: a pointer to the new DTD structure




5. Create a new node element for the tree

Function: xmlNewNode (xmlNsPtr ns, const xmlChar * name)

Filename: tree.h

Description: Create a new node element

Parameters: 1. ns – namespaces if any

2. name – the node name



Returns: a pointer to the new node object. Uses xmlStrdup() to make copy of name




6. Create a new text node for the tree

Function: xmlNewText (const xmlChar * content)

Filename: tree.h

Description: Create a new text node element

Parameters: 1. content – the text content

Returns: a pointer to the new node object




7. Create a new property carried by a node

Function: xmlNewProp (xmlNodePtr node, const xmlChar * name, const xmlChar * value)

Filename: tree.h

Description: Create a new property carried by a node for the tree

Parameters: 1. node – the holding node

2. name – the name of the attribute

3. value – the value of the attribute

Returns: a pointer to the new attribute




8. Add a new node to the parent node

Function: xmlAddChild (xmlNodePtr parent, xmlNodePtr cur)

Filename: tree.h

Description: Add a new node to parent, at the end of the child (or property) list merging adjacent TEXT nodes (in which case cur is freed). If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an attribute with equal name, it is first destroyed.

Parameters: 1. parent – the parent node

2. cur – the child node



Returns: the child or a NULL in case of an error




9. Create a new child element and add it to the end of the parent children list

Function: xmlNewChild (xmlNodePtr parent, xmlNsPtr ns, const xmlChar * name, const xmlChar *

content)


Filename: tree.h

Description: Create a new child element and add it to the end of the parent children list. ns and content parameters are optional (NULL). If ns is NULL, the newly created element inherits the namespace of the parent. If content is non NULL, a child list containing the TEXTs and ENTITY_REFs node will be created. NOTE: content is supposed to be a piece of XML CDATA, so it allows entity references. XML special chars must be escaped first by using xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should be used.

Parameters: 1. parent – the parent node

2. ns – namespace if any

3. name – the name of the child node

4. content – the XML content of the child, if any



Returns: a pointer to the new node object




10. Dump an XML document to a file or an URL

Function: xmlSaveFormatFileEnc (const char * filename, xmlDocPtr cur, const char * encoding,
int format)

Filename: tree.h

Description: Dump an XML document to a file or an URL

Parameters: 1. filename – the filename or URL to output

2. cur – the document being saved

3. encoding – the name of the encoding to use or NULL

4. format – should formatting spaces be added



Returns: node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called




11. Free all structures used by the XML document

Function: xmlFreeDoc (xmlDocPtr cur)

Filename: tree.h

Description: Free all the structures used by a document, tree included

Parameters: 1. cur – pointer to the current document

Returns: None




12. Cleanup function for the XML library. It reclaims all related global memory allocated for processing of the document

Function: xmlCleanupParser (void)

Filename: parser.h

Description: Cleanup function for the XML library. It tries to reclaim all parsing related global memory allocated for the library processing. It doesn't de-allocate any document related memory. Calling this function should not prevent reusing the library but one should call xmlCleanupParser() only when the process has finished using the library or XML document built with it.

Parameters: None

Returns: None




13. Dump in-extenso the memory blocks allocated to the file “.memorylist”

Function: xmlMemoryDump (void)

Filename: xmlmemory.h

Description: Dump in-extenso the memory blocks allocated to the file “.memorylist”

Parameters: None

Returns: None

LIBXML 2 – Parser Included Variable Declarations





#define BASE_BUFFER_SIZE

Enum xmlElementContentType

#define XML_GET_CONTENT

Typedef xmlElement * xmlElementPtr

#define XML_GET_LINE

Enum xmlElementType

#define XML_LOCAL_NAMESPACE

Enum xmlElementTypeVal

#define XML_XML_ID

Structure xmlEntity

#define XML_XML_NAMESPACE

Typedef xmlEntity * xmlEntityPtr

#define xmlChildrenNode

Structure xmlEnumeration

#define xmlRootNode

Typedef xmlEnumeration * xmlEnumerationPtr

Structure xmlAttr struct _xmlAttr

Structure xmlID

Typedef xmlAttr * xmlAttrPtr

Typedef xmlID * xmlIDPtr

Structure xmlAttribute

Structure xmlNode

Enum xmlAttributeDefault

Typedef xmlNode * xmlNodePtr

Typedef xmlAttribute * xmlAttributePtr

Structure xmlNotation

Enum xmlAttributeType

Typedef xmlNotation * xmlNotationPtr

Structure xmlBuffer

Structure xmlNs

Enum xmlBufferAllocationScheme

Typedef xmlNs * xmlNsPtr

Typedef xmlBuffer * xmlBufferPtr

Typedef xmlElementType xmlNsType

Structure xmlDoc

Structure xmlOutputBuffer

Typedef xmlDoc * xmlDocPtr

Typedef xmlOutputBuffer * xmlOutputBufferPtr

Structure xmlDtd

Structure xmlParserCtxt

Typedef xmlDtd * xmlDtdPtr

Typedef xmlParserCtxt * xmlParserCtxtPtr

Structure xmlElement

Structure xmlParserInput

Structure xmlElementContent

Structure xmlParserInputBuffer

Enum xmlElementContentOccur

Typedef xmlParserInputBuffer * xmlParserInputBufferPtr

Structure xmlSAXHandler

Structure xmlRef

Typedef xmlRef * xmlRefPtr

Typedef xmlSAXHandler * xmlSAXHandlerPtr

Structure xmlSAXLocator

Typedef xmlSAXLocator * xmlSAXLocatorPtr


LIBXML 2 – Parser Included Function Declarations





XmlNodePtr xmlAddChild

(xmlNodePtr parent, xmlNodePtr cur)

XmlNodePtr xmlAddChildList

(xmlNodePtr parent, xmlNodePtr cur)

XmlNodePtr xmlAddNextSibling

(xmlNodePtr cur, xmlNodePtr elem)

xmlNodePtr xmlAddPrevSibling

(xmlNodePtr cur, xmlNodePtr elem)

xmlNodePtr xmlAddSibling

(xmlNodePtr cur, xmlNodePtr elem)

void xmlAttrSerializeTxtContent

(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr attr, const xmlChar * string)

int xmlBufferAdd

(xmlBufferPtr buf, const xmlChar * str, int len)

int xmlBufferAddHead

(xmlBufferPtr buf, const xmlChar * str, int len)

int xmlBufferCCat

(xmlBufferPtr buf, const char * str)

int xmlBufferCat

(xmlBufferPtr buf, const xmlChar * str)

const xmlChar * xmlBufferContent

(const xmlBufferPtr buf)

xmlBufferPtr xmlBufferCreate

(void)

xmlBufferPtr xmlBufferCreateSize

(size_t size)

xmlBufferPtr xmlBufferCreateStatic

(void * mem, size_t size)

int xmlBufferDump

(FILE * file, xmlBufferPtr buf)

void xmlBufferEmpty

(xmlBufferPtr buf)

void xmlBufferFree

(xmlBufferPtr buf)

int xmlBufferGrow

(xmlBufferPtr buf, unsigned int len)

int xmlBufferLength

(const xmlBufferPtr buf)

int xmlBufferResize

(xmlBufferPtr buf, unsigned int size)

void xmlBufferSetAllocationScheme

(xmlBufferPtr buf, xmlBufferAllocationScheme scheme)

int xmlBufferShrink

(xmlBufferPtr buf, unsigned int len)

void xmlBufferWriteCHAR

(xmlBufferPtr buf, const xmlChar * string)

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)

xmlDocPtr xmlCopyDoc

(xmlDocPtr doc, int recursive)

xmlDtdPtr xmlCopyDtd

(xmlDtdPtr dtd)

xmlNsPtr xmlCopyNamespace

(xmlNsPtr cur)

xmlNsPtr xmlCopyNamespaceList

(xmlNsPtr cur)

xmlNodePtr xmlCopyNode

(const xmlNodePtr node, int extended)

xmlNodePtr xmlCopyNodeList

(const xmlNodePtr node)

xmlAttrPtr xmlCopyProp

(xmlNodePtr target, xmlAttrPtr cur)

xmlAttrPtr xmlCopyPropList

(xmlNodePtr target, xmlAttrPtr cur)

xmlDtdPtr xmlCreateIntSubset

(xmlDocPtr doc, const xmlChar * name, const xmlChar *ExternalID, const xmlChar*SystemID)

xmlNodePtr xmlDocCopyNode

(const xmlNodePtr node, xmlDocPtr doc,int extended)

xmlNodePtr xmlDocCopyNodeList

(xmlDocPtr doc, const xmlNodePtr node)

int xmlDocDump

(FILE * f, xmlDocPtr cur)

void xmlDocDumpFormatMemory

(xmlDocPtr cur, xmlChar**mem, int*size, int format)

void xmlDocDumpFormatMemoryEnc

(xmlDocPtr out_doc, xmlChar ** doc_txt_ptr, int * doc_txt_len, const char * txt_encoding, int format)

void xmlDocDumpMemory

(xmlDocPtr cur, xmlChar ** mem, int * size)

void xmlDocDumpMemoryEnc

(xmlDocPtr out_doc, xmlChar ** doc_txt_ptr, int * doc_txt_len, const char * txt_encoding)

int xmlDocFormatDump

(FILE * f, xmlDocPtr cur, int format)

xmlNodePtr xmlDocGetRootElement

(xmlDocPtr doc)

xmlNodePtr xmlDocSetRootElement

(xmlDocPtr doc, xmlNodePtr root)

void xmlElemDump

(FILE * f, xmlDocPtr doc, xmlNodePtr cur)

void xmlFreeDoc

(xmlDocPtr cur)

void xmlFreeDtd

(xmlDtdPtr cur)

void xmlFreeNode

(xmlNodePtr cur)

void xmlFreeNodeList

(xmlNodePtr cur)

void xmlFreeNs

(xmlNsPtr cur)

void xmlFreeNsList

(xmlNsPtr cur)

void xmlFreeProp

(xmlAttrPtr cur)

void xmlFreePropList

(xmlAttrPtr cur)

int xmlGetCompressMode

(void)

int xmlGetDocCompressMode

(xmlDocPtr doc)

xmlDtdPtr xmlGetIntSubset

(xmlDocPtr doc)

xmlNodePtr xmlGetLastChild

(xmlNodePtr parent)

long xmlGetLineNo

(xmlNodePtr node)

xmlChar * xmlGetNoNsProp

(xmlNodePtr node, const xmlChar * name)

xmlChar * xmlGetNodePath

(xmlNodePtr node)

xmlNsPtr * xmlGetNsList

(xmlDocPtr doc, xmlNodePtr node)

xmlChar * xmlGetNsProp

(xmlNodePtr node, const xmlChar * name, const xmlChar * nameSpace)

xmlChar * xmlGetProp

(xmlNodePtr node, const xmlChar * name)

xmlAttrPtr xmlHasNsProp

(xmlNodePtr node, const xmlChar * name, const xmlChar * nameSpace)

xmlAttrPtr xmlHasProp

(xmlNodePtr node, const xmlChar * name)

int xmlIsBlankNode

(xmlNodePtr node)

int xmlIsXHTML

(const xmlChar * systemID, const xmlChar* publicID)

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)

xmlNodePtr xmlNewComment

(const xmlChar * content)

xmlDocPtr xmlNewDoc

(const xmlChar * version)

xmlNodePtr xmlNewDocComment

(xmlDocPtr doc, const xmlChar * content)

xmlNodePtr xmlNewDocFragment

(xmlDocPtr doc)

xmlNodePtr xmlNewDocNode

(xmlDocPtr doc, xmlNsPtr ns, const xmlChar * name, const xmlChar * content)

xmlNodePtr xmlNewDocNodeEatName

(xmlDocPtr doc, xmlNsPtr ns, xmlChar * name, const xmlChar * content)

xmlNodePtr xmlNewDocPI

(xmlDocPtr doc, const xmlChar * name, const xmlChar * content)

xmlAttrPtr xmlNewDocProp

(xmlDocPtr doc, const xmlChar * name, const xmlChar * value)

xmlNodePtr xmlNewDocRawNode

(xmlDocPtr doc, xmlNsPtr ns, const xmlChar * name, const xmlChar * content)

xmlNodePtr xmlNewDocText

(xmlDocPtr doc, const xmlChar * content)

xmlNodePtr xmlNewDocTextLen

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

xmlDtdPtr xmlNewDtd

(xmlDocPtr doc, const xmlChar * name, const xmlChar * ExternalID, const xmlChar * SystemID)

xmlNsPtr xmlNewGlobalNs

(xmlDocPtr doc, const xmlChar * href, const xmlChar * prefix)

xmlNodePtr xmlNewNode

(xmlNsPtr ns, const xmlChar * name)

xmlNodePtr xmlNewNodeEatName

(xmlNsPtr ns, xmlChar * name)

xmlNsPtr xmlNewNs

(xmlNodePtr node, const xmlChar * href, const xmlChar * prefix)

xmlAttrPtr xmlNewNsProp

(xmlNodePtr node, xmlNsPtr ns, const xmlChar * name, const xmlChar * value)

xmlAttrPtr xmlNewNsPropEatName

(xmlNodePtr node, xmlNsPtr ns, xmlChar * name, const xmlChar * value)

xmlNodePtr xmlNewPI

(const xmlChar * name, const xmlChar * content)

xmlAttrPtr xmlNewProp

(xmlNodePtr node, const xmlChar * name, const xmlChar * value)

xmlNodePtr xmlNewReference

(xmlDocPtr doc, const xmlChar * name)

xmlNodePtr xmlNewText

(const xmlChar * content)

xmlNodePtr xmlNewTextChild

(xmlNodePtr parent, xmlNsPtr ns, const xmlChar * name, const xmlChar * content)

xmlNodePtr xmlNewTextLen

(const xmlChar * content, int len)

void xmlNodeAddContent

(xmlNodePtr cur, const xmlChar * content)

void xmlNodeAddContentLen

(xmlNodePtr cur, const xmlChar * content, int len)

int xmlNodeBufGetContent

(xmlBufferPtr buffer, xmlNodePtr cur)

int xmlNodeDump

(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format)

void xmlNodeDumpOutput

(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format, const char * encoding)

xmlChar * xmlNodeGetBase

(xmlDocPtr doc, xmlNodePtr cur)

xmlChar * xmlNodeGetContent

(xmlNodePtr cur)

xmlChar * xmlNodeGetLang

(xmlNodePtr cur)

int xmlNodeGetSpacePreserve

(xmlNodePtr cur)

int xmlNodeIsText

(xmlNodePtr node)

xmlChar * xmlNodeListGetRawString

(xmlDocPtr doc, xmlNodePtr list, int inLine)

xmlChar * xmlNodeListGetString

(xmlDocPtr doc, xmlNodePtr list, int inLine)

void xmlNodeSetBase

(xmlNodePtr cur, const xmlChar * uri)

void xmlNodeSetContent

(xmlNodePtr cur, const xmlChar * content)

void xmlNodeSetContentLen

(xmlNodePtr cur, const xmlChar * content, int len)

void xmlNodeSetLang

(xmlNodePtr cur, const xmlChar * lang)

void xmlNodeSetName

(xmlNodePtr cur, const xmlChar * name)

void xmlNodeSetSpacePreserve

(xmlNodePtr cur, int val)

int xmlReconciliateNs

(xmlDocPtr doc, xmlNodePtr tree)

int xmlRemoveProp

(xmlAttrPtr cur)

xmlNodePtr xmlReplaceNode

(xmlNodePtr old, xmlNodePtr cur)

int xmlSaveFile

(const char * filename, xmlDocPtr cur)

int xmlSaveFileEnc

(const char * filename, xmlDocPtr cur, const char * encoding)

int xmlSaveFileTo

(xmlOutputBufferPtr buf, xmlDocPtr cur, const char * encoding)

int xmlSaveFormatFile

(const char * filename, xmlDocPtr cur, int format)

int xmlSaveFormatFileEnc

(const char * filename, xmlDocPtr cur, const char * encoding, int format)

int xmlSaveFormatFileTo

(xmlOutputBufferPtr buf, xmlDocPtr cur, const char * encoding, int format)

xmlNsPtr xmlSearchNs

(xmlDocPtr doc, xmlNodePtr node, const xmlChar * nameSpace)

xmlNsPtr xmlSearchNsByHref

(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)

void xmlSetBufferAllocationScheme

(xmlBufferAllocationScheme scheme)

void xmlSetCompressMode

(int mode)

void xmlSetDocCompressMode

(xmlDocPtr doc, int mode)

void xmlSetListDoc

(xmlNodePtr list, xmlDocPtr doc)

void xmlSetNs

(xmlNodePtr node, xmlNsPtr ns)

xmlAttrPtr xmlSetNsProp

(xmlNodePtr node, xmlNsPtr ns, const xmlChar* name, const xmlChar * value)

xmlAttrPtr xmlSetProp

(xmlNodePtr node, const xmlChar * name, const xmlChar * value)

void xmlSetTreeDoc

(xmlNodePtr tree, xmlDocPtr doc)

xmlChar * xmlSplitQName2

(const xmlChar * name, xmlChar ** prefix)

const xmlChar * xmlSplitQName3

(const xmlChar * name, int * len)

xmlNodePtr xmlStringGetNodeList

(xmlDocPtr doc, const xmlChar * value)

xmlNodePtr xmlStringLenGetNodeList

(xmlDocPtr doc, const xmlChar * value, int len)

int xmlTextConcat

(xmlNodePtr node, const xmlChar * content, int len)

xmlNodePtr xmlTextMerge

(xmlNodePtr first, xmlNodePtr second)

void xmlUnlinkNode

(xmlNodePtr cur)

int xmlUnsetNsProp

(xmlNodePtr node, xmlNsPtr ns, const xmlChar* name)

int xmlUnsetProp

(xmlNodePtr node, const xmlChar * name)

int xmlValidateNCName

(const xmlChar * value, int space)

int xmlValidateNMToken

(const xmlChar * value, int space)

int xmlValidateName

(const xmlChar * value, int space)

int xmlValidateQName

(const xmlChar * value, int space)

Typedef xmlElementContent * xmlElementContentPtr

Typedef xmlParserInput * xmlParserInputPtr

void xmlBufferAllocationScheme xmlGetBufferAllocationScheme

(void)


LIBXML 2 – Parser Used Functions




Structure xmlElement
struct _xmlElement {

void * _private : application data



xmlElementType type : XML_ELEMENT_DECL, must be second !

const xmlChar * name : Element name

struct _xmlNode * children : NULL

struct _xmlNode * last : NULL

struct _xmlDtd * parent : -> DTD

struct _xmlNode * next : next sibling link

struct _xmlNode * prev : previous sibling link

struct _xmlDoc * doc : the containing document



xmlElementTypeVal etype : The type

xmlElementContentPtr content : the allowed element content

xmlAttributePtr attributes : List of the declared attributes

const xmlChar * prefix : the namespace prefix if any



xmlRegexpPtr contModel : the validating regexp

void * contModel

}




Structure xmlDoc
struct _xmlDoc {

void * _private : application data



xmlElementType type : XML_DOCUMENT_NODE, must be second !

char * name : name/filename/URI of the document

struct _xmlNode * children : the document tree

struct _xmlNode * last : last child link

struct _xmlNode * parent : child->parent link

struct _xmlNode * next : next sibling link

struct _xmlNode * prev : previous sibling link

struct _xmlDoc * doc : autoreference to itself End of common p

int compression : level of zlib compression

int standalone : standalone document (no external refs)

struct _xmlDtd * intSubset : the document internal subset

struct _xmlDtd * extSubset : the document external subset

struct _xmlNs * oldNs : Global namespace, the old way

const xmlChar * version : the XML version string

const xmlChar * encoding : external initial encoding, if any

void * ids : Hash table for ID attributes if any

void * refs : Hash table for IDREFs attributes if any

const xmlChar * URL : The URI for that document

int charset : encoding of the in-memory content actua

struct _xmlDict * dict : dict used to allocate names or NULL

void * psvi : for type/PSVI informations

}




Enum xmlElementTypeVal

Enum xmlElementTypeVal {

XML_ELEMENT_TYPE_UNDEFINED = 0

XML_ELEMENT_TYPE_EMPTY = 1

XML_ELEMENT_TYPE_ANY = 2

XML_ELEMENT_TYPE_MIXED = 3

XML_ELEMENT_TYPE_ELEMENT = 4

}




Enum xmlElementType

Enum xmlElementType {

XML_ELEMENT_NODE = 1

XML_ATTRIBUTE_NODE = 2

XML_TEXT_NODE = 3

XML_CDATA_SECTION_NODE = 4

XML_ENTITY_REF_NODE = 5

XML_ENTITY_NODE = 6

XML_PI_NODE = 7

XML_COMMENT_NODE = 8

XML_DOCUMENT_NODE = 9

XML_DOCUMENT_TYPE_NODE = 10

XML_DOCUMENT_FRAG_NODE = 11

XML_NOTATION_NODE = 12

XML_HTML_DOCUMENT_NODE = 13

XML_DTD_NODE = 14

XML_ELEMENT_DECL = 15

XML_ATTRIBUTE_DECL = 16

XML_ENTITY_DECL = 17

XML_NAMESPACE_DECL = 18

XML_XINCLUDE_START = 19

XML_XINCLUDE_END = 20

XML_DOCB_DOCUMENT_NODE = 21

}




Structure xmlNode
struct _xmlNode {

void * _private : application data



xmlElementType type : type number, must be second !

const xmlChar * name : the name of the node, or the entity

struct _xmlNode * children : parent->childs link

struct _xmlNode * last : last child link

struct _xmlNode * parent : child->parent link

struct _xmlNode * next : next sibling link

struct _xmlNode * prev : previous sibling link

struct _xmlDoc * doc : the containing document End of common p



xmlNs * ns : pointer to the associated namespace

xmlChar * content : the content

struct _xmlAttr * properties : properties list



xmlNs * nsDef : namespace definitions on this node

void * psvi : for type/PSVI information

unsigned short line : line number

unsigned short extra : extra data for XPath/XSLT

}



Structure xmlAttribute
struct _xmlAttribute {

void * _private : application data



xmlElementType type : XML_ATTRIBUTE_DECL, must be second !

const xmlChar * name : Attribute name

struct _xmlNode * children : NULL

struct _xmlNode * last : NULL

struct _xmlDtd * parent : -> DTD

struct _xmlNode * next : next sibling link

struct _xmlNode * prev : previous sibling link

struct _xmlDoc * doc : the containing document

struct _xmlAttribute * nexth : next in hash table

xmlAttributeType atype : The attribute type

xmlAttributeDefault def : the default

const xmlChar * defaultValue : or the default value



xmlEnumerationPtr tree : or the enumeration tree if any

const xmlChar * prefix : the namespace prefix if any

const xmlChar * elem : Element holding the attribute

}



LIBXML2 Library – MIT License


Copyright (c) <2004>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



Copyright © 2004 by the Open Source Initiative
Technical questions about the website go to Steve M.: webmaster@opensource.org / Policy questions about open source, email osi@opensource.org

The contents of website are licensed under the Open Software License 2.1 or Academic Free License 2.1 OSI is a registered non-profit with 501(c)(3) status. Contact our Board for further donation information.






База данных защищена авторским правом ©shkola.of.by 2016
звярнуцца да адміністрацыі

    Галоўная старонка