ReactOS 0.4.16-dev-2132-g3885311
parser.h File Reference
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/dict.h>
#include <libxml/hash.h>
#include <libxml/valid.h>
#include <libxml/entities.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlstring.h>
#include <libxml/xmlmemory.h>
#include <libxml/encoding.h>
#include <libxml/xmlIO.h>
#include <libxml/SAX2.h>
#include <libxml/threads.h>
Include dependency graph for parser.h:

Go to the source code of this file.

Classes

struct  _xmlParserInput
 
struct  _xmlParserNodeInfo
 
struct  _xmlParserNodeInfoSeq
 
struct  _xmlParserCtxt
 
struct  _xmlSAXLocator
 
struct  _xmlSAXHandler
 
struct  _xmlSAXHandlerV1
 

Macros

#define XML_TREE_INTERNALS
 
#define XML_DEFAULT_VERSION   "1.0"
 
#define XML_DETECT_IDS   2
 
#define XML_COMPLETE_ATTRS   4
 
#define XML_SKIP_IDS   8
 

Typedefs

typedef void(* xmlParserInputDeallocate) (xmlChar *str)
 
typedef struct _xmlParserNodeInfo xmlParserNodeInfo
 
typedef xmlParserNodeInfoxmlParserNodeInfoPtr
 
typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq
 
typedef xmlParserNodeInfoSeqxmlParserNodeInfoSeqPtr
 
typedef struct _xmlStartTag xmlStartTag
 
typedef struct _xmlParserNsData xmlParserNsData
 
typedef struct _xmlAttrHashBucket xmlAttrHashBucket
 
typedef xmlParserInputPtr(* resolveEntitySAXFunc) (void *ctx, const xmlChar *publicId, const xmlChar *systemId)
 
: the root element name

externalSubsetSAXFunc: @ctx: the user data (XML parser context)

@ExternalID: the external ID @SystemID: the SYSTEM ID (e.g. filename or URL)

Callback on external subset declaration.

typedef void(* internalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
 
typedef void(* externalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
 
: The entity name

getParameterEntitySAXFunc: @ctx: the user data (XML parser context)

Get a parameter entity by name.

Returns the xmlEntityPtr if found.

typedef xmlEntityPtr(* getEntitySAXFunc) (void *ctx, const xmlChar *name)
 
typedef xmlEntityPtr(* getParameterEntitySAXFunc) (void *ctx, const xmlChar *name)
 
: The name of the notation

notationDeclSAXFunc: @ctx: the user data (XML parser context)

@publicId: The public ID of the entity @systemId: The system ID of the entity

What to do when a notation declaration has been parsed.

typedef void(* notationDeclSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
 
typedef void(* attributeDeclSAXFunc) (void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
 
: the element name

endElementSAXFunc: @ctx: the user data (XML parser context)

Called when the end of an element has been detected.

typedef void(* elementDeclSAXFunc) (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content)
 
typedef void(* endElementSAXFunc) (void *ctx, const xmlChar *name)
 
: The name of the entity

unparsedEntityDeclSAXFunc: @ctx: the user data (XML parser context)

@publicId: The public ID of the entity @systemId: The system ID of the entity @notationName: the name of the notation

What to do when an unparsed entity declaration is parsed.

typedef void(* unparsedEntityDeclSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)
 
typedef void(* setDocumentLocatorSAXFunc) (void *ctx, xmlSAXLocatorPtr loc)
 
typedef void(* startDocumentSAXFunc) (void *ctx)
 
typedef void(* endDocumentSAXFunc) (void *ctx)
 
: The element name, including namespace prefix

startElementSAXFunc: @ctx: the user data (XML parser context)

@atts: An array of name/value attributes pairs, NULL terminated

Called when an opening tag has been processed.

typedef void(* startElementSAXFunc) (void *ctx, const xmlChar *name, const xmlChar **atts)
 
: The attribute name, including namespace prefix

attributeSAXFunc: @ctx: the user data (XML parser context)

@value: The attribute value

Handle an attribute that has been read by the parser. The default handling is to convert the attribute into an DOM subtree and past it in a new xmlAttr element added to the element.

typedef void(* attributeSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *value)
 

Enumerations

enum  xmlParserInputState {
  XML_PARSER_EOF = -1 , XML_PARSER_START = 0 , XML_PARSER_MISC , XML_PARSER_PI ,
  XML_PARSER_DTD , XML_PARSER_PROLOG , XML_PARSER_COMMENT , XML_PARSER_START_TAG ,
  XML_PARSER_CONTENT , XML_PARSER_CDATA_SECTION , XML_PARSER_END_TAG , XML_PARSER_ENTITY_DECL ,
  XML_PARSER_ENTITY_VALUE , XML_PARSER_ATTRIBUTE_VALUE , XML_PARSER_SYSTEM_LITERAL , XML_PARSER_EPILOG ,
  XML_PARSER_IGNORE , XML_PARSER_PUBLIC_LITERAL , XML_PARSER_XML_DECL
}
 
enum  xmlParserMode {
  XML_PARSE_UNKNOWN = 0 , XML_PARSE_DOM = 1 , XML_PARSE_SAX = 2 , XML_PARSE_PUSH_DOM = 3 ,
  XML_PARSE_PUSH_SAX = 4 , XML_PARSE_READER = 5
}
 

: the entity name

referenceSAXFunc: @ctx: the user data (XML parser context)

Called when an entity reference is detected.

#define XML_SAX2_MAGIC   0xDEEDBEAF
 
#define XML_GLOBALS_PARSER_CORE
 
#define XML_GLOBALS_PARSER_OUTPUT
 
#define XML_GLOBALS_PARSER_SAX1
 
#define XML_GLOBALS_PARSER
 
#define XML_OP   XML_DECLARE_GLOBAL
 
enum  xmlParserOption {
  XML_PARSE_RECOVER = 1<<0 , XML_PARSE_NOENT = 1<<1 , XML_PARSE_DTDLOAD = 1<<2 , XML_PARSE_DTDATTR = 1<<3 ,
  XML_PARSE_DTDVALID = 1<<4 , XML_PARSE_NOERROR = 1<<5 , XML_PARSE_NOWARNING = 1<<6 , XML_PARSE_PEDANTIC = 1<<7 ,
  XML_PARSE_NOBLANKS = 1<<8 , XML_PARSE_SAX1 = 1<<9 , XML_PARSE_XINCLUDE = 1<<10 , XML_PARSE_NONET = 1<<11 ,
  XML_PARSE_NODICT = 1<<12 , XML_PARSE_NSCLEAN = 1<<13 , XML_PARSE_NOCDATA = 1<<14 , XML_PARSE_NOXINCNODE = 1<<15 ,
  XML_PARSE_COMPACT = 1<<16 , XML_PARSE_OLD10 = 1<<17 , XML_PARSE_NOBASEFIX = 1<<18 , XML_PARSE_HUGE = 1<<19 ,
  XML_PARSE_OLDSAX = 1<<20 , XML_PARSE_IGNORE_ENC = 1<<21 , XML_PARSE_BIG_LINES = 1<<22
}
 
enum  xmlFeature {
  XML_WITH_THREAD = 1 , XML_WITH_TREE = 2 , XML_WITH_OUTPUT = 3 , XML_WITH_PUSH = 4 ,
  XML_WITH_READER = 5 , XML_WITH_PATTERN = 6 , XML_WITH_WRITER = 7 , XML_WITH_SAX1 = 8 ,
  XML_WITH_FTP = 9 , XML_WITH_HTTP = 10 , XML_WITH_VALID = 11 , XML_WITH_HTML = 12 ,
  XML_WITH_LEGACY = 13 , XML_WITH_C14N = 14 , XML_WITH_CATALOG = 15 , XML_WITH_XPATH = 16 ,
  XML_WITH_XPTR = 17 , XML_WITH_XINCLUDE = 18 , XML_WITH_ICONV = 19 , XML_WITH_ISO8859X = 20 ,
  XML_WITH_UNICODE = 21 , XML_WITH_REGEXP = 22 , XML_WITH_AUTOMATA = 23 , XML_WITH_EXPR = 24 ,
  XML_WITH_SCHEMAS = 25 , XML_WITH_SCHEMATRON = 26 , XML_WITH_MODULES = 27 , XML_WITH_DEBUG = 28 ,
  XML_WITH_DEBUG_MEM = 29 , XML_WITH_DEBUG_RUN = 30 , XML_WITH_ZLIB = 31 , XML_WITH_ICU = 32 ,
  XML_WITH_LZMA = 33 , XML_WITH_NONE = 99999
}
 
typedef void(* entityDeclSAXFunc) (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
 
typedef void(* referenceSAXFunc) (void *ctx, const xmlChar *name)
 
typedef void(* charactersSAXFunc) (void *ctx, const xmlChar *ch, int len)
 
typedef void(* ignorableWhitespaceSAXFunc) (void *ctx, const xmlChar *ch, int len)
 
typedef void(* processingInstructionSAXFunc) (void *ctx, const xmlChar *target, const xmlChar *data)
 
typedef void(* commentSAXFunc) (void *ctx, const xmlChar *value)
 
typedef void(* cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len)
 
typedef void(* warningSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
 
typedef void(*) typedef void(* errorSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
 
typedef void(*) typedef void(*) typedef void(* fatalErrorSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
 
typedef void(*) typedef void(*) typedef void(*) typedef int(* isStandaloneSAXFunc) (void *ctx)
 
typedef int(* hasInternalSubsetSAXFunc) (void *ctx)
 
typedef int(* hasExternalSubsetSAXFunc) (void *ctx)
 
typedef void(* startElementNsSAX2Func) (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
 
typedef void(* endElementNsSAX2Func) (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
 
typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1
 
typedef xmlSAXHandlerV1xmlSAXHandlerV1Ptr
 
typedef xmlParserInputPtr(* xmlExternalEntityLoader) (const char *URL, const char *ID, xmlParserCtxtPtr context)
 
XMLPUBVAR const char *const xmlParserVersion
 
XML_GLOBALS_PARSER XMLPUBFUN void xmlInitParser (void)
 
XMLPUBFUN void xmlCleanupParser (void)
 
XML_DEPRECATED XMLPUBFUN void xmlInitGlobals (void)
 
XML_DEPRECATED XMLPUBFUN void xmlCleanupGlobals (void)
 
XML_DEPRECATED XMLPUBFUN int xmlParserInputRead (xmlParserInputPtr in, int len)
 
XML_DEPRECATED XMLPUBFUN int xmlParserInputGrow (xmlParserInputPtr in, int len)
 
XML_DEPRECATED XMLPUBFUN int xmlSubstituteEntitiesDefault (int val)
 
XML_DEPRECATED XMLPUBFUN int xmlThrDefSubstituteEntitiesDefaultValue (int v)
 
XML_DEPRECATED XMLPUBFUN int xmlKeepBlanksDefault (int val)
 
XML_DEPRECATED XMLPUBFUN int xmlThrDefKeepBlanksDefaultValue (int v)
 
XMLPUBFUN void xmlStopParser (xmlParserCtxtPtr ctxt)
 
XML_DEPRECATED XMLPUBFUN int xmlPedanticParserDefault (int val)
 
XML_DEPRECATED XMLPUBFUN int xmlThrDefPedanticParserDefaultValue (int v)
 
XML_DEPRECATED XMLPUBFUN int xmlLineNumbersDefault (int val)
 
XML_DEPRECATED XMLPUBFUN int xmlThrDefLineNumbersDefaultValue (int v)
 
XML_DEPRECATED XMLPUBFUN int xmlThrDefDoValidityCheckingDefaultValue (int v)
 
XML_DEPRECATED XMLPUBFUN int xmlThrDefGetWarningsDefaultValue (int v)
 
XML_DEPRECATED XMLPUBFUN int xmlThrDefLoadExtDtdDefaultValue (int v)
 
XML_DEPRECATED XMLPUBFUN int xmlThrDefParserDebugEntities (int v)
 
XMLPUBFUN int xmlParseDocument (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN xmlParserErrors xmlParseInNodeContext (xmlNodePtr node, const char *data, int datalen, int options, xmlNodePtr *lst)
 
XMLPUBFUN int xmlParseCtxtExternalEntity (xmlParserCtxtPtr ctx, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst)
 
XMLPUBFUN xmlParserCtxtPtr xmlNewParserCtxt (void)
 
XMLPUBFUN xmlParserCtxtPtr xmlNewSAXParserCtxt (const xmlSAXHandler *sax, void *userData)
 
XMLPUBFUN int xmlInitParserCtxt (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN void xmlClearParserCtxt (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN xmlParserCtxtPtr xmlCreateDocParserCtxt (const xmlChar *cur)
 
XMLPUBFUN xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, void *user_data, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
 
XMLPUBFUN xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
 
XMLPUBFUN const xmlParserNodeInfoxmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, const xmlNodePtr node)
 
XMLPUBFUN void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq)
 
XMLPUBFUN void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq)
 
XMLPUBFUN unsigned long xmlParserFindNodeInfoIndex (const xmlParserNodeInfoSeqPtr seq, const xmlNodePtr node)
 
XMLPUBFUN void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, const xmlParserNodeInfoPtr info)
 
XMLPUBFUN void xmlSetExternalEntityLoader (xmlExternalEntityLoader f)
 
XMLPUBFUN xmlExternalEntityLoader xmlGetExternalEntityLoader (void)
 
XMLPUBFUN xmlParserInputPtr xmlLoadExternalEntity (const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
 
XMLPUBFUN long xmlByteConsumed (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN void xmlCtxtReset (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN int xmlCtxtResetPush (xmlParserCtxtPtr ctxt, const char *chunk, int size, const char *filename, const char *encoding)
 
XMLPUBFUN int xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, int options)
 
XMLPUBFUN void xmlCtxtSetMaxAmplification (xmlParserCtxtPtr ctxt, unsigned maxAmpl)
 
XMLPUBFUN xmlDocPtr xmlReadDoc (const xmlChar *cur, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlReadFile (const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlReadMemory (const char *buffer, int size, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlReadFd (int fd, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlReadIO (xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, const xmlChar *cur, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlCtxtReadFile (xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlCtxtReadFd (xmlParserCtxtPtr ctxt, int fd, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr xmlCtxtReadIO (xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
 
XMLPUBFUN int xmlHasFeature (xmlFeature feature)
 

Macro Definition Documentation

◆ XML_COMPLETE_ATTRS

#define XML_COMPLETE_ATTRS   4

XML_COMPLETE_ATTRS:

Bit in the loadsubset context field to tell to do complete the elements attributes lists with the ones defaulted from the DTDs. Use it to initialize xmlLoadExtDtdDefaultValue.

Definition at line 152 of file parser.h.

◆ XML_DEFAULT_VERSION

#define XML_DEFAULT_VERSION   "1.0"

XML_DEFAULT_VERSION:

The default version of XML used: 1.0

Definition at line 39 of file parser.h.

◆ XML_DETECT_IDS

#define XML_DETECT_IDS   2

XML_DETECT_IDS:

Bit in the loadsubset context field to tell to do ID/REFs lookups. Use it to initialize xmlLoadExtDtdDefaultValue.

Definition at line 143 of file parser.h.

◆ XML_GLOBALS_PARSER

#define XML_GLOBALS_PARSER
Value:
XML_GLOBALS_PARSER_CORE \
XML_GLOBALS_PARSER_OUTPUT \
XML_GLOBALS_PARSER_SAX1

Definition at line 880 of file parser.h.

◆ XML_GLOBALS_PARSER_CORE

#define XML_GLOBALS_PARSER_CORE
Value:
XML_OP(xmlDefaultSAXLocator, xmlSAXLocator, XML_DEPRECATED) \
int xmlSubstituteEntitiesDefaultValue
Definition: globals.c:356
int xmlParserDebugEntities
Definition: globals.c:277
int oldXMLWDcompatibility
Definition: globals.c:267
int xmlLoadExtDtdDefaultValue
Definition: globals.c:308
xmlSAXLocator xmlDefaultSAXLocator
Definition: globals.c:503
int xmlDoValidityCheckingDefaultValue
Definition: globals.c:287
int xmlKeepBlanksDefaultValue
Definition: globals.c:343
int xmlPedanticParserDefaultValue
Definition: globals.c:318
int xmlGetWarningsDefaultValue
Definition: globals.c:297
int xmlLineNumbersDefaultValue
Definition: globals.c:330
#define XML_OP
Definition: parser.h:885
#define XML_DEPRECATED
Definition: xmlversion.h:475

DOC_DISABLE

Definition at line 852 of file parser.h.

◆ XML_GLOBALS_PARSER_OUTPUT

#define XML_GLOBALS_PARSER_OUTPUT

Definition at line 870 of file parser.h.

◆ XML_GLOBALS_PARSER_SAX1

#define XML_GLOBALS_PARSER_SAX1

Definition at line 877 of file parser.h.

◆ XML_OP

#define XML_OP   XML_DECLARE_GLOBAL

Definition at line 885 of file parser.h.

◆ XML_SAX2_MAGIC

#define XML_SAX2_MAGIC   0xDEEDBEAF

XML_SAX2_MAGIC:

Special constant found in SAX2 blocks initialized fields

Definition at line 687 of file parser.h.

◆ XML_SKIP_IDS

#define XML_SKIP_IDS   8

XML_SKIP_IDS:

Bit in the loadsubset context field to tell to not do ID/REFs registration. Used to initialize xmlLoadExtDtdDefaultValue in some special cases.

Definition at line 160 of file parser.h.

◆ XML_TREE_INTERNALS

#define XML_TREE_INTERNALS

Definition at line 14 of file parser.h.

Typedef Documentation

◆ attributeDeclSAXFunc

typedef void(* attributeDeclSAXFunc) (void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree)

Definition at line 459 of file parser.h.

◆ attributeSAXFunc

typedef void(* attributeSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *value)

Definition at line 549 of file parser.h.

◆ cdataBlockSAXFunc

typedef void(* cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len)

cdataBlockSAXFunc: @ctx: the user data (XML parser context) @value: The pcdata content @len: the block length

Called when a pcdata block has been parsed.

Definition at line 612 of file parser.h.

◆ charactersSAXFunc

typedef void(* charactersSAXFunc) (void *ctx, const xmlChar *ch, int len)

charactersSAXFunc: @ctx: the user data (XML parser context) @ch: a xmlChar string @len: the number of xmlChar

Receiving some chars from the parser.

Definition at line 569 of file parser.h.

◆ commentSAXFunc

typedef void(* commentSAXFunc) (void *ctx, const xmlChar *value)

commentSAXFunc: @ctx: the user data (XML parser context) @value: the comment content

A comment has been parsed.

Definition at line 602 of file parser.h.

◆ elementDeclSAXFunc

typedef void(* elementDeclSAXFunc) (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content)

Definition at line 475 of file parser.h.

◆ endDocumentSAXFunc

typedef void(* endDocumentSAXFunc) (void *ctx)

endDocumentSAXFunc: @ctx: the user data (XML parser context)

Called when the document end has been detected.

Definition at line 517 of file parser.h.

◆ endElementNsSAX2Func

typedef void(* endElementNsSAX2Func) (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)

endElementNsSAX2Func: @ctx: the user data (XML parser context) @localname: the local name of the element @prefix: the element namespace prefix if available @URI: the element namespace name if available

SAX2 callback when an element end has been detected by the parser. It provides the namespace information for the element.

Definition at line 729 of file parser.h.

◆ endElementSAXFunc

typedef void(* endElementSAXFunc) (void *ctx, const xmlChar *name)

Definition at line 536 of file parser.h.

◆ entityDeclSAXFunc

typedef void(* entityDeclSAXFunc) (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)

Definition at line 428 of file parser.h.

◆ errorSAXFunc

typedef void(*) typedef void(* errorSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2

errorSAXFunc: @ctx: an XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format an error messages, callback.

Definition at line 634 of file parser.h.

◆ externalSubsetSAXFunc

typedef void(* externalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)

Definition at line 391 of file parser.h.

◆ fatalErrorSAXFunc

typedef void(*) typedef void(*) typedef void(* fatalErrorSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2

fatalErrorSAXFunc: @ctx: an XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format fatal error messages, callback. Note: so far fatalError() SAX callbacks are not used, error() get all the callbacks for errors.

Definition at line 646 of file parser.h.

◆ getEntitySAXFunc

typedef xmlEntityPtr(* getEntitySAXFunc) (void *ctx, const xmlChar *name)

Definition at line 404 of file parser.h.

◆ getParameterEntitySAXFunc

typedef xmlEntityPtr(* getParameterEntitySAXFunc) (void *ctx, const xmlChar *name)

Definition at line 415 of file parser.h.

◆ hasExternalSubsetSAXFunc

typedef int(* hasExternalSubsetSAXFunc) (void *ctx)

hasExternalSubsetSAXFunc: @ctx: the user data (XML parser context)

Does this document has an external subset?

Returns 1 if true

Definition at line 675 of file parser.h.

◆ hasInternalSubsetSAXFunc

typedef int(* hasInternalSubsetSAXFunc) (void *ctx)

hasInternalSubsetSAXFunc: @ctx: the user data (XML parser context)

Does this document has an internal subset.

Returns 1 if true

Definition at line 665 of file parser.h.

◆ ignorableWhitespaceSAXFunc

typedef void(* ignorableWhitespaceSAXFunc) (void *ctx, const xmlChar *ch, int len)

ignorableWhitespaceSAXFunc: @ctx: the user data (XML parser context) @ch: a xmlChar string @len: the number of xmlChar

Receiving some ignorable whitespaces from the parser. UNUSED: by default the DOM building will use characters.

Definition at line 581 of file parser.h.

◆ internalSubsetSAXFunc

typedef void(* internalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)

Definition at line 378 of file parser.h.

◆ isStandaloneSAXFunc

typedef void(*) typedef void(*) typedef void(*) typedef int(* isStandaloneSAXFunc) (void *ctx)

isStandaloneSAXFunc: @ctx: the user data (XML parser context)

Is this document tagged standalone?

Returns 1 if true

Definition at line 656 of file parser.h.

◆ notationDeclSAXFunc

typedef void(* notationDeclSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)

Definition at line 443 of file parser.h.

◆ processingInstructionSAXFunc

typedef void(* processingInstructionSAXFunc) (void *ctx, const xmlChar *target, const xmlChar *data)

processingInstructionSAXFunc: @ctx: the user data (XML parser context) @target: the target name @data: the PI data's

A processing instruction has been parsed.

Definition at line 592 of file parser.h.

◆ referenceSAXFunc

typedef void(* referenceSAXFunc) (void *ctx, const xmlChar *name)

Definition at line 559 of file parser.h.

◆ resolveEntitySAXFunc

typedef xmlParserInputPtr(* resolveEntitySAXFunc) (void *ctx, const xmlChar *publicId, const xmlChar *systemId)

xmlSAXHandler:

A SAX handler is bunch of callbacks called by the parser when processing of the input generate data or structure information. resolveEntitySAXFunc: @ctx: the user data (XML parser context) @publicId: The public ID of the entity @systemId: The system ID of the entity

Callback: The entity loader, to control the loading of external entities, the application can either:

  • override this resolveEntity() callback in the SAX block
  • or better use the xmlSetExternalEntityLoader() function to set up it's own entity resolution routine

Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.

Definition at line 366 of file parser.h.

◆ setDocumentLocatorSAXFunc

typedef void(* setDocumentLocatorSAXFunc) (void *ctx, xmlSAXLocatorPtr loc)

setDocumentLocatorSAXFunc: @ctx: the user data (XML parser context) @loc: A SAX Locator

Receive the document locator at startup, actually xmlDefaultSAXLocator. Everything is available on the context, so this is useless in our case.

Definition at line 502 of file parser.h.

◆ startDocumentSAXFunc

typedef void(* startDocumentSAXFunc) (void *ctx)

startDocumentSAXFunc: @ctx: the user data (XML parser context)

Called when the document start being processed.

Definition at line 510 of file parser.h.

◆ startElementNsSAX2Func

typedef void(* startElementNsSAX2Func) (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)

startElementNsSAX2Func: @ctx: the user data (XML parser context) @localname: the local name of the element @prefix: the element namespace prefix if available @URI: the element namespace name if available @nb_namespaces: number of namespace definitions on that node @namespaces: pointer to the array of prefix/URI pairs namespace definitions @nb_attributes: the number of attributes on that node @nb_defaulted: the number of defaulted attributes. The defaulted ones are at the end of the array @attributes: pointer to the array of (localname/prefix/URI/value/end) attribute values.

SAX2 callback when an element start has been detected by the parser. It provides the namespace information for the element, as well as the new namespace declarations on the element.

Definition at line 708 of file parser.h.

◆ startElementSAXFunc

typedef void(* startElementSAXFunc) (void *ctx, const xmlChar *name, const xmlChar **atts)

Definition at line 526 of file parser.h.

◆ unparsedEntityDeclSAXFunc

typedef void(* unparsedEntityDeclSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)

Definition at line 489 of file parser.h.

◆ warningSAXFunc

typedef void(* warningSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2

warningSAXFunc: @ctx: an XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a warning messages, callback.

Definition at line 624 of file parser.h.

◆ xmlAttrHashBucket

Definition at line 178 of file parser.h.

◆ xmlExternalEntityLoader

typedef xmlParserInputPtr(* xmlExternalEntityLoader) (const char *URL, const char *ID, xmlParserCtxtPtr context)

xmlExternalEntityLoader: @URL: The System ID of the resource requested @ID: The Public ID of the resource requested @context: the XML parser context

External entity loaders types.

Returns the entity input parser.

Definition at line 837 of file parser.h.

◆ xmlParserInputDeallocate

typedef void(* xmlParserInputDeallocate) (xmlChar *str)

xmlParserInput:

An xmlParserInput is an input flow for the XML processor. Each entity parsed is associated an xmlParserInput (except the few predefined ones). This is the case both for internal entities

  • in which case the flow is already completely in memory - or external entities - in which case we use the buf structure for progressive reading and I18N conversions to the internal UTF-8 format. xmlParserInputDeallocate: @str: the string to deallocate

Callback for freeing some parser input allocations.

Definition at line 58 of file parser.h.

◆ xmlParserNodeInfo

xmlParserNodeInfo:

The parser can be asked to collect Node information, i.e. at what place in the file they were detected. NOTE: This is off by default and not very well tested.

Definition at line 89 of file parser.h.

◆ xmlParserNodeInfoPtr

Definition at line 90 of file parser.h.

◆ xmlParserNodeInfoSeq

Definition at line 101 of file parser.h.

◆ xmlParserNodeInfoSeqPtr

Definition at line 102 of file parser.h.

◆ xmlParserNsData

Definition at line 177 of file parser.h.

◆ xmlSAXHandlerV1

Definition at line 793 of file parser.h.

◆ xmlSAXHandlerV1Ptr

Definition at line 794 of file parser.h.

◆ xmlStartTag

Definition at line 176 of file parser.h.

Enumeration Type Documentation

◆ xmlFeature

xmlFeature:

Used to examine the existence of features that can be enabled or disabled at compile-time. They used to be called XML_FEATURE_xxx but this clashed with Expat

Enumerator
XML_WITH_THREAD 
XML_WITH_TREE 
XML_WITH_OUTPUT 
XML_WITH_PUSH 
XML_WITH_READER 
XML_WITH_PATTERN 
XML_WITH_WRITER 
XML_WITH_SAX1 
XML_WITH_FTP 
XML_WITH_HTTP 
XML_WITH_VALID 
XML_WITH_HTML 
XML_WITH_LEGACY 
XML_WITH_C14N 
XML_WITH_CATALOG 
XML_WITH_XPATH 
XML_WITH_XPTR 
XML_WITH_XINCLUDE 
XML_WITH_ICONV 
XML_WITH_ISO8859X 
XML_WITH_UNICODE 
XML_WITH_REGEXP 
XML_WITH_AUTOMATA 
XML_WITH_EXPR 
XML_WITH_SCHEMAS 
XML_WITH_SCHEMATRON 
XML_WITH_MODULES 
XML_WITH_DEBUG 
XML_WITH_DEBUG_MEM 
XML_WITH_DEBUG_RUN 
XML_WITH_ZLIB 
XML_WITH_ICU 
XML_WITH_LZMA 
XML_WITH_NONE 

Definition at line 1341 of file parser.h.

1341 {
1342 XML_WITH_THREAD = 1,
1343 XML_WITH_TREE = 2,
1344 XML_WITH_OUTPUT = 3,
1345 XML_WITH_PUSH = 4,
1346 XML_WITH_READER = 5,
1347 XML_WITH_PATTERN = 6,
1348 XML_WITH_WRITER = 7,
1349 XML_WITH_SAX1 = 8,
1350 XML_WITH_FTP = 9,
1351 XML_WITH_HTTP = 10,
1352 XML_WITH_VALID = 11,
1353 XML_WITH_HTML = 12,
1354 XML_WITH_LEGACY = 13,
1355 XML_WITH_C14N = 14,
1356 XML_WITH_CATALOG = 15,
1357 XML_WITH_XPATH = 16,
1358 XML_WITH_XPTR = 17,
1359 XML_WITH_XINCLUDE = 18,
1360 XML_WITH_ICONV = 19,
1361 XML_WITH_ISO8859X = 20,
1362 XML_WITH_UNICODE = 21,
1363 XML_WITH_REGEXP = 22,
1364 XML_WITH_AUTOMATA = 23,
1365 XML_WITH_EXPR = 24,
1366 XML_WITH_SCHEMAS = 25,
1368 XML_WITH_MODULES = 27,
1369 XML_WITH_DEBUG = 28,
1370 XML_WITH_DEBUG_MEM = 29,
1371 XML_WITH_DEBUG_RUN = 30,
1372 XML_WITH_ZLIB = 31,
1373 XML_WITH_ICU = 32,
1374 XML_WITH_LZMA = 33,
1375 XML_WITH_NONE = 99999 /* just to be sure of allocation size */
1376} xmlFeature;
xmlFeature
Definition: parser.h:1341
@ XML_WITH_DEBUG
Definition: parser.h:1369
@ XML_WITH_LEGACY
Definition: parser.h:1354
@ XML_WITH_CATALOG
Definition: parser.h:1356
@ XML_WITH_XPATH
Definition: parser.h:1357
@ XML_WITH_TREE
Definition: parser.h:1343
@ XML_WITH_DEBUG_MEM
Definition: parser.h:1370
@ XML_WITH_DEBUG_RUN
Definition: parser.h:1371
@ XML_WITH_XPTR
Definition: parser.h:1358
@ XML_WITH_OUTPUT
Definition: parser.h:1344
@ XML_WITH_EXPR
Definition: parser.h:1365
@ XML_WITH_VALID
Definition: parser.h:1352
@ XML_WITH_THREAD
Definition: parser.h:1342
@ XML_WITH_SCHEMAS
Definition: parser.h:1366
@ XML_WITH_C14N
Definition: parser.h:1355
@ XML_WITH_MODULES
Definition: parser.h:1368
@ XML_WITH_NONE
Definition: parser.h:1375
@ XML_WITH_UNICODE
Definition: parser.h:1362
@ XML_WITH_REGEXP
Definition: parser.h:1363
@ XML_WITH_HTML
Definition: parser.h:1353
@ XML_WITH_LZMA
Definition: parser.h:1374
@ XML_WITH_AUTOMATA
Definition: parser.h:1364
@ XML_WITH_ISO8859X
Definition: parser.h:1361
@ XML_WITH_PUSH
Definition: parser.h:1345
@ XML_WITH_ICONV
Definition: parser.h:1360
@ XML_WITH_ZLIB
Definition: parser.h:1372
@ XML_WITH_SAX1
Definition: parser.h:1349
@ XML_WITH_PATTERN
Definition: parser.h:1347
@ XML_WITH_WRITER
Definition: parser.h:1348
@ XML_WITH_FTP
Definition: parser.h:1350
@ XML_WITH_HTTP
Definition: parser.h:1351
@ XML_WITH_READER
Definition: parser.h:1346
@ XML_WITH_XINCLUDE
Definition: parser.h:1359
@ XML_WITH_SCHEMATRON
Definition: parser.h:1367
@ XML_WITH_ICU
Definition: parser.h:1373

◆ xmlParserInputState

xmlParserInputState:

The parser is now working also as a state based parser. The recursive one use the state info for entities processing.

Enumerator
XML_PARSER_EOF 
XML_PARSER_START 
XML_PARSER_MISC 
XML_PARSER_PI 
XML_PARSER_DTD 
XML_PARSER_PROLOG 
XML_PARSER_COMMENT 
XML_PARSER_START_TAG 
XML_PARSER_CONTENT 
XML_PARSER_CDATA_SECTION 
XML_PARSER_END_TAG 
XML_PARSER_ENTITY_DECL 
XML_PARSER_ENTITY_VALUE 
XML_PARSER_ATTRIBUTE_VALUE 
XML_PARSER_SYSTEM_LITERAL 
XML_PARSER_EPILOG 
XML_PARSER_IGNORE 
XML_PARSER_PUBLIC_LITERAL 
XML_PARSER_XML_DECL 

Definition at line 115 of file parser.h.

115 {
116 XML_PARSER_EOF = -1, /* nothing is to be parsed */
117 XML_PARSER_START = 0, /* nothing has been parsed */
118 XML_PARSER_MISC, /* Misc* before int subset */
119 XML_PARSER_PI, /* Within a processing instruction */
120 XML_PARSER_DTD, /* within some DTD content */
121 XML_PARSER_PROLOG, /* Misc* after internal subset */
122 XML_PARSER_COMMENT, /* within a comment */
123 XML_PARSER_START_TAG, /* within a start tag */
124 XML_PARSER_CONTENT, /* within the content */
125 XML_PARSER_CDATA_SECTION, /* within a CDATA section */
126 XML_PARSER_END_TAG, /* within a closing tag */
127 XML_PARSER_ENTITY_DECL, /* within an entity declaration */
128 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
129 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
130 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
131 XML_PARSER_EPILOG, /* the Misc* after the last end tag */
132 XML_PARSER_IGNORE, /* within an IGNORED section */
133 XML_PARSER_PUBLIC_LITERAL, /* within a PUBLIC value */
134 XML_PARSER_XML_DECL /* before XML decl (but after BOM) */
xmlParserInputState
Definition: parser.h:115
@ XML_PARSER_END_TAG
Definition: parser.h:126
@ XML_PARSER_PROLOG
Definition: parser.h:121
@ XML_PARSER_IGNORE
Definition: parser.h:132
@ XML_PARSER_PUBLIC_LITERAL
Definition: parser.h:133
@ XML_PARSER_PI
Definition: parser.h:119
@ XML_PARSER_SYSTEM_LITERAL
Definition: parser.h:130
@ XML_PARSER_ATTRIBUTE_VALUE
Definition: parser.h:129
@ XML_PARSER_DTD
Definition: parser.h:120
@ XML_PARSER_EOF
Definition: parser.h:116
@ XML_PARSER_START_TAG
Definition: parser.h:123
@ XML_PARSER_CONTENT
Definition: parser.h:124
@ XML_PARSER_ENTITY_VALUE
Definition: parser.h:128
@ XML_PARSER_EPILOG
Definition: parser.h:131
@ XML_PARSER_START
Definition: parser.h:117
@ XML_PARSER_COMMENT
Definition: parser.h:122
@ XML_PARSER_CDATA_SECTION
Definition: parser.h:125
@ XML_PARSER_XML_DECL
Definition: parser.h:134
@ XML_PARSER_MISC
Definition: parser.h:118
@ XML_PARSER_ENTITY_DECL
Definition: parser.h:127

◆ xmlParserMode

xmlParserMode:

A parser can operate in various modes

Enumerator
XML_PARSE_UNKNOWN 
XML_PARSE_DOM 
XML_PARSE_SAX 
XML_PARSE_PUSH_DOM 
XML_PARSE_PUSH_SAX 
XML_PARSE_READER 

Definition at line 167 of file parser.h.

167 {
169 XML_PARSE_DOM = 1,
170 XML_PARSE_SAX = 2,
xmlParserMode
Definition: parser.h:167
@ XML_PARSE_READER
Definition: parser.h:173
@ XML_PARSE_PUSH_SAX
Definition: parser.h:172
@ XML_PARSE_SAX
Definition: parser.h:170
@ XML_PARSE_DOM
Definition: parser.h:169
@ XML_PARSE_PUSH_DOM
Definition: parser.h:171
@ XML_PARSE_UNKNOWN
Definition: parser.h:168

◆ xmlParserOption

xmlParserOption:

This is the set of XML parser options that can be passed down to the xmlReadDoc() and similar calls.

Enumerator
XML_PARSE_RECOVER 
XML_PARSE_NOENT 
XML_PARSE_DTDLOAD 
XML_PARSE_DTDATTR 
XML_PARSE_DTDVALID 
XML_PARSE_NOERROR 
XML_PARSE_NOWARNING 
XML_PARSE_PEDANTIC 
XML_PARSE_NOBLANKS 
XML_PARSE_SAX1 
XML_PARSE_XINCLUDE 
XML_PARSE_NONET 
XML_PARSE_NODICT 
XML_PARSE_NSCLEAN 
XML_PARSE_NOCDATA 
XML_PARSE_NOXINCNODE 
XML_PARSE_COMPACT 
XML_PARSE_OLD10 
XML_PARSE_NOBASEFIX 
XML_PARSE_HUGE 
XML_PARSE_OLDSAX 
XML_PARSE_IGNORE_ENC 
XML_PARSE_BIG_LINES 

Definition at line 1229 of file parser.h.

1229 {
1230 XML_PARSE_RECOVER = 1<<0, /* recover on errors */
1231 XML_PARSE_NOENT = 1<<1, /* substitute entities */
1232 XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */
1233 XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */
1234 XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */
1235 XML_PARSE_NOERROR = 1<<5, /* suppress error reports */
1236 XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */
1237 XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
1238 XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
1239 XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */
1240 XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitution */
1241 XML_PARSE_NONET = 1<<11,/* Forbid network access */
1242 XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */
1243 XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
1244 XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
1245 XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
1246 XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of
1247 the tree allowed afterwards (will possibly
1248 crash if you try to modify the tree) */
1249 XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */
1250 XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
1251 XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */
1252 XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */
1253 XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */
1254 XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */
xmlParserOption
Definition: parser.h:1229
@ XML_PARSE_SAX1
Definition: parser.h:1239
@ XML_PARSE_DTDVALID
Definition: parser.h:1234
@ XML_PARSE_NOWARNING
Definition: parser.h:1236
@ XML_PARSE_NOCDATA
Definition: parser.h:1244
@ XML_PARSE_COMPACT
Definition: parser.h:1246
@ XML_PARSE_NONET
Definition: parser.h:1241
@ XML_PARSE_NOBLANKS
Definition: parser.h:1238
@ XML_PARSE_IGNORE_ENC
Definition: parser.h:1253
@ XML_PARSE_NOBASEFIX
Definition: parser.h:1250
@ XML_PARSE_DTDLOAD
Definition: parser.h:1232
@ XML_PARSE_XINCLUDE
Definition: parser.h:1240
@ XML_PARSE_RECOVER
Definition: parser.h:1230
@ XML_PARSE_HUGE
Definition: parser.h:1251
@ XML_PARSE_NODICT
Definition: parser.h:1242
@ XML_PARSE_BIG_LINES
Definition: parser.h:1254
@ XML_PARSE_DTDATTR
Definition: parser.h:1233
@ XML_PARSE_OLD10
Definition: parser.h:1249
@ XML_PARSE_OLDSAX
Definition: parser.h:1252
@ XML_PARSE_NOERROR
Definition: parser.h:1235
@ XML_PARSE_NOXINCNODE
Definition: parser.h:1245
@ XML_PARSE_NOENT
Definition: parser.h:1231
@ XML_PARSE_PEDANTIC
Definition: parser.h:1237
@ XML_PARSE_NSCLEAN
Definition: parser.h:1243

Function Documentation

◆ xmlByteConsumed()

XMLPUBFUN long xmlByteConsumed ( xmlParserCtxtPtr  ctxt)

◆ xmlCleanupGlobals()

XML_DEPRECATED XMLPUBFUN void xmlCleanupGlobals ( void  )

xmlCleanupGlobals:

DEPRECATED: This function is a no-op. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don't have call cleanup functions at all.

Definition at line 609 of file globals.c.

609 {
610}

◆ xmlCleanupParser()

XMLPUBFUN void xmlCleanupParser ( void  )

xmlCleanupParser:

This function name is somewhat misleading. It does not clean up parser state, it cleans up memory allocated by the library itself. It is a cleanup function for the XML library. It tries to reclaim all related global memory allocated for the library processing. It doesn't deallocate any document related memory. One should call xmlCleanupParser() only when the process has finished using the library and all XML/HTML documents built with it. See also xmlInitParser() which has the opposite function of preparing the library for operations.

WARNING: if your application is multithreaded or has plugin support calling this may crash the application if another thread or a plugin is still using libxml2. It's sometimes very hard to guess if libxml2 is in use in the application, some libraries or plugins may use it without notice. In case of doubt abstain from calling this function or do it just before calling exit() to avoid leak reports from valgrind !

Definition at line 630 of file threads.c.

630 {
632 return;
633
634 /* These functions can call xmlFree. */
635
637#ifdef LIBXML_CATALOG_ENABLED
638 xmlCatalogCleanup();
639#endif
640#ifdef LIBXML_SCHEMAS_ENABLED
641 xmlSchemaCleanupTypes();
642 xmlRelaxNGCleanupTypes();
643#endif
644
645 /* These functions should never call xmlFree. */
646
648#ifdef LIBXML_OUTPUT_ENABLED
649 xmlCleanupOutputCallbacks();
650#endif
651
655 /*
656 * Must come last. On Windows, xmlCleanupGlobalsInternal can call
657 * xmlFree which uses xmlMemMutex in debug mode.
658 */
660
662
665}
void xmlCleanupCharEncodingHandlers(void)
Definition: encoding.c:1490
void xmlCleanupDictInternal(void)
Definition: dict.c:121
void xmlCleanupRandom(void)
Definition: dict.c:932
void xmlCleanupGlobalsInternal(void)
Definition: globals.c:617
XML_HIDDEN void xmlCleanupMemoryInternal(void)
Definition: xmlmemory.c:880
static int xmlParserInitialized
Definition: threads.c:445
static void xmlGlobalInitMutexDestroy(void)
Definition: threads.c:549
static int xmlParserInnerInitialized
Definition: threads.c:446
XML_GLOBALS_IO XMLPUBFUN void xmlCleanupInputCallbacks(void)

Referenced by DllMain(), and xmlInitParser().

◆ xmlClearNodeInfoSeq()

XMLPUBFUN void xmlClearNodeInfoSeq ( xmlParserNodeInfoSeqPtr  seq)

xmlClearNodeInfoSeq: @seq: a node info sequence pointer

DEPRECATED: Don't use.

– Clear (release memory and reinitialize) node info sequence

Definition at line 2210 of file parserInternals.c.

2211{
2212 if (seq == NULL)
2213 return;
2214 if (seq->buffer != NULL)
2215 xmlFree(seq->buffer);
2216 xmlInitNodeInfoSeq(seq);
2217}
#define NULL
Definition: types.h:112
void xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
xmlFreeFunc xmlFree
Definition: globals.c:184
xmlParserNodeInfo * buffer
Definition: parser.h:106

Referenced by xmlClearParserCtxt().

◆ xmlClearParserCtxt()

XMLPUBFUN void xmlClearParserCtxt ( xmlParserCtxtPtr  ctxt)

xmlClearParserCtxt: @ctxt: an XML parser context

Clear (release owned resources) and reinitialize a parser context

Definition at line 2145 of file parserInternals.c.

2146{
2147 if (ctxt==NULL)
2148 return;
2149 xmlClearNodeInfoSeq(&ctxt->node_seq);
2150 xmlCtxtReset(ctxt);
2151}
void xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
XMLPUBFUN void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14372

◆ xmlCreateDocParserCtxt()

XMLPUBFUN xmlParserCtxtPtr xmlCreateDocParserCtxt ( const xmlChar str)

xmlCreateDocParserCtxt: @str: a pointer to an array of xmlChar

Creates a parser context for an XML in-memory document.

Returns the new parser context or NULL

Definition at line 14207 of file parser.c.

14207 {
14208 xmlParserCtxtPtr ctxt;
14209 xmlParserInputPtr input;
14210 xmlParserInputBufferPtr buf;
14211
14212 if (str == NULL)
14213 return(NULL);
14214
14215 ctxt = xmlNewParserCtxt();
14216 if (ctxt == NULL)
14217 return(NULL);
14218
14220 if (buf == NULL) {
14221 xmlFreeParserCtxt(ctxt);
14222 return(NULL);
14223 }
14224
14225 input = xmlNewInputStream(ctxt);
14226 if (input == NULL) {
14228 xmlFreeParserCtxt(ctxt);
14229 return(NULL);
14230 }
14231
14232 input->filename = NULL;
14233 input->buf = buf;
14234 xmlBufResetInput(input->buf->buffer, input);
14235
14236 inputPush(ctxt, input);
14237 return(ctxt);
14238}
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
Definition: buf.c:1019
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLenum GLenum input
Definition: glext.h:9031
XMLPUBFUN xmlParserInputPtr xmlNewInputStream(xmlParserCtxtPtr ctxt)
const WCHAR * str
XMLPUBFUN void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
XMLPUBFUN xmlParserCtxtPtr xmlNewParserCtxt(void)
XML_HIDDEN void xmlParserInputBufferPtr xmlParserInputBufferCreateString(const xmlChar *str)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1897
XMLPUBFUN void xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)

Referenced by xmlParseBalancedChunkMemoryInternal(), and xmlReadDoc().

◆ xmlCreateIOParserCtxt()

XMLPUBFUN xmlParserCtxtPtr xmlCreateIOParserCtxt ( xmlSAXHandlerPtr  sax,
void user_data,
xmlInputReadCallback  ioread,
xmlInputCloseCallback  ioclose,
void ioctx,
xmlCharEncoding  enc 
)

xmlCreateIOParserCtxt: @sax: a SAX handler @user_data: The user data returned on SAX callbacks @ioread: an I/O read function @ioclose: an I/O close function @ioctx: an I/O handler @enc: the charset encoding if known

Create a parser context for using the XML parser with an existing I/O stream

Returns the new parser context or NULL

Definition at line 12333 of file parser.c.

12335 {
12336 xmlParserCtxtPtr ctxt;
12337 xmlParserInputPtr inputStream;
12338 xmlParserInputBufferPtr buf;
12339
12340 if (ioread == NULL) return(NULL);
12341
12342 buf = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, enc);
12343 if (buf == NULL) {
12344 if (ioclose != NULL)
12345 ioclose(ioctx);
12346 return (NULL);
12347 }
12348
12349 ctxt = xmlNewSAXParserCtxt(sax, user_data);
12350 if (ctxt == NULL) {
12352 return(NULL);
12353 }
12354
12355 inputStream = xmlNewIOInputStream(ctxt, buf, enc);
12356 if (inputStream == NULL) {
12357 xmlFreeParserCtxt(ctxt);
12358 return(NULL);
12359 }
12360 inputPush(ctxt, inputStream);
12361
12362 return(ctxt);
12363}
XMLPUBFUN xmlParserCtxtPtr xmlNewSAXParserCtxt(const xmlSAXHandler *sax, void *userData)
XMLPUBFUN xmlParserInputPtr xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
XMLPUBFUN xmlParserInputBufferPtr xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)

◆ xmlCtxtReadDoc()

XMLPUBFUN xmlDocPtr xmlCtxtReadDoc ( xmlParserCtxtPtr  ctxt,
const xmlChar str,
const char URL,
const char encoding,
int  options 
)

xmlCtxtReadDoc: @ctxt: an XML parser context @str: a pointer to a zero terminated string @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML in-memory document and build a tree. This reuses the existing @ctxt parser context

Returns the resulting document tree

Definition at line 14950 of file parser.c.

14952{
14953 xmlParserInputBufferPtr input;
14954 xmlParserInputPtr stream;
14955
14956 if (ctxt == NULL)
14957 return (NULL);
14958 if (str == NULL)
14959 return (NULL);
14960 xmlInitParser();
14961
14962 xmlCtxtReset(ctxt);
14963
14965 if (input == NULL) {
14966 return(NULL);
14967 }
14968
14970 if (stream == NULL) {
14972 return(NULL);
14973 }
14974
14975 inputPush(ctxt, stream);
14976 return (xmlDoRead(ctxt, URL, encoding, options, 1));
14977}
@ XML_CHAR_ENCODING_NONE
Definition: encoding.h:67
XML_GLOBALS_PARSER XMLPUBFUN void xmlInitParser(void)
Definition: threads.c:569
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:14735
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14372
Definition: parse.h:23

◆ xmlCtxtReadFd()

XMLPUBFUN xmlDocPtr xmlCtxtReadFd ( xmlParserCtxtPtr  ctxt,
int  fd,
const char URL,
const char encoding,
int  options 
)

xmlCtxtReadFd: @ctxt: an XML parser context @fd: an open file descriptor @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML from a file descriptor and build a tree. This reuses the existing @ctxt parser context NOTE that the file descriptor will not be closed when the reader is closed or reset.

Returns the resulting document tree

Definition at line 15074 of file parser.c.

15076{
15077 xmlParserInputBufferPtr input;
15078 xmlParserInputPtr stream;
15079
15080 if (fd < 0)
15081 return (NULL);
15082 if (ctxt == NULL)
15083 return (NULL);
15084 xmlInitParser();
15085
15086 xmlCtxtReset(ctxt);
15087
15088
15090 if (input == NULL)
15091 return (NULL);
15092 input->closecallback = NULL;
15094 if (stream == NULL) {
15096 return (NULL);
15097 }
15098 inputPush(ctxt, stream);
15099 return (xmlDoRead(ctxt, URL, encoding, options, 1));
15100}
static int fd
Definition: io.c:51
XMLPUBFUN xmlParserInputBufferPtr xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc)

◆ xmlCtxtReadFile()

XMLPUBFUN xmlDocPtr xmlCtxtReadFile ( xmlParserCtxtPtr  ctxt,
const char filename,
const char encoding,
int  options 
)

xmlCtxtReadFile: @ctxt: an XML parser context @filename: a file or URL @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML file from the filesystem or the network. This reuses the existing @ctxt parser context

Returns the resulting document tree

Definition at line 14992 of file parser.c.

14994{
14995 xmlParserInputPtr stream;
14996
14997 if (filename == NULL)
14998 return (NULL);
14999 if (ctxt == NULL)
15000 return (NULL);
15001 xmlInitParser();
15002
15003 xmlCtxtReset(ctxt);
15004
15006 if (stream == NULL) {
15007 return (NULL);
15008 }
15009 inputPush(ctxt, stream);
15010 return (xmlDoRead(ctxt, NULL, encoding, options, 1));
15011}
const char * filename
Definition: ioapi.h:137
XMLPUBFUN xmlParserInputPtr xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)

◆ xmlCtxtReadIO()

XMLPUBFUN xmlDocPtr xmlCtxtReadIO ( xmlParserCtxtPtr  ctxt,
xmlInputReadCallback  ioread,
xmlInputCloseCallback  ioclose,
void ioctx,
const char URL,
const char encoding,
int  options 
)

xmlCtxtReadIO: @ctxt: an XML parser context @ioread: an I/O read function @ioclose: an I/O close function @ioctx: an I/O handler @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML document from I/O functions and source and build a tree. This reuses the existing @ctxt parser context

Returns the resulting document tree

Definition at line 15118 of file parser.c.

15122{
15123 xmlParserInputBufferPtr input;
15124 xmlParserInputPtr stream;
15125
15126 if (ioread == NULL)
15127 return (NULL);
15128 if (ctxt == NULL)
15129 return (NULL);
15130 xmlInitParser();
15131
15132 xmlCtxtReset(ctxt);
15133
15134 input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
15136 if (input == NULL) {
15137 if (ioclose != NULL)
15138 ioclose(ioctx);
15139 return (NULL);
15140 }
15142 if (stream == NULL) {
15144 return (NULL);
15145 }
15146 inputPush(ctxt, stream);
15147 return (xmlDoRead(ctxt, URL, encoding, options, 1));
15148}

◆ xmlCtxtReadMemory()

XMLPUBFUN xmlDocPtr xmlCtxtReadMemory ( xmlParserCtxtPtr  ctxt,
const char buffer,
int  size,
const char URL,
const char encoding,
int  options 
)

xmlCtxtReadMemory: @ctxt: an XML parser context @buffer: a pointer to a char array @size: the size of the array @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML in-memory document and build a tree. This reuses the existing @ctxt parser context

Returns the resulting document tree

Definition at line 15028 of file parser.c.

15030{
15031 xmlParserInputBufferPtr input;
15032 xmlParserInputPtr stream;
15033
15034 if (ctxt == NULL)
15035 return (NULL);
15036 if (buffer == NULL)
15037 return (NULL);
15038 xmlInitParser();
15039
15040 xmlCtxtReset(ctxt);
15041
15044 if (input == NULL) {
15045 return(NULL);
15046 }
15047
15049 if (stream == NULL) {
15051 return(NULL);
15052 }
15053
15054 inputPush(ctxt, stream);
15055 return (xmlDoRead(ctxt, URL, encoding, options, 1));
15056}
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
XMLPUBFUN xmlParserInputBufferPtr xmlParserInputBufferCreateStatic(const char *mem, int size, xmlCharEncoding enc)

◆ xmlCtxtReset()

XMLPUBFUN void xmlCtxtReset ( xmlParserCtxtPtr  ctxt)

xmlCtxtReset: @ctxt: an XML parser context

Reset a parser context

Definition at line 14372 of file parser.c.

14373{
14374 xmlParserInputPtr input;
14375 xmlDictPtr dict;
14376
14377 if (ctxt == NULL)
14378 return;
14379
14380 dict = ctxt->dict;
14381
14382 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
14384 }
14385 ctxt->inputNr = 0;
14386 ctxt->input = NULL;
14387
14388 ctxt->spaceNr = 0;
14389 if (ctxt->spaceTab != NULL) {
14390 ctxt->spaceTab[0] = -1;
14391 ctxt->space = &ctxt->spaceTab[0];
14392 } else {
14393 ctxt->space = NULL;
14394 }
14395
14396
14397 ctxt->nodeNr = 0;
14398 ctxt->node = NULL;
14399
14400 ctxt->nameNr = 0;
14401 ctxt->name = NULL;
14402
14403 ctxt->nsNr = 0;
14404 xmlParserNsReset(ctxt->nsdb);
14405
14406 DICT_FREE(ctxt->version);
14407 ctxt->version = NULL;
14408 DICT_FREE(ctxt->encoding);
14409 ctxt->encoding = NULL;
14410 DICT_FREE(ctxt->directory);
14411 ctxt->directory = NULL;
14412 DICT_FREE(ctxt->extSubURI);
14413 ctxt->extSubURI = NULL;
14414 DICT_FREE(ctxt->extSubSystem);
14415 ctxt->extSubSystem = NULL;
14416 if (ctxt->myDoc != NULL)
14417 xmlFreeDoc(ctxt->myDoc);
14418 ctxt->myDoc = NULL;
14419
14420 ctxt->standalone = -1;
14421 ctxt->hasExternalSubset = 0;
14422 ctxt->hasPErefs = 0;
14423 ctxt->html = 0;
14424 ctxt->external = 0;
14425 ctxt->instate = XML_PARSER_START;
14426 ctxt->token = 0;
14427
14428 ctxt->wellFormed = 1;
14429 ctxt->nsWellFormed = 1;
14430 ctxt->disableSAX = 0;
14431 ctxt->valid = 1;
14432#if 0
14433 ctxt->vctxt.userData = ctxt;
14434 ctxt->vctxt.error = xmlParserValidityError;
14435 ctxt->vctxt.warning = xmlParserValidityWarning;
14436#endif
14437 ctxt->record_info = 0;
14438 ctxt->checkIndex = 0;
14439 ctxt->endCheckState = 0;
14440 ctxt->inSubset = 0;
14441 ctxt->errNo = XML_ERR_OK;
14442 ctxt->depth = 0;
14443 ctxt->catalogs = NULL;
14444 ctxt->sizeentities = 0;
14445 ctxt->sizeentcopy = 0;
14446 xmlInitNodeInfoSeq(&ctxt->node_seq);
14447
14448 if (ctxt->attsDefault != NULL) {
14449 xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
14450 ctxt->attsDefault = NULL;
14451 }
14452 if (ctxt->attsSpecial != NULL) {
14453 xmlHashFree(ctxt->attsSpecial, NULL);
14454 ctxt->attsSpecial = NULL;
14455 }
14456
14457#ifdef LIBXML_CATALOG_ENABLED
14458 if (ctxt->catalogs != NULL)
14459 xmlCatalogFreeLocal(ctxt->catalogs);
14460#endif
14461 ctxt->nbErrors = 0;
14462 ctxt->nbWarnings = 0;
14463 if (ctxt->lastError.code != XML_ERR_OK)
14464 xmlResetError(&ctxt->lastError);
14465}
XMLPUBFUN void xmlFreeInputStream(xmlParserInputPtr input)
void xmlHashFree(xmlHashTablePtr hash, xmlHashDeallocator dealloc)
Definition: hash.c:229
void xmlHashDefaultDeallocator(void *entry, const xmlChar *key ATTRIBUTE_UNUSED)
Definition: hash.c:603
XMLPUBFUN void xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
#define DICT_FREE(str)
Definition: parser.c:14360
xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1927
static void xmlParserNsReset(xmlParserNsData *nsdb)
Definition: parser.c:1447
Definition: dict.c:59
char * name
Definition: compiler.c:66
XMLPUBFUN void xmlResetError(xmlErrorPtr err)
XMLPUBFUN void XMLPUBFUN void XMLPUBFUN void xmlParserValidityError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
@ XML_ERR_OK
Definition: xmlerror.h:100
XMLPUBFUN void XMLPUBFUN void XMLPUBFUN void XMLPUBFUN void xmlParserValidityWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2

Referenced by xmlClearParserCtxt(), xmlCtxtReadDoc(), xmlCtxtReadFd(), xmlCtxtReadFile(), xmlCtxtReadIO(), xmlCtxtReadMemory(), and xmlCtxtResetPush().

◆ xmlCtxtResetPush()

XMLPUBFUN int xmlCtxtResetPush ( xmlParserCtxtPtr  ctxt,
const char chunk,
int  size,
const char filename,
const char encoding 
)

xmlCtxtResetPush: @ctxt: an XML parser context @chunk: a pointer to an array of chars @size: number of chars in the array @filename: an optional file name or URI @encoding: the document encoding, or NULL

Reset a push parser context

Returns 0 in case of success and 1 in case of error

Definition at line 14480 of file parser.c.

14482{
14483 xmlParserInputPtr inputStream;
14484 xmlParserInputBufferPtr buf;
14485
14486 if (ctxt == NULL)
14487 return(1);
14488
14490 if (buf == NULL)
14491 return(1);
14492
14493 if (ctxt == NULL) {
14495 return(1);
14496 }
14497
14498 xmlCtxtReset(ctxt);
14499
14500 if (filename == NULL) {
14501 ctxt->directory = NULL;
14502 } else {
14503 ctxt->directory = xmlParserGetDirectory(filename);
14504 }
14505
14506 inputStream = xmlNewInputStream(ctxt);
14507 if (inputStream == NULL) {
14509 return(1);
14510 }
14511
14512 if (filename == NULL)
14513 inputStream->filename = NULL;
14514 else
14515 inputStream->filename = (char *)
14516 xmlCanonicPath((const xmlChar *) filename);
14517 inputStream->buf = buf;
14518 xmlBufResetInput(buf->buffer, inputStream);
14519
14520 inputPush(ctxt, inputStream);
14521
14522 if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
14523 (ctxt->input->buf != NULL)) {
14524 size_t pos = ctxt->input->cur - ctxt->input->base;
14525 int res;
14526
14527 res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
14528 xmlBufUpdateInput(ctxt->input->buf->buffer, ctxt->input, pos);
14529 if (res < 0) {
14530 xmlFatalErr(ctxt, ctxt->input->buf->error, NULL);
14531 xmlHaltParser(ctxt);
14532 return(1);
14533 }
14534 }
14535
14536 if (encoding != NULL) {
14538
14539 hdlr = xmlFindCharEncodingHandler(encoding);
14540 if (hdlr != NULL) {
14541 xmlSwitchToEncoding(ctxt, hdlr);
14542 } else {
14543 xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
14544 "Unsupported encoding %s\n", BAD_CAST encoding);
14545 }
14546 }
14547
14548 return(0);
14549}
int xmlBufUpdateInput(xmlBufPtr buf, xmlParserInputPtr input, size_t pos)
Definition: buf.c:1044
xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1677
GLuint res
Definition: glext.h:9613
XMLPUBFUN int xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
XML_HIDDEN void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
XML_HIDDEN void XML_HIDDEN void xmlHaltParser(xmlParserCtxtPtr ctxt)
XMLPUBFUN xmlChar * xmlCanonicPath(const xmlChar *path)
Definition: uri.c:2394
XMLPUBFUN xmlParserInputBufferPtr xmlAllocParserInputBuffer(xmlCharEncoding enc)
XMLPUBFUN char * xmlParserGetDirectory(const char *filename)
XMLPUBFUN int xmlParserInputBufferPush(xmlParserInputBufferPtr in, int len, const char *buf)
@ XML_ERR_UNSUPPORTED_ENCODING
Definition: xmlerror.h:132
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28

◆ xmlCtxtSetMaxAmplification()

XMLPUBFUN void xmlCtxtSetMaxAmplification ( xmlParserCtxtPtr  ctxt,
unsigned  maxAmpl 
)

xmlCtxtSetMaxAmplification: @ctxt: an XML parser context @maxAmpl: maximum amplification factor

To protect against exponential entity expansion ("billion laughs"), the size of serialized output is (roughly) limited to the input size multiplied by this factor. The default value is 5.

When working with documents making heavy use of entity expansion, it can be necessary to increase the value. For security reasons, this should only be considered when processing trusted input.

Definition at line 14717 of file parser.c.

14718{
14719 ctxt->maxAmpl = maxAmpl;
14720}

◆ xmlCtxtUseOptions()

XMLPUBFUN int xmlCtxtUseOptions ( xmlParserCtxtPtr  ctxt,
int  options 
)

xmlCtxtUseOptions: @ctxt: an XML parser context @options: a combination of xmlParserOption

Applies the options to the parser context

Returns 0 in case of success, the set of unknown or unimplemented options in case of error.

Definition at line 14698 of file parser.c.

14699{
14700 return(xmlCtxtUseOptionsInternal(ctxt, options));
14701}
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options)
Definition: parser.c:14564

Referenced by xslt_doc_default_loader(), and xsltDocDefaultLoaderFunc().

◆ xmlFreeParserCtxt()

XMLPUBFUN void xmlFreeParserCtxt ( xmlParserCtxtPtr  ctxt)

xmlFreeParserCtxt: @ctxt: an XML parser context

Free all the memory used by a parser context. However the parsed document in ctxt->myDoc is not freed.

Definition at line 2009 of file parserInternals.c.

2010{
2011 xmlParserInputPtr input;
2012
2013 if (ctxt == NULL) return;
2014
2015 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
2017 }
2018 if (ctxt->spaceTab != NULL) xmlFree(ctxt->spaceTab);
2019 if (ctxt->nameTab != NULL) xmlFree((xmlChar * *)ctxt->nameTab);
2020 if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab);
2021 if (ctxt->nodeInfoTab != NULL) xmlFree(ctxt->nodeInfoTab);
2022 if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab);
2023 if (ctxt->version != NULL) xmlFree((char *) ctxt->version);
2024 if (ctxt->encoding != NULL) xmlFree((char *) ctxt->encoding);
2025 if (ctxt->extSubURI != NULL) xmlFree((char *) ctxt->extSubURI);
2026 if (ctxt->extSubSystem != NULL) xmlFree((char *) ctxt->extSubSystem);
2027#ifdef LIBXML_SAX1_ENABLED
2028 if ((ctxt->sax != NULL) &&
2029 (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler))
2030#else
2031 if (ctxt->sax != NULL)
2032#endif /* LIBXML_SAX1_ENABLED */
2033 xmlFree(ctxt->sax);
2034 if (ctxt->directory != NULL) xmlFree((char *) ctxt->directory);
2035 if (ctxt->vctxt.nodeTab != NULL) xmlFree(ctxt->vctxt.nodeTab);
2036 if (ctxt->atts != NULL) xmlFree((xmlChar * *)ctxt->atts);
2037 if (ctxt->dict != NULL) xmlDictFree(ctxt->dict);
2038 if (ctxt->nsTab != NULL) xmlFree(ctxt->nsTab);
2039 if (ctxt->nsdb != NULL) xmlParserNsFree(ctxt->nsdb);
2040 if (ctxt->attrHash != NULL) xmlFree(ctxt->attrHash);
2041 if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab);
2042 if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs);
2043 if (ctxt->attsDefault != NULL)
2044 xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
2045 if (ctxt->attsSpecial != NULL)
2046 xmlHashFree(ctxt->attsSpecial, NULL);
2047 if (ctxt->freeElems != NULL) {
2048 xmlNodePtr cur, next;
2049
2050 cur = ctxt->freeElems;
2051 while (cur != NULL) {
2052 next = cur->next;
2053 xmlFree(cur);
2054 cur = next;
2055 }
2056 }
2057 if (ctxt->freeAttrs != NULL) {
2058 xmlAttrPtr cur, next;
2059
2060 cur = ctxt->freeAttrs;
2061 while (cur != NULL) {
2062 next = cur->next;
2063 xmlFree(cur);
2064 cur = next;
2065 }
2066 }
2067 /*
2068 * cleanup the error strings
2069 */
2070 if (ctxt->lastError.message != NULL)
2071 xmlFree(ctxt->lastError.message);
2072 if (ctxt->lastError.file != NULL)
2073 xmlFree(ctxt->lastError.file);
2074 if (ctxt->lastError.str1 != NULL)
2075 xmlFree(ctxt->lastError.str1);
2076 if (ctxt->lastError.str2 != NULL)
2077 xmlFree(ctxt->lastError.str2);
2078 if (ctxt->lastError.str3 != NULL)
2079 xmlFree(ctxt->lastError.str3);
2080
2081#ifdef LIBXML_CATALOG_ENABLED
2082 if (ctxt->catalogs != NULL)
2083 xmlCatalogFreeLocal(ctxt->catalogs);
2084#endif
2085 xmlFree(ctxt);
2086}
FxCollectionEntry * cur
void xmlFreeInputStream(xmlParserInputPtr input)
XMLPUBFUN xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1927
static unsigned __int64 next
Definition: rand_nt.c:6
void xmlDictFree(xmlDictPtr dict)
Definition: dict.c:333
XML_HIDDEN void xmlParserNsFree(xmlParserNsData *nsdb)
Definition: parser.c:1431

Referenced by doparse(), internal_parseBuffer(), internal_parseStream(), xmlCreateDocParserCtxt(), xmlCreateEntityParserCtxtInternal(), xmlCreateIOParserCtxt(), xmlCreateMemoryParserCtxt(), xmlCreateURLParserCtxt(), xmlDoRead(), xmlNewSAXParserCtxt(), xmlParseBalancedChunkMemoryInternal(), xmlParseExternalEntityPrivate(), xmlParseInNodeContext(), xmlReadFd(), xmlReadIO(), xslt_doc_default_loader(), and xsltDocDefaultLoaderFunc().

◆ xmlGetExternalEntityLoader()

XMLPUBFUN xmlExternalEntityLoader xmlGetExternalEntityLoader ( void  )

Referenced by link_datatypes(), and schemasInit().

◆ xmlHasFeature()

XMLPUBFUN int xmlHasFeature ( xmlFeature  feature)

xmlHasFeature: @feature: the feature to be examined

Examines if the library has been compiled with a given feature.

Returns a non-zero value if the feature exist, otherwise zero. Returns zero (0) if the feature does not exist or an unknown unknown feature is requested, non-zero otherwise.

Definition at line 640 of file parser.c.

641{
642 switch (feature) {
643 case XML_WITH_THREAD:
644#ifdef LIBXML_THREAD_ENABLED
645 return(1);
646#else
647 return(0);
648#endif
649 case XML_WITH_TREE:
650#ifdef LIBXML_TREE_ENABLED
651 return(1);
652#else
653 return(0);
654#endif
655 case XML_WITH_OUTPUT:
656#ifdef LIBXML_OUTPUT_ENABLED
657 return(1);
658#else
659 return(0);
660#endif
661 case XML_WITH_PUSH:
662#ifdef LIBXML_PUSH_ENABLED
663 return(1);
664#else
665 return(0);
666#endif
667 case XML_WITH_READER:
668#ifdef LIBXML_READER_ENABLED
669 return(1);
670#else
671 return(0);
672#endif
673 case XML_WITH_PATTERN:
674#ifdef LIBXML_PATTERN_ENABLED
675 return(1);
676#else
677 return(0);
678#endif
679 case XML_WITH_WRITER:
680#ifdef LIBXML_WRITER_ENABLED
681 return(1);
682#else
683 return(0);
684#endif
685 case XML_WITH_SAX1:
686#ifdef LIBXML_SAX1_ENABLED
687 return(1);
688#else
689 return(0);
690#endif
691 case XML_WITH_FTP:
692#ifdef LIBXML_FTP_ENABLED
693 return(1);
694#else
695 return(0);
696#endif
697 case XML_WITH_HTTP:
698#ifdef LIBXML_HTTP_ENABLED
699 return(1);
700#else
701 return(0);
702#endif
703 case XML_WITH_VALID:
704#ifdef LIBXML_VALID_ENABLED
705 return(1);
706#else
707 return(0);
708#endif
709 case XML_WITH_HTML:
710#ifdef LIBXML_HTML_ENABLED
711 return(1);
712#else
713 return(0);
714#endif
715 case XML_WITH_LEGACY:
716#ifdef LIBXML_LEGACY_ENABLED
717 return(1);
718#else
719 return(0);
720#endif
721 case XML_WITH_C14N:
722#ifdef LIBXML_C14N_ENABLED
723 return(1);
724#else
725 return(0);
726#endif
727 case XML_WITH_CATALOG:
728#ifdef LIBXML_CATALOG_ENABLED
729 return(1);
730#else
731 return(0);
732#endif
733 case XML_WITH_XPATH:
734#ifdef LIBXML_XPATH_ENABLED
735 return(1);
736#else
737 return(0);
738#endif
739 case XML_WITH_XPTR:
740#ifdef LIBXML_XPTR_ENABLED
741 return(1);
742#else
743 return(0);
744#endif
746#ifdef LIBXML_XINCLUDE_ENABLED
747 return(1);
748#else
749 return(0);
750#endif
751 case XML_WITH_ICONV:
752#ifdef LIBXML_ICONV_ENABLED
753 return(1);
754#else
755 return(0);
756#endif
758#ifdef LIBXML_ISO8859X_ENABLED
759 return(1);
760#else
761 return(0);
762#endif
763 case XML_WITH_UNICODE:
764#ifdef LIBXML_UNICODE_ENABLED
765 return(1);
766#else
767 return(0);
768#endif
769 case XML_WITH_REGEXP:
770#ifdef LIBXML_REGEXP_ENABLED
771 return(1);
772#else
773 return(0);
774#endif
776#ifdef LIBXML_AUTOMATA_ENABLED
777 return(1);
778#else
779 return(0);
780#endif
781 case XML_WITH_EXPR:
782#ifdef LIBXML_EXPR_ENABLED
783 return(1);
784#else
785 return(0);
786#endif
787 case XML_WITH_SCHEMAS:
788#ifdef LIBXML_SCHEMAS_ENABLED
789 return(1);
790#else
791 return(0);
792#endif
794#ifdef LIBXML_SCHEMATRON_ENABLED
795 return(1);
796#else
797 return(0);
798#endif
799 case XML_WITH_MODULES:
800#ifdef LIBXML_MODULES_ENABLED
801 return(1);
802#else
803 return(0);
804#endif
805 case XML_WITH_DEBUG:
806#ifdef LIBXML_DEBUG_ENABLED
807 return(1);
808#else
809 return(0);
810#endif
812#ifdef DEBUG_MEMORY_LOCATION
813 return(1);
814#else
815 return(0);
816#endif
818 return(0);
819 case XML_WITH_ZLIB:
820#ifdef LIBXML_ZLIB_ENABLED
821 return(1);
822#else
823 return(0);
824#endif
825 case XML_WITH_LZMA:
826#ifdef LIBXML_LZMA_ENABLED
827 return(1);
828#else
829 return(0);
830#endif
831 case XML_WITH_ICU:
832#ifdef LIBXML_ICU_ENABLED
833 return(1);
834#else
835 return(0);
836#endif
837 default:
838 break;
839 }
840 return(0);
841}
INTERNETFEATURELIST feature
Definition: misc.c:1719

◆ xmlInitGlobals()

XML_DEPRECATED XMLPUBFUN void xmlInitGlobals ( void  )

xmlInitGlobals:

DEPRECATED: Alias for xmlInitParser.

Definition at line 562 of file globals.c.

562 {
564}

◆ xmlInitNodeInfoSeq()

XMLPUBFUN void xmlInitNodeInfoSeq ( xmlParserNodeInfoSeqPtr  seq)

xmlInitNodeInfoSeq: @seq: a node info sequence pointer

DEPRECATED: Don't use.

– Initialize (set to initial state) node info sequence

Definition at line 2191 of file parserInternals.c.

2192{
2193 if (seq == NULL)
2194 return;
2195 seq->length = 0;
2196 seq->maximum = 0;
2197 seq->buffer = NULL;
2198}
unsigned long length
Definition: parser.h:105
unsigned long maximum
Definition: parser.h:104

Referenced by xmlClearNodeInfoSeq(), xmlCtxtReset(), and xmlInitSAXParserCtxt().

◆ xmlInitParser()

XML_GLOBALS_PARSER XMLPUBFUN void xmlInitParser ( void  )

DOC_ENABLE

xmlInitParser:

Initialization function for the XML parser.

Call once from the main thread before using the library in multithreaded programs.

Definition at line 569 of file threads.c.

569 {
570 /*
571 * Note that the initialization code must not make memory allocations.
572 */
573 if (xmlParserInitialized != 0)
574 return;
575
577
578 if (xmlParserInnerInitialized == 0) {
579#if defined(_WIN32) && \
580 !defined(LIBXML_THREAD_ALLOC_ENABLED) && \
581 (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
582 if (xmlFree == free)
584#endif
585
586 xmlInitMemoryInternal(); /* Should come second */
591#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
593#endif
594
596#ifdef LIBXML_OUTPUT_ENABLED
597 xmlRegisterDefaultOutputCallbacks();
598#endif /* LIBXML_OUTPUT_ENABLED */
599
601 }
602
604
606}
#define free
Definition: debug_ros.c:5
int __cdecl atexit(void(__cdecl *)(void))
Definition: atonexit.c:97
void xmlInitEncodingInternal(void)
Definition: encoding.c:1470
XML_HIDDEN void xmlInitXPathInternal(void)
ATTRIBUTE_NO_SANITIZE_INTEGER void xmlInitRandom(void)
Definition: dict.c:918
void xmlInitDictInternal(void)
Definition: dict.c:99
void xmlInitGlobalsInternal(void)
Definition: globals.c:571
XML_HIDDEN void xmlInitMemoryInternal(void)
Definition: xmlmemory.c:846
static void xmlGlobalInitMutexUnlock(void)
Definition: threads.c:532
void xmlCleanupParser(void)
Definition: threads.c:630
static void xmlGlobalInitMutexLock(void)
Definition: threads.c:462
XMLPUBFUN void xmlRegisterDefaultInputCallbacks(void)

Referenced by DllMain(), xmlCheckVersion(), xmlCtxtReadDoc(), xmlCtxtReadFd(), xmlCtxtReadFile(), xmlCtxtReadIO(), xmlCtxtReadMemory(), xmlDictCreate(), xmlHashCreate(), xmlInitCharEncodingHandlers(), xmlInitGlobals(), xmlInitializeDict(), xmlInitMemory(), xmlInitSAXParserCtxt(), xmlInitThreads(), xmlIsMainThreadInternal(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemStrdupLoc(), xmlParseDocument(), xmlReadDoc(), xmlReadFd(), xmlReadFile(), xmlReadIO(), xmlReadMemory(), and xmlReallocLoc().

◆ xmlInitParserCtxt()

XMLPUBFUN int xmlInitParserCtxt ( xmlParserCtxtPtr  ctxt)

xmlInitParserCtxt: @ctxt: an XML parser context

DEPRECATED: Internal function which will be made private in a future version.

Initialize a parser context

Returns 0 in case of success and -1 in case of error

Definition at line 1995 of file parserInternals.c.

1996{
1997 return(xmlInitSAXParserCtxt(ctxt, NULL, NULL));
1998}
static int xmlInitSAXParserCtxt(xmlParserCtxtPtr ctxt, const xmlSAXHandler *sax, void *userData)

◆ xmlKeepBlanksDefault()

XML_DEPRECATED XMLPUBFUN int xmlKeepBlanksDefault ( int  val)

xmlKeepBlanksDefault: @val: int 0 or 1

DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.

Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn't allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the "empty" nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.

Returns the last value for 0 for no substitution, 1 for substitution.

Definition at line 2426 of file parserInternals.c.

2426 {
2427 int old = xmlKeepBlanksDefaultValue;
2428
2430#ifdef LIBXML_OUTPUT_ENABLED
2431 if (!val)
2432 xmlIndentTreeOutput = 1;
2433#endif
2434 return(old);
2435}
GLuint GLfloat * val
Definition: glext.h:7180

◆ xmlLineNumbersDefault()

XML_DEPRECATED XMLPUBFUN int xmlLineNumbersDefault ( int  val)

xmlLineNumbersDefault: @val: int 0 or 1

DEPRECATED: The modern options API always enables line numbers.

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.

Returns the last value for 0 for no substitution, 1 for substitution.

Definition at line 2368 of file parserInternals.c.

2368 {
2370
2372 return(old);
2373}

◆ xmlLoadExternalEntity()

◆ xmlNewIOInputStream()

XMLPUBFUN xmlParserInputPtr xmlNewIOInputStream ( xmlParserCtxtPtr  ctxt,
xmlParserInputBufferPtr  input,
xmlCharEncoding  enc 
)

xmlNewIOInputStream: @ctxt: an XML parser context @input: an I/O Input @enc: the charset encoding if known

Create a new input stream structure encapsulating the @input into a stream suitable for the parser.

Returns the new input stream or NULL

Definition at line 1581 of file parserInternals.c.

1582 {
1583 xmlParserInputPtr inputStream;
1584
1585 if (input == NULL) return(NULL);
1587 xmlGenericError(xmlGenericErrorContext, "new input from I/O\n");
1588 inputStream = xmlNewInputStream(ctxt);
1589 if (inputStream == NULL) {
1590 return(NULL);
1591 }
1592 inputStream->filename = NULL;
1593 inputStream->buf = input;
1594 xmlBufResetInput(inputStream->buf->buffer, inputStream);
1595
1596 if (enc != XML_CHAR_ENCODING_NONE) {
1597 xmlSwitchEncoding(ctxt, enc);
1598 }
1599
1600 return(inputStream);
1601}
xmlParserInputPtr xmlNewInputStream(xmlParserCtxtPtr ctxt)
int xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
void * xmlGenericErrorContext
Definition: globals.c:410
xmlGenericErrorFunc xmlGenericError
Definition: globals.c:396

Referenced by import_loader_onDataAvailable(), xmlCreateIOParserCtxt(), xmlCtxtReadDoc(), xmlCtxtReadFd(), xmlCtxtReadIO(), xmlCtxtReadMemory(), xmlReadFd(), and xmlReadIO().

◆ xmlNewParserCtxt()

XMLPUBFUN xmlParserCtxtPtr xmlNewParserCtxt ( void  )

xmlNewParserCtxt:

Allocate and initialize a new parser context.

Returns the xmlParserCtxtPtr or NULL

Definition at line 2097 of file parserInternals.c.

2098{
2099 return(xmlNewSAXParserCtxt(NULL, NULL));
2100}
xmlParserCtxtPtr xmlNewSAXParserCtxt(const xmlSAXHandler *sax, void *userData)

Referenced by xmlCreateDocParserCtxt(), xmlCreateMemoryParserCtxt(), xmlCreateURLParserCtxt(), xmlReadFd(), xmlReadIO(), xslt_doc_default_loader(), and xsltDocDefaultLoaderFunc().

◆ xmlNewSAXParserCtxt()

XMLPUBFUN xmlParserCtxtPtr xmlNewSAXParserCtxt ( const xmlSAXHandler *  sax,
void userData 
)

xmlNewSAXParserCtxt: @sax: SAX handler @userData: user data

Allocate and initialize a new SAX parser context. If userData is NULL, the parser context will be passed as user data.

Returns the xmlParserCtxtPtr or NULL if memory allocation failed.

Definition at line 2114 of file parserInternals.c.

2115{
2116 xmlParserCtxtPtr ctxt;
2117
2118 ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
2119 if (ctxt == NULL) {
2120 xmlErrMemory(NULL, "cannot allocate parser context\n");
2121 return(NULL);
2122 }
2123 memset(ctxt, 0, sizeof(xmlParserCtxt));
2124 if (xmlInitSAXParserCtxt(ctxt, sax, userData) < 0) {
2125 xmlFreeParserCtxt(ctxt);
2126 return(NULL);
2127 }
2128 return(ctxt);
2129}
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
xmlMallocFunc xmlMalloc
Definition: globals.c:193
#define memset(x, y, z)
Definition: compat.h:39

Referenced by xmlCreateEntityParserCtxtInternal(), xmlCreateIOParserCtxt(), and xmlNewParserCtxt().

◆ xmlParseCtxtExternalEntity()

XMLPUBFUN int xmlParseCtxtExternalEntity ( xmlParserCtxtPtr  ctx,
const xmlChar URL,
const xmlChar ID,
xmlNodePtr *  lst 
)

xmlParseCtxtExternalEntity: @ctx: the existing parsing context @URL: the URL for the entity to load @ID: the System ID for the entity to load @lst: the return value for the set of parsed nodes

Parse an external general entity within an existing parsing context An external general parsed entity is well-formed if it matches the production labeled extParsedEnt.

[78] extParsedEnt ::= TextDecl? content

Returns 0 if the entity is well formed, -1 in case of args problem and the parser error code otherwise

Definition at line 12621 of file parser.c.

12622 {
12623 void *userData;
12624
12625 if (ctx == NULL) return(-1);
12626 /*
12627 * If the user provided their own SAX callbacks, then reuse the
12628 * userData callback field, otherwise the expected setup in a
12629 * DOM builder is to have userData == ctxt
12630 */
12631 if (ctx->userData == ctx)
12632 userData = NULL;
12633 else
12634 userData = ctx->userData;
12635 return xmlParseExternalEntityPrivate(ctx->myDoc, ctx, ctx->sax,
12636 userData, ctx->depth + 1,
12637 URL, ID, lst);
12638}
#define ID
Definition: ruserpass.c:36
static xmlParserErrors xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, xmlSAXHandlerPtr sax, void *user_data, int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *list)
Definition: parser.c:12658

◆ xmlParseDocument()

XMLPUBFUN int xmlParseDocument ( xmlParserCtxtPtr  ctxt)

xmlParseDocument: @ctxt: an XML parser context

parse an XML document (and build a tree if using the standard SAX interface).

[1] document ::= prolog element Misc*

[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?

Returns 0, -1 in case of error. the parser context is augmented as a result of the parsing.

Definition at line 11009 of file parser.c.

11009 {
11010 xmlInitParser();
11011
11012 if ((ctxt == NULL) || (ctxt->input == NULL))
11013 return(-1);
11014
11015 GROW;
11016
11017 /*
11018 * SAX: detecting the level.
11019 */
11020 xmlDetectSAX2(ctxt);
11021
11022 /*
11023 * SAX: beginning of the document processing.
11024 */
11025 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
11026 ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
11027 if (ctxt->instate == XML_PARSER_EOF)
11028 return(-1);
11029
11030 xmlDetectEncoding(ctxt);
11031
11032 if (CUR == 0) {
11034 return(-1);
11035 }
11036
11037 GROW;
11038 if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
11039
11040 /*
11041 * Note that we will switch encoding on the fly.
11042 */
11043 xmlParseXMLDecl(ctxt);
11044 if ((ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) ||
11045 (ctxt->instate == XML_PARSER_EOF)) {
11046 /*
11047 * The XML REC instructs us to stop parsing right here
11048 */
11049 return(-1);
11050 }
11052 } else {
11053 ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
11054 }
11055 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
11056 ctxt->sax->startDocument(ctxt->userData);
11057 if (ctxt->instate == XML_PARSER_EOF)
11058 return(-1);
11059 if ((ctxt->myDoc != NULL) && (ctxt->input != NULL) &&
11060 (ctxt->input->buf != NULL) && (ctxt->input->buf->compressed >= 0)) {
11061 ctxt->myDoc->compression = ctxt->input->buf->compressed;
11062 }
11063
11064 /*
11065 * The Misc part of the Prolog
11066 */
11067 xmlParseMisc(ctxt);
11068
11069 /*
11070 * Then possibly doc type declaration(s) and more Misc
11071 * (doctypedecl Misc*)?
11072 */
11073 GROW;
11074 if (CMP9(CUR_PTR, '<', '!', 'D', 'O', 'C', 'T', 'Y', 'P', 'E')) {
11075
11076 ctxt->inSubset = 1;
11077 xmlParseDocTypeDecl(ctxt);
11078 if (RAW == '[') {
11079 ctxt->instate = XML_PARSER_DTD;
11081 if (ctxt->instate == XML_PARSER_EOF)
11082 return(-1);
11083 }
11084
11085 /*
11086 * Create and update the external subset.
11087 */
11088 ctxt->inSubset = 2;
11089 if ((ctxt->sax != NULL) && (ctxt->sax->externalSubset != NULL) &&
11090 (!ctxt->disableSAX))
11091 ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName,
11092 ctxt->extSubSystem, ctxt->extSubURI);
11093 if (ctxt->instate == XML_PARSER_EOF)
11094 return(-1);
11095 ctxt->inSubset = 0;
11096
11097 xmlCleanSpecialAttr(ctxt);
11098
11099 ctxt->instate = XML_PARSER_PROLOG;
11100 xmlParseMisc(ctxt);
11101 }
11102
11103 /*
11104 * Time to start parsing the tree itself
11105 */
11106 GROW;
11107 if (RAW != '<') {
11108 xmlFatalErrMsg(ctxt, XML_ERR_DOCUMENT_EMPTY,
11109 "Start tag expected, '<' not found\n");
11110 } else {
11111 ctxt->instate = XML_PARSER_CONTENT;
11112 xmlParseElement(ctxt);
11113 ctxt->instate = XML_PARSER_EPILOG;
11114
11115
11116 /*
11117 * The Misc part at the end
11118 */
11119 xmlParseMisc(ctxt);
11120
11121 if (ctxt->input->cur < ctxt->input->end) {
11122 if (ctxt->errNo == XML_ERR_OK)
11124 } else if ((ctxt->input->buf != NULL) &&
11125 (ctxt->input->buf->encoder != NULL) &&
11126 (!xmlBufIsEmpty(ctxt->input->buf->raw))) {
11127 xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR,
11128 "Truncated multi-byte sequence at EOF\n");
11129 }
11130 ctxt->instate = XML_PARSER_EOF;
11131 }
11132
11133 /*
11134 * SAX: end of the document processing.
11135 */
11136 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
11137 ctxt->sax->endDocument(ctxt->userData);
11138
11139 /*
11140 * Remove locally kept entity definitions if the tree was not built
11141 */
11142 if ((ctxt->myDoc != NULL) &&
11143 (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE))) {
11144 xmlFreeDoc(ctxt->myDoc);
11145 ctxt->myDoc = NULL;
11146 }
11147
11148 if ((ctxt->wellFormed) && (ctxt->myDoc != NULL)) {
11149 ctxt->myDoc->properties |= XML_DOC_WELLFORMED;
11150 if (ctxt->valid)
11151 ctxt->myDoc->properties |= XML_DOC_DTDVALID;
11152 if (ctxt->nsWellFormed)
11153 ctxt->myDoc->properties |= XML_DOC_NSVALID;
11154 if (ctxt->options & XML_PARSE_OLD10)
11155 ctxt->myDoc->properties |= XML_DOC_OLD10;
11156 }
11157 if (! ctxt->wellFormed) {
11158 ctxt->valid = 0;
11159 return(-1);
11160 }
11161 return(0);
11162}
int xmlBufIsEmpty(const xmlBufPtr buf)
Definition: buf.c:610
#define IS_BLANK_CH(c)
#define XML_DEFAULT_VERSION
Definition: parser.h:39
XML_HIDDEN void xmlDetectEncoding(xmlParserCtxtPtr ctxt)
void xmlParseElement(xmlParserCtxtPtr ctxt)
Definition: parser.c:10327
void xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt)
Definition: parser.c:8466
static void xmlParseInternalSubset(xmlParserCtxtPtr ctxt)
Definition: parser.c:8538
#define SKIP_BLANKS
Definition: parser.c:2278
#define CMP5(s, c1, c2, c3, c4, c5)
Definition: parser.c:2235
void xmlParseMisc(xmlParserCtxtPtr ctxt)
Definition: parser.c:10979
static void xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt)
Definition: parser.c:1186
#define RAW
Definition: parser.c:2226
#define GROW
Definition: parser.c:2275
#define CMP9(s, c1, c2, c3, c4, c5, c6, c7, c8, c9)
Definition: parser.c:2243
static void xmlDetectSAX2(xmlParserCtxtPtr ctxt)
Definition: parser.c:856
#define SAX_COMPAT_MODE
Definition: parser.c:168
#define NXT(val)
Definition: parser.c:2228
#define CUR_PTR
Definition: parser.c:2229
#define CUR
Definition: parser.c:2227
void xmlParseXMLDecl(xmlParserCtxtPtr ctxt)
Definition: parser.c:10856
@ XML_ERR_DOCUMENT_END
Definition: xmlerror.h:105
@ XML_ERR_INVALID_CHAR
Definition: xmlerror.h:109
@ XML_ERR_DOCUMENT_EMPTY
Definition: xmlerror.h:104
XMLPUBFUN xmlChar * xmlCharStrdup(const char *cur)
Definition: xmlstring.c:116
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:162

Referenced by doparse(), internal_parseBuffer(), xmlDoRead(), xslt_doc_default_loader(), and xsltDocDefaultLoaderFunc().

◆ xmlParseExtParsedEnt()

XMLPUBFUN int xmlParseExtParsedEnt ( xmlParserCtxtPtr  ctxt)

xmlParseExtParsedEnt: @ctxt: an XML parser context

parse a general parsed entity An external general parsed entity is well-formed if it matches the production labeled extParsedEnt.

[78] extParsedEnt ::= TextDecl? content

Returns 0, -1 in case of error. the parser context is augmented as a result of the parsing.

Definition at line 11179 of file parser.c.

11179 {
11180 if ((ctxt == NULL) || (ctxt->input == NULL))
11181 return(-1);
11182
11183 xmlDetectSAX2(ctxt);
11184
11185 /*
11186 * SAX: beginning of the document processing.
11187 */
11188 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
11189 ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
11190
11191 xmlDetectEncoding(ctxt);
11192
11193 if (CUR == 0) {
11195 }
11196
11197 /*
11198 * Check for the XMLDecl in the Prolog.
11199 */
11200 GROW;
11201 if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
11202
11203 /*
11204 * Note that we will switch encoding on the fly.
11205 */
11206 xmlParseXMLDecl(ctxt);
11207 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
11208 /*
11209 * The XML REC instructs us to stop parsing right here
11210 */
11211 return(-1);
11212 }
11214 } else {
11215 ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
11216 }
11217 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
11218 ctxt->sax->startDocument(ctxt->userData);
11219 if (ctxt->instate == XML_PARSER_EOF)
11220 return(-1);
11221
11222 /*
11223 * Doing validity checking on chunk doesn't make sense
11224 */
11225 ctxt->instate = XML_PARSER_CONTENT;
11226 ctxt->validate = 0;
11227 ctxt->loadsubset = 0;
11228 ctxt->depth = 0;
11229
11230 xmlParseContent(ctxt);
11231 if (ctxt->instate == XML_PARSER_EOF)
11232 return(-1);
11233
11234 if ((RAW == '<') && (NXT(1) == '/')) {
11236 } else if (RAW != 0) {
11238 }
11239
11240 /*
11241 * SAX: end of the document processing.
11242 */
11243 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
11244 ctxt->sax->endDocument(ctxt->userData);
11245
11246 if (! ctxt->wellFormed) return(-1);
11247 return(0);
11248}
void xmlParseContent(xmlParserCtxtPtr ctxt)
Definition: parser.c:10294
@ XML_ERR_NOT_WELL_BALANCED
Definition: xmlerror.h:185
@ XML_ERR_EXTRA_CONTENT
Definition: xmlerror.h:186

◆ xmlParseInNodeContext()

XMLPUBFUN xmlParserErrors xmlParseInNodeContext ( xmlNodePtr  node,
const char data,
int  datalen,
int  options,
xmlNodePtr *  lst 
)

xmlParseInNodeContext: @node: the context node @data: the input string @datalen: the input string length in bytes @options: a combination of xmlParserOption @lst: the return value for the set of parsed nodes

Parse a well-balanced chunk of an XML document within the context (DTD, namespaces, etc ...) of the given node.

The allowed sequence for the data is a Well Balanced Chunk defined by the content production in the XML grammar:

[43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*

Returns XML_ERR_OK if the chunk is well balanced, and the parser error code otherwise

Definition at line 13156 of file parser.c.

13157 {
13158 xmlParserCtxtPtr ctxt;
13159 xmlDocPtr doc = NULL;
13160 xmlNodePtr fake, cur;
13161 int nsnr = 0;
13162
13164
13165 /*
13166 * check all input parameters, grab the document
13167 */
13168 if ((lst == NULL) || (node == NULL) || (data == NULL) || (datalen < 0))
13169 return(XML_ERR_INTERNAL_ERROR);
13170 switch (node->type) {
13171 case XML_ELEMENT_NODE:
13172 case XML_ATTRIBUTE_NODE:
13173 case XML_TEXT_NODE:
13174 case XML_CDATA_SECTION_NODE:
13175 case XML_ENTITY_REF_NODE:
13176 case XML_PI_NODE:
13177 case XML_COMMENT_NODE:
13178 case XML_DOCUMENT_NODE:
13179 case XML_HTML_DOCUMENT_NODE:
13180 break;
13181 default:
13182 return(XML_ERR_INTERNAL_ERROR);
13183
13184 }
13185 while ((node != NULL) && (node->type != XML_ELEMENT_NODE) &&
13186 (node->type != XML_DOCUMENT_NODE) &&
13187 (node->type != XML_HTML_DOCUMENT_NODE))
13188 node = node->parent;
13189 if (node == NULL)
13190 return(XML_ERR_INTERNAL_ERROR);
13191 if (node->type == XML_ELEMENT_NODE)
13192 doc = node->doc;
13193 else
13194 doc = (xmlDocPtr) node;
13195 if (doc == NULL)
13196 return(XML_ERR_INTERNAL_ERROR);
13197
13198 /*
13199 * allocate a context and set-up everything not related to the
13200 * node position in the tree
13201 */
13202 if (doc->type == XML_DOCUMENT_NODE)
13203 ctxt = xmlCreateMemoryParserCtxt((char *) data, datalen);
13204#ifdef LIBXML_HTML_ENABLED
13205 else if (doc->type == XML_HTML_DOCUMENT_NODE) {
13206 ctxt = htmlCreateMemoryParserCtxt((char *) data, datalen);
13207 /*
13208 * When parsing in context, it makes no sense to add implied
13209 * elements like html/body/etc...
13210 */
13211 options |= HTML_PARSE_NOIMPLIED;
13212 }
13213#endif
13214 else
13215 return(XML_ERR_INTERNAL_ERROR);
13216
13217 if (ctxt == NULL)
13218 return(XML_ERR_NO_MEMORY);
13219
13220 /*
13221 * Use input doc's dict if present, else assure XML_PARSE_NODICT is set.
13222 * We need a dictionary for xmlDetectSAX2, so if there's no doc dict
13223 * we must wait until the last moment to free the original one.
13224 */
13225 if (doc->dict != NULL) {
13226 if (ctxt->dict != NULL)
13227 xmlDictFree(ctxt->dict);
13228 ctxt->dict = doc->dict;
13229 } else
13231
13232 if (doc->encoding != NULL) {
13234
13235 hdlr = xmlFindCharEncodingHandler((const char *) doc->encoding);
13236 if (hdlr != NULL) {
13237 xmlSwitchToEncoding(ctxt, hdlr);
13238 } else {
13240 }
13241 }
13242
13244 xmlDetectSAX2(ctxt);
13245 ctxt->myDoc = doc;
13246 /* parsing in context, i.e. as within existing content */
13247 ctxt->input_id = 2;
13248 ctxt->instate = XML_PARSER_CONTENT;
13249
13250 fake = xmlNewDocComment(node->doc, NULL);
13251 if (fake == NULL) {
13252 xmlFreeParserCtxt(ctxt);
13253 return(XML_ERR_NO_MEMORY);
13254 }
13255 xmlAddChild(node, fake);
13256
13257 if (node->type == XML_ELEMENT_NODE)
13258 nodePush(ctxt, node);
13259
13260 if ((ctxt->html == 0) && (node->type == XML_ELEMENT_NODE)) {
13261 /*
13262 * initialize the SAX2 namespaces stack
13263 */
13264 cur = node;
13265 while ((cur != NULL) && (cur->type == XML_ELEMENT_NODE)) {
13266 xmlNsPtr ns = cur->nsDef;
13267 xmlHashedString hprefix, huri;
13268
13269 while (ns != NULL) {
13270 hprefix = xmlDictLookupHashed(ctxt->dict, ns->prefix, -1);
13271 huri = xmlDictLookupHashed(ctxt->dict, ns->href, -1);
13272 if (xmlParserNsPush(ctxt, &hprefix, &huri, ns, 1) > 0)
13273 nsnr++;
13274 ns = ns->next;
13275 }
13276 cur = cur->parent;
13277 }
13278 }
13279
13280 if ((ctxt->validate) || (ctxt->replaceEntities != 0)) {
13281 /*
13282 * ID/IDREF registration will be done in xmlValidateElement below
13283 */
13284 ctxt->loadsubset |= XML_SKIP_IDS;
13285 }
13286
13287#ifdef LIBXML_HTML_ENABLED
13288 if (doc->type == XML_HTML_DOCUMENT_NODE)
13289 __htmlParseContent(ctxt);
13290 else
13291#endif
13292 xmlParseContent(ctxt);
13293
13294 xmlParserNsPop(ctxt, nsnr);
13295 if ((RAW == '<') && (NXT(1) == '/')) {
13297 } else if (RAW != 0) {
13299 }
13300 if ((ctxt->node != NULL) && (ctxt->node != node)) {
13302 ctxt->wellFormed = 0;
13303 }
13304
13305 if (!ctxt->wellFormed) {
13306 if (ctxt->errNo == 0)
13308 else
13309 ret = (xmlParserErrors)ctxt->errNo;
13310 } else {
13311 ret = XML_ERR_OK;
13312 }
13313
13314 /*
13315 * Return the newly created nodeset after unlinking it from
13316 * the pseudo sibling.
13317 */
13318
13319 cur = fake->next;
13320 fake->next = NULL;
13321 node->last = fake;
13322
13323 if (cur != NULL) {
13324 cur->prev = NULL;
13325 }
13326
13327 *lst = cur;
13328
13329 while (cur != NULL) {
13330 cur->parent = NULL;
13331 cur = cur->next;
13332 }
13333
13334 xmlUnlinkNode(fake);
13335 xmlFreeNode(fake);
13336
13337
13338 if (ret != XML_ERR_OK) {
13339 xmlFreeNodeList(*lst);
13340 *lst = NULL;
13341 }
13342
13343 if (doc->dict != NULL)
13344 ctxt->dict = NULL;
13345 xmlFreeParserCtxt(ctxt);
13346
13347 return(ret);
13348}
return ret
Definition: mutex.c:146
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1031
xmlHashedString xmlDictLookupHashed(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:845
#define XML_SKIP_IDS
Definition: parser.h:160
static int xmlParserNsPush(xmlParserCtxtPtr ctxt, const xmlHashedString *prefix, const xmlHashedString *uri, void *saxData, int defAttr)
Definition: parser.c:1672
static int xmlParserNsPop(xmlParserCtxtPtr ctxt, int nr)
Definition: parser.c:1829
int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value)
Definition: parser.c:1956
xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size)
Definition: parser.c:13996
Definition: mxnamespace.c:38
BSTR prefix
Definition: mxnamespace.c:39
Definition: dlist.c:348
xmlParserErrors
Definition: xmlerror.h:99
@ XML_ERR_INTERNAL_ERROR
Definition: xmlerror.h:101
@ XML_ERR_NO_MEMORY
Definition: xmlerror.h:102

◆ xmlParserAddNodeInfo()

XMLPUBFUN void xmlParserAddNodeInfo ( xmlParserCtxtPtr  ctxt,
const xmlParserNodeInfoPtr  info 
)

xmlParserAddNodeInfo: @ctxt: an XML parser context @info: a node info sequence pointer

DEPRECATED: Don't use.

Insert node info record into the sorted sequence

Definition at line 2273 of file parserInternals.c.

2275{
2276 unsigned long pos;
2277
2278 if ((ctxt == NULL) || (info == NULL)) return;
2279
2280 /* Find pos and check to see if node is already in the sequence */
2281 pos = xmlParserFindNodeInfoIndex(&ctxt->node_seq, (xmlNodePtr)
2282 info->node);
2283
2284 if ((pos < ctxt->node_seq.length) &&
2285 (ctxt->node_seq.buffer != NULL) &&
2286 (ctxt->node_seq.buffer[pos].node == info->node)) {
2287 ctxt->node_seq.buffer[pos] = *info;
2288 }
2289
2290 /* Otherwise, we need to add new node to buffer */
2291 else {
2292 if ((ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) ||
2293 (ctxt->node_seq.buffer == NULL)) {
2294 xmlParserNodeInfo *tmp_buffer;
2295 unsigned int byte_size;
2296
2297 if (ctxt->node_seq.maximum == 0)
2298 ctxt->node_seq.maximum = 2;
2299 byte_size = (sizeof(*ctxt->node_seq.buffer) *
2300 (2 * ctxt->node_seq.maximum));
2301
2302 if (ctxt->node_seq.buffer == NULL)
2303 tmp_buffer = (xmlParserNodeInfo *) xmlMalloc(byte_size);
2304 else
2305 tmp_buffer =
2306 (xmlParserNodeInfo *) xmlRealloc(ctxt->node_seq.buffer,
2307 byte_size);
2308
2309 if (tmp_buffer == NULL) {
2310 xmlErrMemory(ctxt, "failed to allocate buffer\n");
2311 return;
2312 }
2313 ctxt->node_seq.buffer = tmp_buffer;
2314 ctxt->node_seq.maximum *= 2;
2315 }
2316
2317 /* If position is not at end, move elements out of the way */
2318 if (pos != ctxt->node_seq.length) {
2319 unsigned long i;
2320
2321 for (i = ctxt->node_seq.length; i > pos; i--)
2322 ctxt->node_seq.buffer[i] = ctxt->node_seq.buffer[i - 1];
2323 }
2324
2325 /* Copy element and increase length */
2326 ctxt->node_seq.buffer[pos] = *info;
2327 ctxt->node_seq.length++;
2328 }
2329}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, const xmlNodePtr node)
xmlReallocFunc xmlRealloc
Definition: globals.c:214

Referenced by xmlParseElementStart().

◆ xmlParserFindNodeInfo()

XMLPUBFUN const xmlParserNodeInfo * xmlParserFindNodeInfo ( const xmlParserCtxtPtr  ctx,
const xmlNodePtr  node 
)

xmlParserFindNodeInfo: @ctx: an XML parser context @node: an XML node within the tree

DEPRECATED: Don't use.

Find the parser node info struct for a given node

Returns an xmlParserNodeInfo block pointer or NULL

Definition at line 2166 of file parserInternals.c.

2167{
2168 unsigned long pos;
2169
2170 if ((ctx == NULL) || (node == NULL))
2171 return (NULL);
2172 /* Find position where node should be at */
2173 pos = xmlParserFindNodeInfoIndex(&ctx->node_seq, node);
2174 if (pos < ctx->node_seq.length
2175 && ctx->node_seq.buffer[pos].node == node)
2176 return &ctx->node_seq.buffer[pos];
2177 else
2178 return NULL;
2179}

Referenced by xmlParseElementEnd().

◆ xmlParserFindNodeInfoIndex()

XMLPUBFUN unsigned long xmlParserFindNodeInfoIndex ( const xmlParserNodeInfoSeqPtr  seq,
const xmlNodePtr  node 
)

xmlParserFindNodeInfoIndex: @seq: a node info sequence pointer @node: an XML node pointer

DEPRECATED: Don't use.

xmlParserFindNodeInfoIndex : Find the index that the info record for the given node is or should be at in a sorted sequence

Returns a long indicating the position of the record

Definition at line 2232 of file parserInternals.c.

2234{
2235 unsigned long upper, lower, middle;
2236 int found = 0;
2237
2238 if ((seq == NULL) || (node == NULL))
2239 return ((unsigned long) -1);
2240
2241 /* Do a binary search for the key */
2242 lower = 1;
2243 upper = seq->length;
2244 middle = 0;
2245 while (lower <= upper && !found) {
2246 middle = lower + (upper - lower) / 2;
2247 if (node == seq->buffer[middle - 1].node)
2248 found = 1;
2249 else if (node < seq->buffer[middle - 1].node)
2250 upper = middle - 1;
2251 else
2252 lower = middle + 1;
2253 }
2254
2255 /* Return position */
2256 if (middle == 0 || seq->buffer[middle - 1].node < node)
2257 return middle;
2258 else
2259 return middle - 1;
2260}
const struct _xmlNode * node
Definition: parser.h:93

Referenced by xmlParserAddNodeInfo(), and xmlParserFindNodeInfo().

◆ xmlParserInputGrow()

XML_DEPRECATED XMLPUBFUN int xmlParserInputGrow ( xmlParserInputPtr  in,
int  len 
)

xmlParserInputGrow: @in: an XML parser input @len: an indicative size for the lookahead

DEPRECATED: Don't use.

This function increase the input for the parser. It tries to preserve pointers to the input buffer, and keep already read data

Returns the amount of char read, or -1 in case of error, 0 indicate the end of this entity

Definition at line 567 of file parserInternals.c.

567 {
568 int ret;
569 size_t indx;
570
571 if ((in == NULL) || (len < 0)) return(-1);
572 if (in->buf == NULL) return(-1);
573 if (in->base == NULL) return(-1);
574 if (in->cur == NULL) return(-1);
575 if (in->buf->buffer == NULL) return(-1);
576
577 /* Don't grow memory buffers. */
578 if ((in->buf->encoder == NULL) && (in->buf->readcallback == NULL))
579 return(0);
580
581 indx = in->cur - in->base;
582 if (xmlBufUse(in->buf->buffer) > (unsigned int) indx + INPUT_CHUNK) {
583 return(0);
584 }
586
587 in->base = xmlBufContent(in->buf->buffer);
588 if (in->base == NULL) {
589 in->base = BAD_CAST "";
590 in->cur = in->base;
591 in->end = in->base;
592 return(-1);
593 }
594 in->cur = in->base + indx;
595 in->end = xmlBufEnd(in->buf->buffer);
596
597 return(ret);
598}
xmlChar * xmlBufEnd(xmlBufPtr buf)
Definition: buf.c:508
xmlChar * xmlBufContent(const xmlBuf *buf)
Definition: buf.c:490
size_t xmlBufUse(const xmlBufPtr buf)
Definition: buf.c:570
GLuint in
Definition: glext.h:9616
GLenum GLsizei len
Definition: glext.h:6722
#define INPUT_CHUNK
XMLPUBFUN int xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len)

◆ xmlParserInputRead()

XML_DEPRECATED XMLPUBFUN int xmlParserInputRead ( xmlParserInputPtr in  ATTRIBUTE_UNUSED,
int len  ATTRIBUTE_UNUSED 
)

xmlParserInputRead: @in: an XML parser input @len: an indicative size for the lookahead

DEPRECATED: This function was internal and is deprecated.

Returns -1 as this is an error to use it.

Definition at line 498 of file parserInternals.c.

498 {
499 return(-1);
500}

◆ xmlPedanticParserDefault()

XML_DEPRECATED XMLPUBFUN int xmlPedanticParserDefault ( int  val)

xmlPedanticParserDefault: @val: int 0 or 1

DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.

Set and return the previous value for enabling pedantic warnings.

Returns the last value for 0 for no substitution, 1 for substitution.

Definition at line 2348 of file parserInternals.c.

2348 {
2350
2352 return(old);
2353}

◆ xmlReadDoc()

XMLPUBFUN xmlDocPtr xmlReadDoc ( const xmlChar cur,
const char URL,
const char encoding,
int  options 
)

xmlReadDoc: @cur: a pointer to a zero terminated string @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML in-memory document and build a tree.

Returns the resulting document tree

Definition at line 14786 of file parser.c.

14787{
14788 xmlParserCtxtPtr ctxt;
14789
14790 if (cur == NULL)
14791 return (NULL);
14792 xmlInitParser();
14793
14795 if (ctxt == NULL)
14796 return (NULL);
14797 return (xmlDoRead(ctxt, URL, encoding, options, 0));
14798}
xmlParserCtxtPtr xmlCreateDocParserCtxt(const xmlChar *str)
Definition: parser.c:14207

◆ xmlReadFd()

XMLPUBFUN xmlDocPtr xmlReadFd ( int  fd,
const char URL,
const char encoding,
int  options 
)

xmlReadFd: @fd: an open file descriptor @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML from a file descriptor and build a tree. NOTE that the file descriptor will not be closed when the reader is closed or reset.

Returns the resulting document tree

Definition at line 14860 of file parser.c.

14861{
14862 xmlParserCtxtPtr ctxt;
14863 xmlParserInputBufferPtr input;
14864 xmlParserInputPtr stream;
14865
14866 if (fd < 0)
14867 return (NULL);
14868 xmlInitParser();
14869
14871 if (input == NULL)
14872 return (NULL);
14873 input->closecallback = NULL;
14874 ctxt = xmlNewParserCtxt();
14875 if (ctxt == NULL) {
14877 return (NULL);
14878 }
14880 if (stream == NULL) {
14882 xmlFreeParserCtxt(ctxt);
14883 return (NULL);
14884 }
14885 inputPush(ctxt, stream);
14886 return (xmlDoRead(ctxt, URL, encoding, options, 0));
14887}

◆ xmlReadFile()

XMLPUBFUN xmlDocPtr xmlReadFile ( const char filename,
const char encoding,
int  options 
)

xmlReadFile: @filename: a file or URL @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML file from the filesystem or the network.

Returns the resulting document tree

Definition at line 14811 of file parser.c.

14812{
14813 xmlParserCtxtPtr ctxt;
14814
14815 xmlInitParser();
14817 if (ctxt == NULL)
14818 return (NULL);
14819 return (xmlDoRead(ctxt, NULL, encoding, options, 0));
14820}
xmlParserCtxtPtr xmlCreateURLParserCtxt(const char *filename, int options)
Definition: parser.c:13694

◆ xmlReadIO()

XMLPUBFUN xmlDocPtr xmlReadIO ( xmlInputReadCallback  ioread,
xmlInputCloseCallback  ioclose,
void ioctx,
const char URL,
const char encoding,
int  options 
)

xmlReadIO: @ioread: an I/O read function @ioclose: an I/O close function @ioctx: an I/O handler @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML document from I/O functions and source and build a tree.

Returns the resulting document tree

Definition at line 14903 of file parser.c.

14905{
14906 xmlParserCtxtPtr ctxt;
14907 xmlParserInputBufferPtr input;
14908 xmlParserInputPtr stream;
14909
14910 if (ioread == NULL)
14911 return (NULL);
14912 xmlInitParser();
14913
14914 input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
14916 if (input == NULL) {
14917 if (ioclose != NULL)
14918 ioclose(ioctx);
14919 return (NULL);
14920 }
14921 ctxt = xmlNewParserCtxt();
14922 if (ctxt == NULL) {
14924 return (NULL);
14925 }
14927 if (stream == NULL) {
14929 xmlFreeParserCtxt(ctxt);
14930 return (NULL);
14931 }
14932 inputPush(ctxt, stream);
14933 return (xmlDoRead(ctxt, URL, encoding, options, 0));
14934}

◆ xmlReadMemory()

XMLPUBFUN xmlDocPtr xmlReadMemory ( const char buffer,
int  size,
const char URL,
const char encoding,
int  options 
)

xmlReadMemory: @buffer: a pointer to a char array @size: the size of the array @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption

parse an XML in-memory document and build a tree.

Returns the resulting document tree

Definition at line 14835 of file parser.c.

14836{
14837 xmlParserCtxtPtr ctxt;
14838
14839 xmlInitParser();
14841 if (ctxt == NULL)
14842 return (NULL);
14843 return (xmlDoRead(ctxt, URL, encoding, options, 0));
14844}

Referenced by parse_xml().

◆ xmlSetExternalEntityLoader()

XMLPUBFUN void xmlSetExternalEntityLoader ( xmlExternalEntityLoader  f)

Referenced by schemasCleanup(), and schemasInit().

◆ xmlStopParser()

XMLPUBFUN void xmlStopParser ( xmlParserCtxtPtr  ctxt)

xmlStopParser: @ctxt: an XML parser context

Blocks further parser processing

Definition at line 12311 of file parser.c.

12311 {
12312 if (ctxt == NULL)
12313 return;
12314 xmlHaltParser(ctxt);
12315 ctxt->errNo = XML_ERR_USER_STOP;
12316}
@ XML_ERR_USER_STOP
Definition: xmlerror.h:211

Referenced by format_error_message_from_id(), libxmlFatalError(), and xmlSwitchEncoding().

◆ xmlSubstituteEntitiesDefault()

XML_DEPRECATED XMLPUBFUN int xmlSubstituteEntitiesDefault ( int  val)

xmlSubstituteEntitiesDefault: @val: int 0 or 1

DEPRECATED: Use the modern options API with XML_PARSE_NOENT.

Set and return the previous value for default entity support. Initially the parser always keep entity references instead of substituting entity values in the output. This function has to be used to change the default parser behavior SAX::substituteEntities() has to be used for changing that on a file by file basis.

Returns the last value for 0 for no substitution, 1 for substitution.

Definition at line 2392 of file parserInternals.c.

2392 {
2394
2396 return(old);
2397}

◆ xmlThrDefDoValidityCheckingDefaultValue()

XML_DEPRECATED XMLPUBFUN int xmlThrDefDoValidityCheckingDefaultValue ( int  v)

Definition at line 1044 of file globals.c.

1044 {
1045 int ret;
1050 return ret;
1051}
const GLdouble * v
Definition: gl.h:2040
XMLPUBFUN void xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:201
XMLPUBFUN void xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:225
static int xmlDoValidityCheckingDefaultValueThrDef
Definition: globals.c:288
static xmlMutex xmlThrDefMutex
Definition: globals.c:94

◆ xmlThrDefGetWarningsDefaultValue()

XML_DEPRECATED XMLPUBFUN int xmlThrDefGetWarningsDefaultValue ( int  v)

Definition at line 1053 of file globals.c.

1053 {
1054 int ret;
1059 return ret;
1060}
static int xmlGetWarningsDefaultValueThrDef
Definition: globals.c:298

◆ xmlThrDefKeepBlanksDefaultValue()

XML_DEPRECATED XMLPUBFUN int xmlThrDefKeepBlanksDefaultValue ( int  v)

Definition at line 1091 of file globals.c.

1091 {
1092 int ret;
1097 return ret;
1098}
static int xmlKeepBlanksDefaultValueThrDef
Definition: globals.c:344

◆ xmlThrDefLineNumbersDefaultValue()

XML_DEPRECATED XMLPUBFUN int xmlThrDefLineNumbersDefaultValue ( int  v)

Definition at line 1100 of file globals.c.

1100 {
1101 int ret;
1106 return ret;
1107}
static int xmlLineNumbersDefaultValueThrDef
Definition: globals.c:331

◆ xmlThrDefLoadExtDtdDefaultValue()

XML_DEPRECATED XMLPUBFUN int xmlThrDefLoadExtDtdDefaultValue ( int  v)

Definition at line 1109 of file globals.c.

1109 {
1110 int ret;
1115 return ret;
1116}
static int xmlLoadExtDtdDefaultValueThrDef
Definition: globals.c:309

◆ xmlThrDefParserDebugEntities()

XML_DEPRECATED XMLPUBFUN int xmlThrDefParserDebugEntities ( int  v)

Definition at line 1118 of file globals.c.

1118 {
1119 int ret;
1124 return ret;
1125}
static int xmlParserDebugEntitiesThrDef
Definition: globals.c:278

◆ xmlThrDefPedanticParserDefaultValue()

XML_DEPRECATED XMLPUBFUN int xmlThrDefPedanticParserDefaultValue ( int  v)

Definition at line 1127 of file globals.c.

1127 {
1128 int ret;
1133 return ret;
1134}
static int xmlPedanticParserDefaultValueThrDef
Definition: globals.c:319

◆ xmlThrDefSubstituteEntitiesDefaultValue()

XML_DEPRECATED XMLPUBFUN int xmlThrDefSubstituteEntitiesDefaultValue ( int  v)

Definition at line 1136 of file globals.c.

1136 {
1137 int ret;
1142 return ret;
1143}
static int xmlSubstituteEntitiesDefaultValueThrDef
Definition: globals.c:357

Variable Documentation

◆ xmlParserVersion

XMLPUBVAR const char* const xmlParserVersion

Definition at line 845 of file parser.h.