ReactOS 0.4.15-dev-7942-gd23573b
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/encoding.h>
#include <libxml/xmlIO.h>
#include <libxml/globals.h>
Include dependency graph for parser.h:
This graph shows which files directly or indirectly include this file:

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_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 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
}
 
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
 
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(XMLCDECLwarningSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
 
typedef void(XMLCDECL *) typedef void(XMLCDECLerrorSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
 
typedef void(XMLCDECL *) typedef void(XMLCDECL *) typedef void(XMLCDECLfatalErrorSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
 
typedef void(XMLCDECL *) typedef void(XMLCDECL *) typedef void(XMLCDECL *) 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)
 
XMLPUBFUN void XMLCALL xmlInitParser (void)
 
XMLPUBFUN void XMLCALL xmlCleanupParser (void)
 
XMLPUBFUN int XMLCALL xmlParserInputRead (xmlParserInputPtr in, int len)
 
XMLPUBFUN int XMLCALL xmlParserInputGrow (xmlParserInputPtr in, int len)
 
XMLPUBFUN int XMLCALL xmlSubstituteEntitiesDefault (int val)
 
XMLPUBFUN int XMLCALL xmlKeepBlanksDefault (int val)
 
XMLPUBFUN void XMLCALL xmlStopParser (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN int XMLCALL xmlPedanticParserDefault (int val)
 
XMLPUBFUN int XMLCALL xmlLineNumbersDefault (int val)
 
XMLPUBFUN int XMLCALL xmlParseDocument (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN int XMLCALL xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN xmlParserErrors XMLCALL xmlParseInNodeContext (xmlNodePtr node, const char *data, int datalen, int options, xmlNodePtr *lst)
 
XMLPUBFUN int XMLCALL xmlParseCtxtExternalEntity (xmlParserCtxtPtr ctx, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst)
 
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt (void)
 
XMLPUBFUN int XMLCALL xmlInitParserCtxt (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN void XMLCALL xmlClearParserCtxt (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN void XMLCALL xmlFreeParserCtxt (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateDocParserCtxt (const xmlChar *cur)
 
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, void *user_data, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
 
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream (xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
 
XMLPUBFUN const xmlParserNodeInfo *XMLCALL xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, const xmlNodePtr node)
 
XMLPUBFUN void XMLCALL xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq)
 
XMLPUBFUN void XMLCALL xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq)
 
XMLPUBFUN unsigned long XMLCALL xmlParserFindNodeInfoIndex (const xmlParserNodeInfoSeqPtr seq, const xmlNodePtr node)
 
XMLPUBFUN void XMLCALL xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, const xmlParserNodeInfoPtr info)
 
XMLPUBFUN void XMLCALL xmlSetExternalEntityLoader (xmlExternalEntityLoader f)
 
XMLPUBFUN xmlExternalEntityLoader XMLCALL xmlGetExternalEntityLoader (void)
 
XMLPUBFUN xmlParserInputPtr XMLCALL xmlLoadExternalEntity (const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
 
XMLPUBFUN long XMLCALL xmlByteConsumed (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN void XMLCALL xmlCtxtReset (xmlParserCtxtPtr ctxt)
 
XMLPUBFUN int XMLCALL xmlCtxtResetPush (xmlParserCtxtPtr ctxt, const char *chunk, int size, const char *filename, const char *encoding)
 
XMLPUBFUN int XMLCALL xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlReadDoc (const xmlChar *cur, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlReadFile (const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlReadMemory (const char *buffer, int size, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlReadFd (int fd, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlReadIO (xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, const xmlChar *cur, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadFile (xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadFd (xmlParserCtxtPtr ctxt, int fd, const char *URL, const char *encoding, int options)
 
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadIO (xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
 
XMLPUBFUN int XMLCALL 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 146 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 31 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 137 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 671 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 154 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 443 of file parser.h.

◆ attributeSAXFunc

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

Definition at line 533 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 596 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 553 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 586 of file parser.h.

◆ elementDeclSAXFunc

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

Definition at line 459 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 501 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 713 of file parser.h.

◆ endElementSAXFunc

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

Definition at line 520 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 412 of file parser.h.

◆ errorSAXFunc

typedef void(XMLCDECL *) typedef void(XMLCDECL * 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 618 of file parser.h.

◆ externalSubsetSAXFunc

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

Definition at line 375 of file parser.h.

◆ fatalErrorSAXFunc

typedef void(XMLCDECL *) typedef void(XMLCDECL *) typedef void(XMLCDECL * 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 630 of file parser.h.

◆ getEntitySAXFunc

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

Definition at line 388 of file parser.h.

◆ getParameterEntitySAXFunc

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

Definition at line 399 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 659 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 649 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 565 of file parser.h.

◆ internalSubsetSAXFunc

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

Definition at line 362 of file parser.h.

◆ isStandaloneSAXFunc

typedef void(XMLCDECL *) typedef void(XMLCDECL *) typedef void(XMLCDECL *) 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 640 of file parser.h.

◆ notationDeclSAXFunc

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

Definition at line 427 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 576 of file parser.h.

◆ referenceSAXFunc

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

Definition at line 543 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 350 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 486 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 494 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 692 of file parser.h.

◆ startElementSAXFunc

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

Definition at line 510 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 473 of file parser.h.

◆ warningSAXFunc

typedef void(XMLCDECL * 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 608 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 802 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 50 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 84 of file parser.h.

◆ xmlParserNodeInfoPtr

Definition at line 85 of file parser.h.

◆ xmlParserNodeInfoSeq

Definition at line 96 of file parser.h.

◆ xmlParserNodeInfoSeqPtr

Definition at line 97 of file parser.h.

◆ xmlSAXHandlerV1

Definition at line 758 of file parser.h.

◆ xmlSAXHandlerV1Ptr

Definition at line 759 of file parser.h.

◆ xmlStartTag

Definition at line 170 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 1201 of file parser.h.

1201 {
1202 XML_WITH_THREAD = 1,
1203 XML_WITH_TREE = 2,
1204 XML_WITH_OUTPUT = 3,
1205 XML_WITH_PUSH = 4,
1206 XML_WITH_READER = 5,
1207 XML_WITH_PATTERN = 6,
1208 XML_WITH_WRITER = 7,
1209 XML_WITH_SAX1 = 8,
1210 XML_WITH_FTP = 9,
1211 XML_WITH_HTTP = 10,
1212 XML_WITH_VALID = 11,
1213 XML_WITH_HTML = 12,
1214 XML_WITH_LEGACY = 13,
1215 XML_WITH_C14N = 14,
1216 XML_WITH_CATALOG = 15,
1217 XML_WITH_XPATH = 16,
1218 XML_WITH_XPTR = 17,
1219 XML_WITH_XINCLUDE = 18,
1220 XML_WITH_ICONV = 19,
1221 XML_WITH_ISO8859X = 20,
1222 XML_WITH_UNICODE = 21,
1223 XML_WITH_REGEXP = 22,
1224 XML_WITH_AUTOMATA = 23,
1225 XML_WITH_EXPR = 24,
1226 XML_WITH_SCHEMAS = 25,
1228 XML_WITH_MODULES = 27,
1229 XML_WITH_DEBUG = 28,
1230 XML_WITH_DEBUG_MEM = 29,
1231 XML_WITH_DEBUG_RUN = 30,
1232 XML_WITH_ZLIB = 31,
1233 XML_WITH_ICU = 32,
1234 XML_WITH_LZMA = 33,
1235 XML_WITH_NONE = 99999 /* just to be sure of allocation size */
1236} xmlFeature;
xmlFeature
Definition: parser.h:1201
@ XML_WITH_DEBUG
Definition: parser.h:1229
@ XML_WITH_LEGACY
Definition: parser.h:1214
@ XML_WITH_CATALOG
Definition: parser.h:1216
@ XML_WITH_XPATH
Definition: parser.h:1217
@ XML_WITH_TREE
Definition: parser.h:1203
@ XML_WITH_DEBUG_MEM
Definition: parser.h:1230
@ XML_WITH_DEBUG_RUN
Definition: parser.h:1231
@ XML_WITH_XPTR
Definition: parser.h:1218
@ XML_WITH_OUTPUT
Definition: parser.h:1204
@ XML_WITH_EXPR
Definition: parser.h:1225
@ XML_WITH_VALID
Definition: parser.h:1212
@ XML_WITH_THREAD
Definition: parser.h:1202
@ XML_WITH_SCHEMAS
Definition: parser.h:1226
@ XML_WITH_C14N
Definition: parser.h:1215
@ XML_WITH_MODULES
Definition: parser.h:1228
@ XML_WITH_NONE
Definition: parser.h:1235
@ XML_WITH_UNICODE
Definition: parser.h:1222
@ XML_WITH_REGEXP
Definition: parser.h:1223
@ XML_WITH_HTML
Definition: parser.h:1213
@ XML_WITH_LZMA
Definition: parser.h:1234
@ XML_WITH_AUTOMATA
Definition: parser.h:1224
@ XML_WITH_ISO8859X
Definition: parser.h:1221
@ XML_WITH_PUSH
Definition: parser.h:1205
@ XML_WITH_ICONV
Definition: parser.h:1220
@ XML_WITH_ZLIB
Definition: parser.h:1232
@ XML_WITH_SAX1
Definition: parser.h:1209
@ XML_WITH_PATTERN
Definition: parser.h:1207
@ XML_WITH_WRITER
Definition: parser.h:1208
@ XML_WITH_FTP
Definition: parser.h:1210
@ XML_WITH_HTTP
Definition: parser.h:1211
@ XML_WITH_READER
Definition: parser.h:1206
@ XML_WITH_XINCLUDE
Definition: parser.h:1219
@ XML_WITH_SCHEMATRON
Definition: parser.h:1227
@ XML_WITH_ICU
Definition: parser.h:1233

◆ 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 

Definition at line 110 of file parser.h.

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

◆ 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 161 of file parser.h.

161 {
163 XML_PARSE_DOM = 1,
164 XML_PARSE_SAX = 2,
xmlParserMode
Definition: parser.h:161
@ XML_PARSE_READER
Definition: parser.h:167
@ XML_PARSE_PUSH_SAX
Definition: parser.h:166
@ XML_PARSE_SAX
Definition: parser.h:164
@ XML_PARSE_DOM
Definition: parser.h:163
@ XML_PARSE_PUSH_DOM
Definition: parser.h:165
@ XML_PARSE_UNKNOWN
Definition: parser.h:162

◆ 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 1092 of file parser.h.

1092 {
1093 XML_PARSE_RECOVER = 1<<0, /* recover on errors */
1094 XML_PARSE_NOENT = 1<<1, /* substitute entities */
1095 XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */
1096 XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */
1097 XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */
1098 XML_PARSE_NOERROR = 1<<5, /* suppress error reports */
1099 XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */
1100 XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
1101 XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
1102 XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */
1103 XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitution */
1104 XML_PARSE_NONET = 1<<11,/* Forbid network access */
1105 XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */
1106 XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
1107 XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
1108 XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
1109 XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of
1110 the tree allowed afterwards (will possibly
1111 crash if you try to modify the tree) */
1112 XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */
1113 XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
1114 XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */
1115 XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */
1116 XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */
1117 XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */
xmlParserOption
Definition: parser.h:1092
@ XML_PARSE_SAX1
Definition: parser.h:1102
@ XML_PARSE_DTDVALID
Definition: parser.h:1097
@ XML_PARSE_NOWARNING
Definition: parser.h:1099
@ XML_PARSE_NOCDATA
Definition: parser.h:1107
@ XML_PARSE_COMPACT
Definition: parser.h:1109
@ XML_PARSE_NONET
Definition: parser.h:1104
@ XML_PARSE_NOBLANKS
Definition: parser.h:1101
@ XML_PARSE_IGNORE_ENC
Definition: parser.h:1116
@ XML_PARSE_NOBASEFIX
Definition: parser.h:1113
@ XML_PARSE_DTDLOAD
Definition: parser.h:1095
@ XML_PARSE_XINCLUDE
Definition: parser.h:1103
@ XML_PARSE_RECOVER
Definition: parser.h:1093
@ XML_PARSE_HUGE
Definition: parser.h:1114
@ XML_PARSE_NODICT
Definition: parser.h:1105
@ XML_PARSE_BIG_LINES
Definition: parser.h:1117
@ XML_PARSE_DTDATTR
Definition: parser.h:1096
@ XML_PARSE_OLD10
Definition: parser.h:1112
@ XML_PARSE_OLDSAX
Definition: parser.h:1115
@ XML_PARSE_NOERROR
Definition: parser.h:1098
@ XML_PARSE_NOXINCNODE
Definition: parser.h:1108
@ XML_PARSE_NOENT
Definition: parser.h:1094
@ XML_PARSE_PEDANTIC
Definition: parser.h:1100
@ XML_PARSE_NSCLEAN
Definition: parser.h:1106

Function Documentation

◆ xmlByteConsumed()

XMLPUBFUN long XMLCALL xmlByteConsumed ( xmlParserCtxtPtr  ctxt)

xmlByteConsumed: @ctxt: an XML parser context

This function provides the current index of the parser relative to the start of the current entity. This function is computed in bytes from the beginning starting at zero and finishing at the size in byte of the file if parsing a file. The function is of constant cost if the input is UTF-8 but can be costly if run on non-UTF-8 input.

Returns the index in bytes from the beginning of the entity or -1 in case the index could not be computed.

Definition at line 2882 of file encoding.c.

2882 {
2884
2885 if (ctxt == NULL) return(-1);
2886 in = ctxt->input;
2887 if (in == NULL) return(-1);
2888 if ((in->buf != NULL) && (in->buf->encoder != NULL)) {
2889 unsigned int unused = 0;
2890 xmlCharEncodingHandler * handler = in->buf->encoder;
2891 /*
2892 * Encoding conversion, compute the number of unused original
2893 * bytes from the input not consumed and subtract that from
2894 * the raw consumed value, this is not a cheap operation
2895 */
2896 if (in->end - in->cur > 0) {
2897 unsigned char convbuf[32000];
2898 const unsigned char *cur = (const unsigned char *)in->cur;
2899 int toconv = in->end - in->cur, written = 32000;
2900
2901 int ret;
2902
2903 do {
2904 toconv = in->end - cur;
2905 written = 32000;
2906 ret = xmlEncOutputChunk(handler, &convbuf[0], &written,
2907 cur, &toconv);
2908 if (ret < 0) {
2909 if (written > 0)
2910 ret = -2;
2911 else
2912 return(-1);
2913 }
2914 unused += written;
2915 cur += toconv;
2916 } while (ret == -2);
2917 }
2918 if (in->buf->rawconsumed < unused)
2919 return(-1);
2920 return(in->buf->rawconsumed - unused);
2921 }
2922 return(in->consumed + (in->cur - in->base));
2923}
#define NULL
Definition: types.h:112
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7482
static int xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
Definition: encoding.c:2029
FxCollectionEntry * cur
GLuint in
Definition: glext.h:9616
WORD unused[29]
Definition: crypt.c:1155
xmlParserInputPtr input
Definition: parser.h:199
int ret

◆ xmlCleanupParser()

XMLPUBFUN void XMLCALL 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 14739 of file parser.c.

14739 {
14741 return;
14742
14744#ifdef LIBXML_CATALOG_ENABLED
14745 xmlCatalogCleanup();
14746#endif
14749#ifdef LIBXML_OUTPUT_ENABLED
14750 xmlCleanupOutputCallbacks();
14751#endif
14752#ifdef LIBXML_SCHEMAS_ENABLED
14753 xmlSchemaCleanupTypes();
14754 xmlRelaxNGCleanupTypes();
14755#endif
14757 xmlCleanupThreads(); /* must be last if called not from the main thread */
14760}
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupCharEncodingHandlers(void)
Definition: encoding.c:1483
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlDictCleanup(void)
Definition: dict.c:224
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupGlobals(void)
Definition: globals.c:535
static int xmlParserInitialized
Definition: parser.c:14665
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupThreads(void)
Definition: threads.c:900
XMLPUBFUN void XMLCALL xmlCleanupInputCallbacks(void)
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupMemory(void)
Definition: xmlmemory.c:989

Referenced by DllMain(), main(), and xmlInitParser().

◆ xmlClearNodeInfoSeq()

XMLPUBFUN void XMLCALL xmlClearNodeInfoSeq ( xmlParserNodeInfoSeqPtr  seq)

xmlClearNodeInfoSeq: @seq: a node info sequence pointer

– Clear (release memory and reinitialize) node info sequence

Definition at line 1805 of file parserInternals.c.

1806{
1807 if (seq == NULL)
1808 return;
1809 if (seq->buffer != NULL)
1810 xmlFree(seq->buffer);
1811 xmlInitNodeInfoSeq(seq);
1812}
void xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:251
xmlParserNodeInfo * buffer
Definition: parser.h:101

Referenced by xmlClearParserCtxt().

◆ xmlClearParserCtxt()

XMLPUBFUN void XMLCALL xmlClearParserCtxt ( xmlParserCtxtPtr  ctxt)

xmlClearParserCtxt: @ctxt: an XML parser context

Clear (release owned resources) and reinitialize a parser context

Definition at line 1746 of file parserInternals.c.

1747{
1748 if (ctxt==NULL)
1749 return;
1751 xmlCtxtReset(ctxt);
1752}
void xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
XMLPUBFUN void XMLCALL xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14801
xmlParserNodeInfoSeq node_seq
Definition: parser.h:211

◆ xmlCreateDocParserCtxt()

XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateDocParserCtxt ( const xmlChar cur)

xmlCreateDocParserCtxt: @cur: 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 14542 of file parser.c.

14542 {
14543 int len;
14544
14545 if (cur == NULL)
14546 return(NULL);
14547 len = xmlStrlen(cur);
14548 return(xmlCreateMemoryParserCtxt((const char *)cur, len));
14549}
GLenum GLsizei len
Definition: glext.h:6722
xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size)
Definition: parser.c:14339
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:426

Referenced by xmlReadDoc().

◆ xmlCreateIOParserCtxt()

XMLPUBFUN xmlParserCtxtPtr XMLCALL 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 12605 of file parser.c.

12607 {
12608 xmlParserCtxtPtr ctxt;
12609 xmlParserInputPtr inputStream;
12611
12612 if (ioread == NULL) return(NULL);
12613
12614 buf = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, enc);
12615 if (buf == NULL) {
12616 if (ioclose != NULL)
12617 ioclose(ioctx);
12618 return (NULL);
12619 }
12620
12621 ctxt = xmlNewParserCtxt();
12622 if (ctxt == NULL) {
12624 return(NULL);
12625 }
12626 if (sax != NULL) {
12627#ifdef LIBXML_SAX1_ENABLED
12629#endif /* LIBXML_SAX1_ENABLED */
12630 xmlFree(ctxt->sax);
12631 ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
12632 if (ctxt->sax == NULL) {
12634 xmlErrMemory(ctxt, NULL);
12635 xmlFreeParserCtxt(ctxt);
12636 return(NULL);
12637 }
12638 memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
12639 if (sax->initialized == XML_SAX2_MAGIC)
12640 memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
12641 else
12642 memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
12643 if (user_data != NULL)
12644 ctxt->userData = user_data;
12645 }
12646
12647 inputStream = xmlNewIOInputStream(ctxt, buf, enc);
12648 if (inputStream == NULL) {
12649 xmlFreeParserCtxt(ctxt);
12650 return(NULL);
12651 }
12652 inputPush(ctxt, inputStream);
12653
12654 return(ctxt);
12655}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:248
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler
Definition: globals.h:312
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
#define XML_SAX2_MAGIC
Definition: parser.h:671
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
xmlSAXHandler * xmlSAXHandlerPtr
Definition: tree.h:45
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1745
#define memset(x, y, z)
Definition: compat.h:39
struct _xmlSAXHandler * sax
Definition: parser.h:185
void * userData
Definition: parser.h:186
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
static int sax
Definition: xmllint.c:193

◆ xmlCtxtReadDoc()

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

xmlCtxtReadDoc: @ctxt: an XML parser context @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. This reuses the existing @ctxt parser context

Returns the resulting document tree

Definition at line 15368 of file parser.c.

15370{
15371 if (cur == NULL)
15372 return (NULL);
15373 return (xmlCtxtReadMemory(ctxt, (const char *) cur, xmlStrlen(cur), URL,
15374 encoding, options));
15375}
xmlDocPtr xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options)
Definition: parser.c:15426
static char * encoding
Definition: xmllint.c:155

◆ xmlCtxtReadFd()

XMLPUBFUN xmlDocPtr XMLCALL 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 15471 of file parser.c.

15473{
15476
15477 if (fd < 0)
15478 return (NULL);
15479 if (ctxt == NULL)
15480 return (NULL);
15481 xmlInitParser();
15482
15483 xmlCtxtReset(ctxt);
15484
15485
15487 if (input == NULL)
15488 return (NULL);
15489 input->closecallback = NULL;
15491 if (stream == NULL) {
15493 return (NULL);
15494 }
15495 inputPush(ctxt, stream);
15496 return (xmlDoRead(ctxt, URL, encoding, options, 1));
15497}
@ XML_CHAR_ENCODING_NONE
Definition: encoding.h:58
GLenum GLenum GLenum input
Definition: glext.h:9031
void xmlInitParser(void)
Definition: parser.c:14676
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15159
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14801
static int fd
Definition: io.c:51
Definition: parse.h:23
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc)

◆ xmlCtxtReadFile()

XMLPUBFUN xmlDocPtr XMLCALL 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 15390 of file parser.c.

15392{
15394
15395 if (filename == NULL)
15396 return (NULL);
15397 if (ctxt == NULL)
15398 return (NULL);
15399 xmlInitParser();
15400
15401 xmlCtxtReset(ctxt);
15402
15404 if (stream == NULL) {
15405 return (NULL);
15406 }
15407 inputPush(ctxt, stream);
15408 return (xmlDoRead(ctxt, NULL, encoding, options, 1));
15409}
const char * filename
Definition: ioapi.h:137
XMLPUBFUN xmlParserInputPtr XMLCALL xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)

Referenced by parseAndPrintFile().

◆ xmlCtxtReadIO()

XMLPUBFUN xmlDocPtr XMLCALL 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 15515 of file parser.c.

15519{
15522
15523 if (ioread == NULL)
15524 return (NULL);
15525 if (ctxt == NULL)
15526 return (NULL);
15527 xmlInitParser();
15528
15529 xmlCtxtReset(ctxt);
15530
15531 input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
15533 if (input == NULL) {
15534 if (ioclose != NULL)
15535 ioclose(ioctx);
15536 return (NULL);
15537 }
15539 if (stream == NULL) {
15541 return (NULL);
15542 }
15543 inputPush(ctxt, stream);
15544 return (xmlDoRead(ctxt, URL, encoding, options, 1));
15545}

Referenced by parseAndPrintFile().

◆ xmlCtxtReadMemory()

XMLPUBFUN xmlDocPtr XMLCALL 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 15426 of file parser.c.

15428{
15431
15432 if (ctxt == NULL)
15433 return (NULL);
15434 if (buffer == NULL)
15435 return (NULL);
15436 xmlInitParser();
15437
15438 xmlCtxtReset(ctxt);
15439
15441 if (input == NULL) {
15442 return(NULL);
15443 }
15444
15446 if (stream == NULL) {
15448 return(NULL);
15449 }
15450
15451 inputPush(ctxt, stream);
15452 return (xmlDoRead(ctxt, URL, encoding, options, 1));
15453}
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc)

Referenced by parseAndPrintFile(), and xmlCtxtReadDoc().

◆ xmlCtxtReset()

XMLPUBFUN void XMLCALL xmlCtxtReset ( xmlParserCtxtPtr  ctxt)

xmlCtxtReset: @ctxt: an XML parser context

Reset a parser context

Definition at line 14801 of file parser.c.

14802{
14804 xmlDictPtr dict;
14805
14806 if (ctxt == NULL)
14807 return;
14808
14809 dict = ctxt->dict;
14810
14811 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
14813 }
14814 ctxt->inputNr = 0;
14815 ctxt->input = NULL;
14816
14817 ctxt->spaceNr = 0;
14818 if (ctxt->spaceTab != NULL) {
14819 ctxt->spaceTab[0] = -1;
14820 ctxt->space = &ctxt->spaceTab[0];
14821 } else {
14822 ctxt->space = NULL;
14823 }
14824
14825
14826 ctxt->nodeNr = 0;
14827 ctxt->node = NULL;
14828
14829 ctxt->nameNr = 0;
14830 ctxt->name = NULL;
14831
14832 ctxt->nsNr = 0;
14833
14834 DICT_FREE(ctxt->version);
14835 ctxt->version = NULL;
14836 DICT_FREE(ctxt->encoding);
14837 ctxt->encoding = NULL;
14838 DICT_FREE(ctxt->directory);
14839 ctxt->directory = NULL;
14840 DICT_FREE(ctxt->extSubURI);
14841 ctxt->extSubURI = NULL;
14842 DICT_FREE(ctxt->extSubSystem);
14843 ctxt->extSubSystem = NULL;
14844 if (ctxt->myDoc != NULL)
14845 xmlFreeDoc(ctxt->myDoc);
14846 ctxt->myDoc = NULL;
14847
14848 ctxt->standalone = -1;
14849 ctxt->hasExternalSubset = 0;
14850 ctxt->hasPErefs = 0;
14851 ctxt->html = 0;
14852 ctxt->external = 0;
14853 ctxt->instate = XML_PARSER_START;
14854 ctxt->token = 0;
14855
14856 ctxt->wellFormed = 1;
14857 ctxt->nsWellFormed = 1;
14858 ctxt->disableSAX = 0;
14859 ctxt->valid = 1;
14860#if 0
14861 ctxt->vctxt.userData = ctxt;
14862 ctxt->vctxt.error = xmlParserValidityError;
14863 ctxt->vctxt.warning = xmlParserValidityWarning;
14864#endif
14865 ctxt->record_info = 0;
14866 ctxt->checkIndex = 0;
14867 ctxt->inSubset = 0;
14868 ctxt->errNo = XML_ERR_OK;
14869 ctxt->depth = 0;
14871 ctxt->catalogs = NULL;
14872 ctxt->nbentities = 0;
14873 ctxt->sizeentities = 0;
14874 ctxt->sizeentcopy = 0;
14876
14877 if (ctxt->attsDefault != NULL) {
14879 ctxt->attsDefault = NULL;
14880 }
14881 if (ctxt->attsSpecial != NULL) {
14883 ctxt->attsSpecial = NULL;
14884 }
14885
14886#ifdef LIBXML_CATALOG_ENABLED
14887 if (ctxt->catalogs != NULL)
14888 xmlCatalogFreeLocal(ctxt->catalogs);
14889#endif
14890 if (ctxt->lastError.code != XML_ERR_OK)
14891 xmlResetError(&ctxt->lastError);
14892}
@ XML_CHAR_ENCODING_UTF8
Definition: encoding.h:59
XMLPUBFUN void XMLCALL xmlFreeInputStream(xmlParserInputPtr input)
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:322
XMLPUBFUN void XMLCALL xmlHashDefaultDeallocator(void *entry, const xmlChar *name)
XMLPUBFUN void XMLCALL xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
#define DICT_FREE(str)
Definition: parser.c:14789
xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1774
Definition: dict.c:111
int code
Definition: xmlerror.h:80
xmlError lastError
Definition: parser.h:301
char * directory
Definition: parser.h:226
int nsWellFormed
Definition: parser.h:286
int hasPErefs
Definition: parser.h:216
xmlValidCtxt vctxt
Definition: parser.h:221
int external
Definition: parser.h:217
int wellFormed
Definition: parser.h:188
int * space
Definition: parser.h:244
int disableSAX
Definition: parser.h:237
xmlChar * extSubSystem
Definition: parser.h:241
xmlDocPtr myDoc
Definition: parser.h:187
int hasExternalSubset
Definition: parser.h:215
long checkIndex
Definition: parser.h:235
xmlParserInputState instate
Definition: parser.h:223
const xmlChar * encoding
Definition: parser.h:191
xmlDictPtr dict
Definition: parser.h:263
xmlHashTablePtr attsSpecial
Definition: parser.h:285
void * catalogs
Definition: parser.h:260
xmlChar * extSubURI
Definition: parser.h:240
const xmlChar * name
Definition: parser.h:229
unsigned long sizeentities
Definition: parser.h:304
const xmlChar * version
Definition: parser.h:190
int record_info
Definition: parser.h:210
int * spaceTab
Definition: parser.h:247
int inSubset
Definition: parser.h:238
int standalone
Definition: parser.h:192
unsigned long sizeentcopy
Definition: parser.h:313
unsigned long nbentities
Definition: parser.h:303
xmlHashTablePtr attsDefault
Definition: parser.h:284
xmlNodePtr node
Definition: parser.h:205
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserValidityWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserValidityError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
XMLPUBFUN void XMLCALL xmlResetError(xmlErrorPtr err)
@ XML_ERR_OK
Definition: xmlerror.h:100

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

◆ xmlCtxtResetPush()

XMLPUBFUN int XMLCALL 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 14907 of file parser.c.

14909{
14910 xmlParserInputPtr inputStream;
14913
14914 if (ctxt == NULL)
14915 return(1);
14916
14917 if ((encoding == NULL) && (chunk != NULL) && (size >= 4))
14918 enc = xmlDetectCharEncoding((const xmlChar *) chunk, size);
14919
14921 if (buf == NULL)
14922 return(1);
14923
14924 if (ctxt == NULL) {
14926 return(1);
14927 }
14928
14929 xmlCtxtReset(ctxt);
14930
14931 if (filename == NULL) {
14932 ctxt->directory = NULL;
14933 } else {
14935 }
14936
14937 inputStream = xmlNewInputStream(ctxt);
14938 if (inputStream == NULL) {
14940 return(1);
14941 }
14942
14943 if (filename == NULL)
14944 inputStream->filename = NULL;
14945 else
14946 inputStream->filename = (char *)
14947 xmlCanonicPath((const xmlChar *) filename);
14948 inputStream->buf = buf;
14949 xmlBufResetInput(buf->buffer, inputStream);
14950
14951 inputPush(ctxt, inputStream);
14952
14953 if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
14954 (ctxt->input->buf != NULL)) {
14955 size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input);
14956 size_t cur = ctxt->input->cur - ctxt->input->base;
14957
14959
14961#ifdef DEBUG_PUSH
14962 xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
14963#endif
14964 }
14965
14966 if (encoding != NULL) {
14968
14969 if (ctxt->encoding != NULL)
14970 xmlFree((xmlChar *) ctxt->encoding);
14971 ctxt->encoding = xmlStrdup((const xmlChar *) encoding);
14972
14974 if (hdlr != NULL) {
14975 xmlSwitchToEncoding(ctxt, hdlr);
14976 } else {
14977 xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
14978 "Unsupported encoding %s\n", BAD_CAST encoding);
14979 }
14980 } else if (enc != XML_CHAR_ENCODING_NONE) {
14981 xmlSwitchEncoding(ctxt, enc);
14982 }
14983
14984 return(0);
14985}
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
Definition: buf.c:1094
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input)
Definition: buf.c:1113
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, size_t base, size_t cur)
Definition: buf.c:1144
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1678
xmlCharEncoding
Definition: encoding.h:56
XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding(const unsigned char *in, int len)
Definition: encoding.c:952
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewInputStream(xmlParserCtxtPtr ctxt)
XMLPUBFUN int XMLCALL xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
XMLPUBFUN int XMLCALL xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:353
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:337
xmlBufPtr buffer
Definition: xmlIO.h:132
const char * filename
Definition: parser.h:56
const xmlChar * base
Definition: parser.h:58
xmlParserInputBufferPtr buf
Definition: parser.h:54
const xmlChar * cur
Definition: parser.h:59
XMLPUBFUN xmlChar *XMLCALL xmlCanonicPath(const xmlChar *path)
Definition: uri.c:2380
XMLPUBFUN char *XMLCALL xmlParserGetDirectory(const char *filename)
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlAllocParserInputBuffer(xmlCharEncoding enc)
XMLPUBFUN int XMLCALL xmlParserInputBufferPush(xmlParserInputBufferPtr in, int len, const char *buf)
@ XML_ERR_UNSUPPORTED_ENCODING
Definition: xmlerror.h:132
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:67
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28

◆ xmlCtxtUseOptions()

XMLPUBFUN int XMLCALL 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 15141 of file parser.c.

15142{
15143 return(xmlCtxtUseOptionsInternal(ctxt, options, NULL));
15144}
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding)
Definition: parser.c:15000

Referenced by parseAndPrintFile(), and xsltDocDefaultLoaderFunc().

◆ xmlFreeParserCtxt()

XMLPUBFUN void XMLCALL 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 1629 of file parserInternals.c.

1630{
1632
1633 if (ctxt == NULL) return;
1634
1635 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
1637 }
1638 if (ctxt->spaceTab != NULL) xmlFree(ctxt->spaceTab);
1639 if (ctxt->nameTab != NULL) xmlFree((xmlChar * *)ctxt->nameTab);
1640 if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab);
1641 if (ctxt->nodeInfoTab != NULL) xmlFree(ctxt->nodeInfoTab);
1642 if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab);
1643 if (ctxt->version != NULL) xmlFree((char *) ctxt->version);
1644 if (ctxt->encoding != NULL) xmlFree((char *) ctxt->encoding);
1645 if (ctxt->extSubURI != NULL) xmlFree((char *) ctxt->extSubURI);
1646 if (ctxt->extSubSystem != NULL) xmlFree((char *) ctxt->extSubSystem);
1647#ifdef LIBXML_SAX1_ENABLED
1648 if ((ctxt->sax != NULL) &&
1650#else
1651 if (ctxt->sax != NULL)
1652#endif /* LIBXML_SAX1_ENABLED */
1653 xmlFree(ctxt->sax);
1654 if (ctxt->directory != NULL) xmlFree((char *) ctxt->directory);
1655 if (ctxt->vctxt.nodeTab != NULL) xmlFree(ctxt->vctxt.nodeTab);
1656 if (ctxt->atts != NULL) xmlFree((xmlChar * *)ctxt->atts);
1657 if (ctxt->dict != NULL) xmlDictFree(ctxt->dict);
1658 if (ctxt->nsTab != NULL) xmlFree((char *) ctxt->nsTab);
1659 if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab);
1660 if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs);
1661 if (ctxt->attsDefault != NULL)
1663 if (ctxt->attsSpecial != NULL)
1665 if (ctxt->freeElems != NULL) {
1667
1668 cur = ctxt->freeElems;
1669 while (cur != NULL) {
1670 next = cur->next;
1671 xmlFree(cur);
1672 cur = next;
1673 }
1674 }
1675 if (ctxt->freeAttrs != NULL) {
1677
1678 cur = ctxt->freeAttrs;
1679 while (cur != NULL) {
1680 next = cur->next;
1681 xmlFree(cur);
1682 cur = next;
1683 }
1684 }
1685 /*
1686 * cleanup the error strings
1687 */
1688 if (ctxt->lastError.message != NULL)
1689 xmlFree(ctxt->lastError.message);
1690 if (ctxt->lastError.file != NULL)
1691 xmlFree(ctxt->lastError.file);
1692 if (ctxt->lastError.str1 != NULL)
1693 xmlFree(ctxt->lastError.str1);
1694 if (ctxt->lastError.str2 != NULL)
1695 xmlFree(ctxt->lastError.str2);
1696 if (ctxt->lastError.str3 != NULL)
1697 xmlFree(ctxt->lastError.str3);
1698
1699#ifdef LIBXML_CATALOG_ENABLED
1700 if (ctxt->catalogs != NULL)
1701 xmlCatalogFreeLocal(ctxt->catalogs);
1702#endif
1703 xmlFree(ctxt);
1704}
void xmlFreeInputStream(xmlParserInputPtr input)
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1774
static unsigned __int64 next
Definition: rand_nt.c:6
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
Definition: dict.c:802
Definition: tree.h:434
char * file
Definition: xmlerror.h:83
char * str3
Definition: xmlerror.h:87
char * str1
Definition: xmlerror.h:85
char * str2
Definition: xmlerror.h:86
char * message
Definition: xmlerror.h:81
Definition: tree.h:489
const xmlChar ** atts
Definition: parser.h:264
xmlStartTag * pushTab
Definition: parser.h:283
xmlNodePtr * nodeTab
Definition: parser.h:208
int * attallocs
Definition: parser.h:282
const xmlChar ** nsTab
Definition: parser.h:281
xmlAttrPtr freeAttrs
Definition: parser.h:296
xmlParserInputPtr * inputTab
Definition: parser.h:202
const xmlChar ** nameTab
Definition: parser.h:232
xmlParserNodeInfo * nodeInfoTab
Definition: parser.h:310
xmlNodePtr freeElems
Definition: parser.h:294

Referenced by main(), parseAndPrintFile(), testSAX(), xmlCreateEntityParserCtxtInternal(), xmlCreateIOParserCtxt(), xmlCreateMemoryParserCtxt(), xmlCreateURLParserCtxt(), xmlDoRead(), xmlNewParserCtxt(), xmlParseBalancedChunkMemoryInternal(), xmlParseExternalEntityPrivate(), xmlParseInNodeContext(), xmlReadFd(), xmlReadIO(), and xsltDocDefaultLoaderFunc().

◆ xmlGetExternalEntityLoader()

XMLPUBFUN xmlExternalEntityLoader XMLCALL xmlGetExternalEntityLoader ( void  )

Referenced by main().

◆ xmlHasFeature()

XMLPUBFUN int XMLCALL 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 874 of file parser.c.

875{
876 switch (feature) {
877 case XML_WITH_THREAD:
878#ifdef LIBXML_THREAD_ENABLED
879 return(1);
880#else
881 return(0);
882#endif
883 case XML_WITH_TREE:
884#ifdef LIBXML_TREE_ENABLED
885 return(1);
886#else
887 return(0);
888#endif
889 case XML_WITH_OUTPUT:
890#ifdef LIBXML_OUTPUT_ENABLED
891 return(1);
892#else
893 return(0);
894#endif
895 case XML_WITH_PUSH:
896#ifdef LIBXML_PUSH_ENABLED
897 return(1);
898#else
899 return(0);
900#endif
901 case XML_WITH_READER:
902#ifdef LIBXML_READER_ENABLED
903 return(1);
904#else
905 return(0);
906#endif
907 case XML_WITH_PATTERN:
908#ifdef LIBXML_PATTERN_ENABLED
909 return(1);
910#else
911 return(0);
912#endif
913 case XML_WITH_WRITER:
914#ifdef LIBXML_WRITER_ENABLED
915 return(1);
916#else
917 return(0);
918#endif
919 case XML_WITH_SAX1:
920#ifdef LIBXML_SAX1_ENABLED
921 return(1);
922#else
923 return(0);
924#endif
925 case XML_WITH_FTP:
926#ifdef LIBXML_FTP_ENABLED
927 return(1);
928#else
929 return(0);
930#endif
931 case XML_WITH_HTTP:
932#ifdef LIBXML_HTTP_ENABLED
933 return(1);
934#else
935 return(0);
936#endif
937 case XML_WITH_VALID:
938#ifdef LIBXML_VALID_ENABLED
939 return(1);
940#else
941 return(0);
942#endif
943 case XML_WITH_HTML:
944#ifdef LIBXML_HTML_ENABLED
945 return(1);
946#else
947 return(0);
948#endif
949 case XML_WITH_LEGACY:
950#ifdef LIBXML_LEGACY_ENABLED
951 return(1);
952#else
953 return(0);
954#endif
955 case XML_WITH_C14N:
956#ifdef LIBXML_C14N_ENABLED
957 return(1);
958#else
959 return(0);
960#endif
961 case XML_WITH_CATALOG:
962#ifdef LIBXML_CATALOG_ENABLED
963 return(1);
964#else
965 return(0);
966#endif
967 case XML_WITH_XPATH:
968#ifdef LIBXML_XPATH_ENABLED
969 return(1);
970#else
971 return(0);
972#endif
973 case XML_WITH_XPTR:
974#ifdef LIBXML_XPTR_ENABLED
975 return(1);
976#else
977 return(0);
978#endif
980#ifdef LIBXML_XINCLUDE_ENABLED
981 return(1);
982#else
983 return(0);
984#endif
985 case XML_WITH_ICONV:
986#ifdef LIBXML_ICONV_ENABLED
987 return(1);
988#else
989 return(0);
990#endif
992#ifdef LIBXML_ISO8859X_ENABLED
993 return(1);
994#else
995 return(0);
996#endif
997 case XML_WITH_UNICODE:
998#ifdef LIBXML_UNICODE_ENABLED
999 return(1);
1000#else
1001 return(0);
1002#endif
1003 case XML_WITH_REGEXP:
1004#ifdef LIBXML_REGEXP_ENABLED
1005 return(1);
1006#else
1007 return(0);
1008#endif
1009 case XML_WITH_AUTOMATA:
1010#ifdef LIBXML_AUTOMATA_ENABLED
1011 return(1);
1012#else
1013 return(0);
1014#endif
1015 case XML_WITH_EXPR:
1016#ifdef LIBXML_EXPR_ENABLED
1017 return(1);
1018#else
1019 return(0);
1020#endif
1021 case XML_WITH_SCHEMAS:
1022#ifdef LIBXML_SCHEMAS_ENABLED
1023 return(1);
1024#else
1025 return(0);
1026#endif
1028#ifdef LIBXML_SCHEMATRON_ENABLED
1029 return(1);
1030#else
1031 return(0);
1032#endif
1033 case XML_WITH_MODULES:
1034#ifdef LIBXML_MODULES_ENABLED
1035 return(1);
1036#else
1037 return(0);
1038#endif
1039 case XML_WITH_DEBUG:
1040#ifdef LIBXML_DEBUG_ENABLED
1041 return(1);
1042#else
1043 return(0);
1044#endif
1045 case XML_WITH_DEBUG_MEM:
1046#ifdef DEBUG_MEMORY_LOCATION
1047 return(1);
1048#else
1049 return(0);
1050#endif
1051 case XML_WITH_DEBUG_RUN:
1052#ifdef LIBXML_DEBUG_RUNTIME
1053 return(1);
1054#else
1055 return(0);
1056#endif
1057 case XML_WITH_ZLIB:
1058#ifdef LIBXML_ZLIB_ENABLED
1059 return(1);
1060#else
1061 return(0);
1062#endif
1063 case XML_WITH_LZMA:
1064#ifdef LIBXML_LZMA_ENABLED
1065 return(1);
1066#else
1067 return(0);
1068#endif
1069 case XML_WITH_ICU:
1070#ifdef LIBXML_ICU_ENABLED
1071 return(1);
1072#else
1073 return(0);
1074#endif
1075 default:
1076 break;
1077 }
1078 return(0);
1079}
INTERNETFEATURELIST feature
Definition: misc.c:1719

Referenced by showVersion().

◆ xmlInitNodeInfoSeq()

XMLPUBFUN void XMLCALL xmlInitNodeInfoSeq ( xmlParserNodeInfoSeqPtr  seq)

xmlInitNodeInfoSeq: @seq: a node info sequence pointer

– Initialize (set to initial state) node info sequence

Definition at line 1788 of file parserInternals.c.

1789{
1790 if (seq == NULL)
1791 return;
1792 seq->length = 0;
1793 seq->maximum = 0;
1794 seq->buffer = NULL;
1795}
unsigned long length
Definition: parser.h:100
unsigned long maximum
Definition: parser.h:99

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

◆ xmlInitParser()

XMLPUBFUN void XMLCALL xmlInitParser ( void  )

xmlInitParser:

Initialization function for the XML parser. This is not reentrant. Call once before processing in case of use in multithreaded programs.

Definition at line 14676 of file parser.c.

14676 {
14677 if (xmlParserInitialized != 0)
14678 return;
14679
14680#if defined(_WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
14681 if (xmlFree == free)
14683#endif
14684
14685#ifdef LIBXML_THREAD_ENABLED
14687 if (xmlParserInitialized == 0) {
14688#endif
14692 (xmlGenericError == NULL))
14694 xmlInitMemory();
14699#ifdef LIBXML_OUTPUT_ENABLED
14700 xmlRegisterDefaultOutputCallbacks();
14701#endif /* LIBXML_OUTPUT_ENABLED */
14702#ifdef LIBXML_HTML_ENABLED
14703 htmlInitAutoClose();
14704 htmlDefaultSAXHandlerInit();
14705#endif
14706#ifdef LIBXML_XPATH_ENABLED
14707 xmlXPathInit();
14708#endif
14710#ifdef LIBXML_THREAD_ENABLED
14711 }
14713#endif
14714}
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit(void)
Definition: SAX2.c:2934
#define free
Definition: debug_ros.c:5
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlInitCharEncodingHandlers(void)
Definition: encoding.c:1420
int __cdecl atexit(void(__cdecl *)(void))
Definition: atonexit.c:97
void void __xmlGlobalInitMutexLock(void)
Definition: threads.c:413
void __xmlGlobalInitMutexUnlock(void)
Definition: threads.c:488
XML_DEPRECATED XMLPUBFUN int XMLCALL xmlInitializeDict(void)
Definition: dict.c:157
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlInitGlobals(void)
Definition: globals.c:48
void xmlCleanupParser(void)
Definition: parser.c:14739
void XMLCDECL xmlGenericErrorDefaultFunc(void *ctx, const char *msg,...)
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlInitThreads(void)
Definition: threads.c:847
XMLPUBFUN void XMLCALL xmlRegisterDefaultInputCallbacks(void)
XMLPUBFUN void XMLCALL initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler)
Definition: error.c:90
XML_DEPRECATED XMLPUBFUN int XMLCALL xmlInitMemory(void)
Definition: xmlmemory.c:946

Referenced by DllMain(), xmlCheckVersion(), xmlCtxtReadFd(), xmlCtxtReadFile(), xmlCtxtReadIO(), xmlCtxtReadMemory(), xmlInitParserCtxt(), xmlParseDocument(), xmlReadDoc(), xmlReadFd(), xmlReadFile(), xmlReadIO(), and xmlReadMemory().

◆ xmlInitParserCtxt()

XMLPUBFUN int XMLCALL xmlInitParserCtxt ( xmlParserCtxtPtr  ctxt)

xmlInitParserCtxt: @ctxt: an XML parser context

Initialize a parser context

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

Definition at line 1444 of file parserInternals.c.

1445{
1447
1448 if(ctxt==NULL) {
1449 xmlErrInternal(NULL, "Got NULL parser context\n", NULL);
1450 return(-1);
1451 }
1452
1453 xmlInitParser();
1454
1455 if (ctxt->dict == NULL)
1456 ctxt->dict = xmlDictCreate();
1457 if (ctxt->dict == NULL) {
1458 xmlErrMemory(NULL, "cannot initialize parser context\n");
1459 return(-1);
1460 }
1462
1463 if (ctxt->sax == NULL)
1464 ctxt->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
1465 if (ctxt->sax == NULL) {
1466 xmlErrMemory(NULL, "cannot initialize parser context\n");
1467 return(-1);
1468 }
1469 else
1470 xmlSAXVersion(ctxt->sax, 2);
1471
1472 ctxt->maxatts = 0;
1473 ctxt->atts = NULL;
1474 /* Allocate the Input stack */
1475 if (ctxt->inputTab == NULL) {
1476 ctxt->inputTab = (xmlParserInputPtr *)
1477 xmlMalloc(5 * sizeof(xmlParserInputPtr));
1478 ctxt->inputMax = 5;
1479 }
1480 if (ctxt->inputTab == NULL) {
1481 xmlErrMemory(NULL, "cannot initialize parser context\n");
1482 ctxt->inputNr = 0;
1483 ctxt->inputMax = 0;
1484 ctxt->input = NULL;
1485 return(-1);
1486 }
1487 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
1489 }
1490 ctxt->inputNr = 0;
1491 ctxt->input = NULL;
1492
1493 ctxt->version = NULL;
1494 ctxt->encoding = NULL;
1495 ctxt->standalone = -1;
1496 ctxt->hasExternalSubset = 0;
1497 ctxt->hasPErefs = 0;
1498 ctxt->html = 0;
1499 ctxt->external = 0;
1500 ctxt->instate = XML_PARSER_START;
1501 ctxt->token = 0;
1502 ctxt->directory = NULL;
1503
1504 /* Allocate the Node stack */
1505 if (ctxt->nodeTab == NULL) {
1506 ctxt->nodeTab = (xmlNodePtr *) xmlMalloc(10 * sizeof(xmlNodePtr));
1507 ctxt->nodeMax = 10;
1508 }
1509 if (ctxt->nodeTab == NULL) {
1510 xmlErrMemory(NULL, "cannot initialize parser context\n");
1511 ctxt->nodeNr = 0;
1512 ctxt->nodeMax = 0;
1513 ctxt->node = NULL;
1514 ctxt->inputNr = 0;
1515 ctxt->inputMax = 0;
1516 ctxt->input = NULL;
1517 return(-1);
1518 }
1519 ctxt->nodeNr = 0;
1520 ctxt->node = NULL;
1521
1522 /* Allocate the Name stack */
1523 if (ctxt->nameTab == NULL) {
1524 ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
1525 ctxt->nameMax = 10;
1526 }
1527 if (ctxt->nameTab == NULL) {
1528 xmlErrMemory(NULL, "cannot initialize parser context\n");
1529 ctxt->nodeNr = 0;
1530 ctxt->nodeMax = 0;
1531 ctxt->node = NULL;
1532 ctxt->inputNr = 0;
1533 ctxt->inputMax = 0;
1534 ctxt->input = NULL;
1535 ctxt->nameNr = 0;
1536 ctxt->nameMax = 0;
1537 ctxt->name = NULL;
1538 return(-1);
1539 }
1540 ctxt->nameNr = 0;
1541 ctxt->name = NULL;
1542
1543 /* Allocate the space stack */
1544 if (ctxt->spaceTab == NULL) {
1545 ctxt->spaceTab = (int *) xmlMalloc(10 * sizeof(int));
1546 ctxt->spaceMax = 10;
1547 }
1548 if (ctxt->spaceTab == NULL) {
1549 xmlErrMemory(NULL, "cannot initialize parser context\n");
1550 ctxt->nodeNr = 0;
1551 ctxt->nodeMax = 0;
1552 ctxt->node = NULL;
1553 ctxt->inputNr = 0;
1554 ctxt->inputMax = 0;
1555 ctxt->input = NULL;
1556 ctxt->nameNr = 0;
1557 ctxt->nameMax = 0;
1558 ctxt->name = NULL;
1559 ctxt->spaceNr = 0;
1560 ctxt->spaceMax = 0;
1561 ctxt->space = NULL;
1562 return(-1);
1563 }
1564 ctxt->spaceNr = 1;
1565 ctxt->spaceMax = 10;
1566 ctxt->spaceTab[0] = -1;
1567 ctxt->space = &ctxt->spaceTab[0];
1568 ctxt->userData = ctxt;
1569 ctxt->myDoc = NULL;
1570 ctxt->wellFormed = 1;
1571 ctxt->nsWellFormed = 1;
1572 ctxt->valid = 1;
1574 if (ctxt->loadsubset) {
1575 ctxt->options |= XML_PARSE_DTDLOAD;
1576 }
1579 if (ctxt->pedantic) {
1580 ctxt->options |= XML_PARSE_PEDANTIC;
1581 }
1584 if (ctxt->keepBlanks == 0) {
1585 ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
1586 ctxt->options |= XML_PARSE_NOBLANKS;
1587 }
1588
1589 ctxt->vctxt.flags = XML_VCTXT_USE_PCTXT;
1590 ctxt->vctxt.userData = ctxt;
1591 ctxt->vctxt.error = xmlParserValidityError;
1592 ctxt->vctxt.warning = xmlParserValidityWarning;
1593 if (ctxt->validate) {
1595 ctxt->vctxt.warning = NULL;
1596 else
1597 ctxt->vctxt.warning = xmlParserValidityWarning;
1598 ctxt->vctxt.nodeMax = 0;
1599 ctxt->options |= XML_PARSE_DTDVALID;
1600 }
1602 if (ctxt->replaceEntities) {
1603 ctxt->options |= XML_PARSE_NOENT;
1604 }
1605 ctxt->record_info = 0;
1606 ctxt->checkIndex = 0;
1607 ctxt->inSubset = 0;
1608 ctxt->errNo = XML_ERR_OK;
1609 ctxt->depth = 0;
1611 ctxt->catalogs = NULL;
1612 ctxt->nbentities = 0;
1613 ctxt->sizeentities = 0;
1614 ctxt->sizeentcopy = 0;
1615 ctxt->input_id = 1;
1617 return(0);
1618}
XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace(void *ctx, const xmlChar *ch, int len)
XMLPUBFUN int XMLCALL xmlSAXVersion(xmlSAXHandler *hdlr, int version)
Definition: SAX2.c:2858
#define XML_MAX_DICTIONARY_LIMIT
XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreate(void)
Definition: dict.c:577
XMLPUBFUN size_t XMLCALL xmlDictSetLimit(xmlDictPtr dict, size_t limit)
Definition: dict.c:1265
XMLPUBVAR int xmlSubstituteEntitiesDefaultValue
Definition: globals.h:458
XMLPUBVAR int xmlLineNumbersDefaultValue
Definition: globals.h:405
XMLPUBVAR int xmlKeepBlanksDefaultValue
Definition: globals.h:396
XMLPUBVAR int xmlGetWarningsDefaultValue
Definition: globals.h:369
XMLPUBVAR int xmlLoadExtDtdDefaultValue
Definition: globals.h:414
XMLPUBVAR int xmlDoValidityCheckingDefaultValue
Definition: globals.h:328
XMLPUBVAR int xmlPedanticParserDefaultValue
Definition: globals.h:440
XMLPUBFUN void XMLCALL xmlInitParser(void)
Definition: parser.c:14676
int inputMax
Definition: parser.h:201
int replaceEntities
Definition: parser.h:189
int keepBlanks
Definition: parser.h:236
int spaceMax
Definition: parser.h:246
int loadsubset
Definition: parser.h:258
int pedantic
Definition: parser.h:255
int input_id
Definition: parser.h:312
int linenumbers
Definition: parser.h:259
int validate
Definition: parser.h:220

Referenced by xmlNewParserCtxt().

◆ xmlKeepBlanksDefault()

XMLPUBFUN int XMLCALL xmlKeepBlanksDefault ( int  val)

xmlKeepBlanksDefault: @val: int 0 or 1

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 2010 of file parserInternals.c.

2010 {
2011 int old = xmlKeepBlanksDefaultValue;
2012
2014 if (!val) xmlIndentTreeOutput = 1;
2015 return(old);
2016}
GLuint GLfloat * val
Definition: glext.h:7180
XMLPUBVAR int xmlIndentTreeOutput
Definition: globals.h:378

Referenced by main().

◆ xmlLineNumbersDefault()

XMLPUBFUN int XMLCALL xmlLineNumbersDefault ( int  val)

xmlLineNumbersDefault: @val: int 0 or 1

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 1956 of file parserInternals.c.

1956 {
1958
1960 return(old);
1961}

Referenced by main().

◆ xmlLoadExternalEntity()

◆ xmlNewIOInputStream()

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 1251 of file parserInternals.c.

1252 {
1253 xmlParserInputPtr inputStream;
1254
1255 if (input == NULL) return(NULL);
1257 xmlGenericError(xmlGenericErrorContext, "new input from I/O\n");
1258 inputStream = xmlNewInputStream(ctxt);
1259 if (inputStream == NULL) {
1260 return(NULL);
1261 }
1262 inputStream->filename = NULL;
1263 inputStream->buf = input;
1264 xmlBufResetInput(inputStream->buf->buffer, inputStream);
1265
1266 if (enc != XML_CHAR_ENCODING_NONE) {
1267 xmlSwitchEncoding(ctxt, enc);
1268 }
1269
1270 return(inputStream);
1271}
xmlParserInputPtr xmlNewInputStream(xmlParserCtxtPtr ctxt)
int xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
XMLPUBVAR int xmlParserDebugEntities
Definition: globals.h:423

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

◆ xmlNewParserCtxt()

XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt ( void  )

xmlNewParserCtxt:

Allocate and initialize a new parser context.

Returns the xmlParserCtxtPtr or NULL

Definition at line 1715 of file parserInternals.c.

1716{
1717 xmlParserCtxtPtr ctxt;
1718
1719 ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
1720 if (ctxt == NULL) {
1721 xmlErrMemory(NULL, "cannot allocate parser context\n");
1722 return(NULL);
1723 }
1724 memset(ctxt, 0, sizeof(xmlParserCtxt));
1725 if (xmlInitParserCtxt(ctxt) < 0) {
1726 xmlFreeParserCtxt(ctxt);
1727 return(NULL);
1728 }
1729 return(ctxt);
1730}
int xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39

Referenced by main(), parseAndPrintFile(), testSAX(), xmlCreateEntityParserCtxtInternal(), xmlCreateIOParserCtxt(), xmlCreateMemoryParserCtxt(), xmlCreateURLParserCtxt(), xmlReadFd(), xmlReadIO(), and xsltDocDefaultLoaderFunc().

◆ xmlParseCtxtExternalEntity()

XMLPUBFUN int XMLCALL 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 12968 of file parser.c.

12969 {
12970 void *userData;
12971
12972 if (ctx == NULL) return(-1);
12973 /*
12974 * If the user provided their own SAX callbacks, then reuse the
12975 * userData callback field, otherwise the expected setup in a
12976 * DOM builder is to have userData == ctxt
12977 */
12978 if (ctx->userData == ctx)
12979 userData = NULL;
12980 else
12981 userData = ctx->userData;
12982 return xmlParseExternalEntityPrivate(ctx->myDoc, ctx, ctx->sax,
12983 userData, ctx->depth + 1,
12984 URL, ID, lst);
12985}
#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:13005

◆ xmlParseDocument()

XMLPUBFUN int XMLCALL 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 10697 of file parser.c.

10697 {
10698 xmlChar start[4];
10699 xmlCharEncoding enc;
10700
10701 xmlInitParser();
10702
10703 if ((ctxt == NULL) || (ctxt->input == NULL))
10704 return(-1);
10705
10706 GROW;
10707
10708 /*
10709 * SAX: detecting the level.
10710 */
10711 xmlDetectSAX2(ctxt);
10712
10713 /*
10714 * SAX: beginning of the document processing.
10715 */
10716 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
10717 ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
10718 if (ctxt->instate == XML_PARSER_EOF)
10719 return(-1);
10720
10721 if ((ctxt->encoding == NULL) &&
10722 ((ctxt->input->end - ctxt->input->cur) >= 4)) {
10723 /*
10724 * Get the 4 first bytes and decode the charset
10725 * if enc != XML_CHAR_ENCODING_NONE
10726 * plug some encoding conversion routines.
10727 */
10728 start[0] = RAW;
10729 start[1] = NXT(1);
10730 start[2] = NXT(2);
10731 start[3] = NXT(3);
10732 enc = xmlDetectCharEncoding(&start[0], 4);
10733 if (enc != XML_CHAR_ENCODING_NONE) {
10734 xmlSwitchEncoding(ctxt, enc);
10735 }
10736 }
10737
10738
10739 if (CUR == 0) {
10741 return(-1);
10742 }
10743
10744 /*
10745 * Check for the XMLDecl in the Prolog.
10746 * do not GROW here to avoid the detected encoder to decode more
10747 * than just the first line, unless the amount of data is really
10748 * too small to hold "<?xml version="1.0" encoding="foo"
10749 */
10750 if ((ctxt->input->end - ctxt->input->cur) < 35) {
10751 GROW;
10752 }
10753 if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
10754
10755 /*
10756 * Note that we will switch encoding on the fly.
10757 */
10758 xmlParseXMLDecl(ctxt);
10759 if ((ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) ||
10760 (ctxt->instate == XML_PARSER_EOF)) {
10761 /*
10762 * The XML REC instructs us to stop parsing right here
10763 */
10764 return(-1);
10765 }
10766 ctxt->standalone = ctxt->input->standalone;
10768 } else {
10770 }
10771 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
10772 ctxt->sax->startDocument(ctxt->userData);
10773 if (ctxt->instate == XML_PARSER_EOF)
10774 return(-1);
10775 if ((ctxt->myDoc != NULL) && (ctxt->input != NULL) &&
10776 (ctxt->input->buf != NULL) && (ctxt->input->buf->compressed >= 0)) {
10777 ctxt->myDoc->compression = ctxt->input->buf->compressed;
10778 }
10779
10780 /*
10781 * The Misc part of the Prolog
10782 */
10783 xmlParseMisc(ctxt);
10784
10785 /*
10786 * Then possibly doc type declaration(s) and more Misc
10787 * (doctypedecl Misc*)?
10788 */
10789 GROW;
10790 if (CMP9(CUR_PTR, '<', '!', 'D', 'O', 'C', 'T', 'Y', 'P', 'E')) {
10791
10792 ctxt->inSubset = 1;
10793 xmlParseDocTypeDecl(ctxt);
10794 if (RAW == '[') {
10795 ctxt->instate = XML_PARSER_DTD;
10797 if (ctxt->instate == XML_PARSER_EOF)
10798 return(-1);
10799 }
10800
10801 /*
10802 * Create and update the external subset.
10803 */
10804 ctxt->inSubset = 2;
10805 if ((ctxt->sax != NULL) && (ctxt->sax->externalSubset != NULL) &&
10806 (!ctxt->disableSAX))
10807 ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName,
10808 ctxt->extSubSystem, ctxt->extSubURI);
10809 if (ctxt->instate == XML_PARSER_EOF)
10810 return(-1);
10811 ctxt->inSubset = 0;
10812
10813 xmlCleanSpecialAttr(ctxt);
10814
10815 ctxt->instate = XML_PARSER_PROLOG;
10816 xmlParseMisc(ctxt);
10817 }
10818
10819 /*
10820 * Time to start parsing the tree itself
10821 */
10822 GROW;
10823 if (RAW != '<') {
10824 xmlFatalErrMsg(ctxt, XML_ERR_DOCUMENT_EMPTY,
10825 "Start tag expected, '<' not found\n");
10826 } else {
10828 xmlParseElement(ctxt);
10829 ctxt->instate = XML_PARSER_EPILOG;
10830
10831
10832 /*
10833 * The Misc part at the end
10834 */
10835 xmlParseMisc(ctxt);
10836
10837 if (RAW != 0) {
10839 }
10840 ctxt->instate = XML_PARSER_EOF;
10841 }
10842
10843 /*
10844 * SAX: end of the document processing.
10845 */
10846 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
10847 ctxt->sax->endDocument(ctxt->userData);
10848
10849 /*
10850 * Remove locally kept entity definitions if the tree was not built
10851 */
10852 if ((ctxt->myDoc != NULL) &&
10854 xmlFreeDoc(ctxt->myDoc);
10855 ctxt->myDoc = NULL;
10856 }
10857
10858 if ((ctxt->wellFormed) && (ctxt->myDoc != NULL)) {
10860 if (ctxt->valid)
10862 if (ctxt->nsWellFormed)
10864 if (ctxt->options & XML_PARSE_OLD10)
10865 ctxt->myDoc->properties |= XML_DOC_OLD10;
10866 }
10867 if (! ctxt->wellFormed) {
10868 ctxt->valid = 0;
10869 return(-1);
10870 }
10871 return(0);
10872}
GLuint start
Definition: gl.h:1545
#define IS_BLANK_CH(c)
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator
Definition: globals.h:320
#define XML_DEFAULT_VERSION
Definition: parser.h:31
@ XML_DOC_WELLFORMED
Definition: tree.h:533
@ XML_DOC_NSVALID
Definition: tree.h:534
@ XML_DOC_OLD10
Definition: tree.h:535
@ XML_DOC_DTDVALID
Definition: tree.h:536
void xmlParseElement(xmlParserCtxtPtr ctxt)
Definition: parser.c:9987
static void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
Definition: parser.c:378
void xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt)
Definition: parser.c:8282
static void xmlParseInternalSubset(xmlParserCtxtPtr ctxt)
Definition: parser.c:8354
#define SKIP_BLANKS
Definition: parser.c:2145
#define CMP5(s, c1, c2, c3, c4, c5)
Definition: parser.c:2073
void xmlParseMisc(xmlParserCtxtPtr ctxt)
Definition: parser.c:10667
static void xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt)
Definition: parser.c:1401
#define RAW
Definition: parser.c:2064
#define GROW
Definition: parser.c:2117
#define CMP9(s, c1, c2, c3, c4, c5, c6, c7, c8, c9)
Definition: parser.c:2081
static void xmlDetectSAX2(xmlParserCtxtPtr ctxt)
Definition: parser.c:1094
#define SAX_COMPAT_MODE
Definition: parser.c:277
#define NXT(val)
Definition: parser.c:2066
#define CUR_PTR
Definition: parser.c:2067
#define CUR
Definition: parser.c:2065
void xmlParseXMLDecl(xmlParserCtxtPtr ctxt)
Definition: parser.c:10552
const xmlChar * version
Definition: tree.h:573
int properties
Definition: tree.h:584
int compression
Definition: tree.h:563
const xmlChar * intSubName
Definition: parser.h:239
int standalone
Definition: parser.h:73
const xmlChar * end
Definition: parser.h:60
@ XML_ERR_DOCUMENT_END
Definition: xmlerror.h:105
@ XML_ERR_DOCUMENT_EMPTY
Definition: xmlerror.h:104
XMLPUBFUN xmlChar *XMLCALL xmlCharStrdup(const char *cur)
Definition: xmlstring.c:114
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:160

Referenced by testSAX(), xmlDoRead(), and xsltDocDefaultLoaderFunc().

◆ xmlParseExtParsedEnt()

XMLPUBFUN int XMLCALL 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 10889 of file parser.c.

10889 {
10890 xmlChar start[4];
10891 xmlCharEncoding enc;
10892
10893 if ((ctxt == NULL) || (ctxt->input == NULL))
10894 return(-1);
10895
10896 xmlDetectSAX2(ctxt);
10897
10898 GROW;
10899
10900 /*
10901 * SAX: beginning of the document processing.
10902 */
10903 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
10904 ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
10905
10906 /*
10907 * Get the 4 first bytes and decode the charset
10908 * if enc != XML_CHAR_ENCODING_NONE
10909 * plug some encoding conversion routines.
10910 */
10911 if ((ctxt->input->end - ctxt->input->cur) >= 4) {
10912 start[0] = RAW;
10913 start[1] = NXT(1);
10914 start[2] = NXT(2);
10915 start[3] = NXT(3);
10916 enc = xmlDetectCharEncoding(start, 4);
10917 if (enc != XML_CHAR_ENCODING_NONE) {
10918 xmlSwitchEncoding(ctxt, enc);
10919 }
10920 }
10921
10922
10923 if (CUR == 0) {
10925 }
10926
10927 /*
10928 * Check for the XMLDecl in the Prolog.
10929 */
10930 GROW;
10931 if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
10932
10933 /*
10934 * Note that we will switch encoding on the fly.
10935 */
10936 xmlParseXMLDecl(ctxt);
10937 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
10938 /*
10939 * The XML REC instructs us to stop parsing right here
10940 */
10941 return(-1);
10942 }
10944 } else {
10946 }
10947 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
10948 ctxt->sax->startDocument(ctxt->userData);
10949 if (ctxt->instate == XML_PARSER_EOF)
10950 return(-1);
10951
10952 /*
10953 * Doing validity checking on chunk doesn't make sense
10954 */
10956 ctxt->validate = 0;
10957 ctxt->loadsubset = 0;
10958 ctxt->depth = 0;
10959
10960 xmlParseContent(ctxt);
10961 if (ctxt->instate == XML_PARSER_EOF)
10962 return(-1);
10963
10964 if ((RAW == '<') && (NXT(1) == '/')) {
10966 } else if (RAW != 0) {
10968 }
10969
10970 /*
10971 * SAX: end of the document processing.
10972 */
10973 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
10974 ctxt->sax->endDocument(ctxt->userData);
10975
10976 if (! ctxt->wellFormed) return(-1);
10977 return(0);
10978}
void xmlParseContent(xmlParserCtxtPtr ctxt)
Definition: parser.c:9958
@ XML_ERR_NOT_WELL_BALANCED
Definition: xmlerror.h:185
@ XML_ERR_EXTRA_CONTENT
Definition: xmlerror.h:186

◆ xmlParseInNodeContext()

XMLPUBFUN xmlParserErrors XMLCALL 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 13496 of file parser.c.

13497 {
13498#ifdef SAX2
13499 xmlParserCtxtPtr ctxt;
13500 xmlDocPtr doc = NULL;
13501 xmlNodePtr fake, cur;
13502 int nsnr = 0;
13503
13505
13506 /*
13507 * check all input parameters, grab the document
13508 */
13509 if ((lst == NULL) || (node == NULL) || (data == NULL) || (datalen < 0))
13510 return(XML_ERR_INTERNAL_ERROR);
13511 switch (node->type) {
13512 case XML_ELEMENT_NODE:
13513 case XML_ATTRIBUTE_NODE:
13514 case XML_TEXT_NODE:
13517 case XML_PI_NODE:
13518 case XML_COMMENT_NODE:
13519 case XML_DOCUMENT_NODE:
13521 break;
13522 default:
13523 return(XML_ERR_INTERNAL_ERROR);
13524
13525 }
13526 while ((node != NULL) && (node->type != XML_ELEMENT_NODE) &&
13527 (node->type != XML_DOCUMENT_NODE) &&
13528 (node->type != XML_HTML_DOCUMENT_NODE))
13529 node = node->parent;
13530 if (node == NULL)
13531 return(XML_ERR_INTERNAL_ERROR);
13532 if (node->type == XML_ELEMENT_NODE)
13533 doc = node->doc;
13534 else
13535 doc = (xmlDocPtr) node;
13536 if (doc == NULL)
13537 return(XML_ERR_INTERNAL_ERROR);
13538
13539 /*
13540 * allocate a context and set-up everything not related to the
13541 * node position in the tree
13542 */
13543 if (doc->type == XML_DOCUMENT_NODE)
13544 ctxt = xmlCreateMemoryParserCtxt((char *) data, datalen);
13545#ifdef LIBXML_HTML_ENABLED
13546 else if (doc->type == XML_HTML_DOCUMENT_NODE) {
13547 ctxt = htmlCreateMemoryParserCtxt((char *) data, datalen);
13548 /*
13549 * When parsing in context, it makes no sense to add implied
13550 * elements like html/body/etc...
13551 */
13552 options |= HTML_PARSE_NOIMPLIED;
13553 }
13554#endif
13555 else
13556 return(XML_ERR_INTERNAL_ERROR);
13557
13558 if (ctxt == NULL)
13559 return(XML_ERR_NO_MEMORY);
13560
13561 /*
13562 * Use input doc's dict if present, else assure XML_PARSE_NODICT is set.
13563 * We need a dictionary for xmlDetectSAX2, so if there's no doc dict
13564 * we must wait until the last moment to free the original one.
13565 */
13566 if (doc->dict != NULL) {
13567 if (ctxt->dict != NULL)
13568 xmlDictFree(ctxt->dict);
13569 ctxt->dict = doc->dict;
13570 } else
13572
13573 if (doc->encoding != NULL) {
13575
13576 if (ctxt->encoding != NULL)
13577 xmlFree((xmlChar *) ctxt->encoding);
13578 ctxt->encoding = xmlStrdup((const xmlChar *) doc->encoding);
13579
13580 hdlr = xmlFindCharEncodingHandler((const char *) doc->encoding);
13581 if (hdlr != NULL) {
13582 xmlSwitchToEncoding(ctxt, hdlr);
13583 } else {
13585 }
13586 }
13587
13589 xmlDetectSAX2(ctxt);
13590 ctxt->myDoc = doc;
13591 /* parsing in context, i.e. as within existing content */
13592 ctxt->input_id = 2;
13594
13595 fake = xmlNewDocComment(node->doc, NULL);
13596 if (fake == NULL) {
13597 xmlFreeParserCtxt(ctxt);
13598 return(XML_ERR_NO_MEMORY);
13599 }
13600 xmlAddChild(node, fake);
13601
13602 if (node->type == XML_ELEMENT_NODE) {
13603 nodePush(ctxt, node);
13604 /*
13605 * initialize the SAX2 namespaces stack
13606 */
13607 cur = node;
13608 while ((cur != NULL) && (cur->type == XML_ELEMENT_NODE)) {
13609 xmlNsPtr ns = cur->nsDef;
13610 const xmlChar *iprefix, *ihref;
13611
13612 while (ns != NULL) {
13613 if (ctxt->dict) {
13614 iprefix = xmlDictLookup(ctxt->dict, ns->prefix, -1);
13615 ihref = xmlDictLookup(ctxt->dict, ns->href, -1);
13616 } else {
13617 iprefix = ns->prefix;
13618 ihref = ns->href;
13619 }
13620
13621 if (xmlGetNamespace(ctxt, iprefix) == NULL) {
13622 nsPush(ctxt, iprefix, ihref);
13623 nsnr++;
13624 }
13625 ns = ns->next;
13626 }
13627 cur = cur->parent;
13628 }
13629 }
13630
13631 if ((ctxt->validate) || (ctxt->replaceEntities != 0)) {
13632 /*
13633 * ID/IDREF registration will be done in xmlValidateElement below
13634 */
13635 ctxt->loadsubset |= XML_SKIP_IDS;
13636 }
13637
13638#ifdef LIBXML_HTML_ENABLED
13639 if (doc->type == XML_HTML_DOCUMENT_NODE)
13640 __htmlParseContent(ctxt);
13641 else
13642#endif
13643 xmlParseContent(ctxt);
13644
13645 nsPop(ctxt, nsnr);
13646 if ((RAW == '<') && (NXT(1) == '/')) {
13648 } else if (RAW != 0) {
13650 }
13651 if ((ctxt->node != NULL) && (ctxt->node != node)) {
13653 ctxt->wellFormed = 0;
13654 }
13655
13656 if (!ctxt->wellFormed) {
13657 if (ctxt->errNo == 0)
13659 else
13660 ret = (xmlParserErrors)ctxt->errNo;
13661 } else {
13662 ret = XML_ERR_OK;
13663 }
13664
13665 /*
13666 * Return the newly created nodeset after unlinking it from
13667 * the pseudo sibling.
13668 */
13669
13670 cur = fake->next;
13671 fake->next = NULL;
13672 node->last = fake;
13673
13674 if (cur != NULL) {
13675 cur->prev = NULL;
13676 }
13677
13678 *lst = cur;
13679
13680 while (cur != NULL) {
13681 cur->parent = NULL;
13682 cur = cur->next;
13683 }
13684
13685 xmlUnlinkNode(fake);
13686 xmlFreeNode(fake);
13687
13688
13689 if (ret != XML_ERR_OK) {
13690 xmlFreeNodeList(*lst);
13691 *lst = NULL;
13692 }
13693
13694 if (doc->dict != NULL)
13695 ctxt->dict = NULL;
13696 xmlFreeParserCtxt(ctxt);
13697
13698 return(ret);
13699#else /* !SAX2 */
13700 return(XML_ERR_INTERNAL_ERROR);
13701#endif
13702}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1031
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:867
#define XML_SKIP_IDS
Definition: parser.h:154
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
xmlDoc * xmlDocPtr
Definition: tree.h:550
@ XML_ATTRIBUTE_NODE
Definition: tree.h:161
@ XML_DOCUMENT_NODE
Definition: tree.h:168
@ XML_CDATA_SECTION_NODE
Definition: tree.h:163
@ XML_TEXT_NODE
Definition: tree.h:162
@ XML_PI_NODE
Definition: tree.h:166
@ XML_COMMENT_NODE
Definition: tree.h:167
@ XML_HTML_DOCUMENT_NODE
Definition: tree.h:172
@ XML_ELEMENT_NODE
Definition: tree.h:160
@ XML_ENTITY_REF_NODE
Definition: tree.h:164
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocComment(xmlDocPtr doc, const xmlChar *content)
XMLPUBFUN void XMLCALL xmlFreeNodeList(xmlNodePtr cur)
XMLPUBFUN void XMLCALL xmlFreeNode(xmlNodePtr cur)
int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value)
Definition: parser.c:1801
static int nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL)
Definition: parser.c:1631
static const xmlChar * xmlGetNamespace(xmlParserCtxtPtr ctxt, const xmlChar *prefix)
Definition: parser.c:8760
static int nsPop(xmlParserCtxtPtr ctxt, int nr)
Definition: parser.c:1681
Definition: tree.h:551
const xmlChar * encoding
Definition: tree.h:574
struct _xmlDict * dict
Definition: tree.h:580
xmlElementType type
Definition: tree.h:553
struct _xmlNode * next
Definition: tree.h:496
Definition: tree.h:389
Definition: mxnamespace.c:45
BSTR prefix
Definition: mxnamespace.c:46
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 XMLCALL xmlParserAddNodeInfo ( xmlParserCtxtPtr  ctxt,
const xmlParserNodeInfoPtr  info 
)

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

Insert node info record into the sorted sequence

Definition at line 1865 of file parserInternals.c.

1867{
1868 unsigned long pos;
1869
1870 if ((ctxt == NULL) || (info == NULL)) return;
1871
1872 /* Find pos and check to see if node is already in the sequence */
1874 info->node);
1875
1876 if ((pos < ctxt->node_seq.length) &&
1877 (ctxt->node_seq.buffer != NULL) &&
1878 (ctxt->node_seq.buffer[pos].node == info->node)) {
1879 ctxt->node_seq.buffer[pos] = *info;
1880 }
1881
1882 /* Otherwise, we need to add new node to buffer */
1883 else {
1884 if ((ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) ||
1885 (ctxt->node_seq.buffer == NULL)) {
1886 xmlParserNodeInfo *tmp_buffer;
1887 unsigned int byte_size;
1888
1889 if (ctxt->node_seq.maximum == 0)
1890 ctxt->node_seq.maximum = 2;
1891 byte_size = (sizeof(*ctxt->node_seq.buffer) *
1892 (2 * ctxt->node_seq.maximum));
1893
1894 if (ctxt->node_seq.buffer == NULL)
1895 tmp_buffer = (xmlParserNodeInfo *) xmlMalloc(byte_size);
1896 else
1897 tmp_buffer =
1899 byte_size);
1900
1901 if (tmp_buffer == NULL) {
1902 xmlErrMemory(ctxt, "failed to allocate buffer\n");
1903 return;
1904 }
1905 ctxt->node_seq.buffer = tmp_buffer;
1906 ctxt->node_seq.maximum *= 2;
1907 }
1908
1909 /* If position is not at end, move elements out of the way */
1910 if (pos != ctxt->node_seq.length) {
1911 unsigned long i;
1912
1913 for (i = ctxt->node_seq.length; i > pos; i--)
1914 ctxt->node_seq.buffer[i] = ctxt->node_seq.buffer[i - 1];
1915 }
1916
1917 /* Copy element and increase length */
1918 ctxt->node_seq.buffer[pos] = *info;
1919 ctxt->node_seq.length++;
1920 }
1921}
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)
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:250
const struct _xmlNode * node
Definition: parser.h:88

Referenced by xmlParseElementEnd(), xmlParseElementStart(), and xmlSAX2EndElementNs().

◆ xmlParserFindNodeInfo()

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

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

Find the parser node info struct for a given node

Returns an xmlParserNodeInfo block pointer or NULL

Definition at line 1765 of file parserInternals.c.

1766{
1767 unsigned long pos;
1768
1769 if ((ctx == NULL) || (node == NULL))
1770 return (NULL);
1771 /* Find position where node should be at */
1772 pos = xmlParserFindNodeInfoIndex(&ctx->node_seq, node);
1773 if (pos < ctx->node_seq.length
1774 && ctx->node_seq.buffer[pos].node == node)
1775 return &ctx->node_seq.buffer[pos];
1776 else
1777 return NULL;
1778}

◆ xmlParserFindNodeInfoIndex()

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

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

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 1826 of file parserInternals.c.

1828{
1829 unsigned long upper, lower, middle;
1830 int found = 0;
1831
1832 if ((seq == NULL) || (node == NULL))
1833 return ((unsigned long) -1);
1834
1835 /* Do a binary search for the key */
1836 lower = 1;
1837 upper = seq->length;
1838 middle = 0;
1839 while (lower <= upper && !found) {
1840 middle = lower + (upper - lower) / 2;
1841 if (node == seq->buffer[middle - 1].node)
1842 found = 1;
1843 else if (node < seq->buffer[middle - 1].node)
1844 upper = middle - 1;
1845 else
1846 lower = middle + 1;
1847 }
1848
1849 /* Return position */
1850 if (middle == 0 || seq->buffer[middle - 1].node < node)
1851 return middle;
1852 else
1853 return middle - 1;
1854}

Referenced by xmlParserAddNodeInfo(), and xmlParserFindNodeInfo().

◆ xmlParserInputGrow()

XMLPUBFUN int XMLCALL xmlParserInputGrow ( xmlParserInputPtr  in,
int  len 
)

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

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 284 of file parserInternals.c.

284 {
285 int ret;
286 size_t indx;
287
288 if ((in == NULL) || (len < 0)) return(-1);
289#ifdef DEBUG_INPUT
291#endif
292 if (in->buf == NULL) return(-1);
293 if (in->base == NULL) return(-1);
294 if (in->cur == NULL) return(-1);
295 if (in->buf->buffer == NULL) return(-1);
296
298
299 indx = in->cur - in->base;
300 if (xmlBufUse(in->buf->buffer) > (unsigned int) indx + INPUT_CHUNK) {
301
303
304 return(0);
305 }
306 if (in->buf->readcallback != NULL) {
308 } else
309 return(0);
310
311 in->base = xmlBufContent(in->buf->buffer);
312 in->cur = in->base + indx;
313 in->end = xmlBufEnd(in->buf->buffer);
314
316
317 return(ret);
318}
#define CHECK_BUFFER(in)
#define INPUT_CHUNK
XMLPUBFUN xmlChar *XMLCALL xmlBufEnd(xmlBufPtr buf)
Definition: buf.c:571
XMLPUBFUN size_t XMLCALL xmlBufUse(const xmlBufPtr buf)
Definition: buf.c:633
XMLPUBFUN xmlChar *XMLCALL xmlBufContent(const xmlBuf *buf)
Definition: buf.c:553
XMLPUBFUN int XMLCALL xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len)

Referenced by xmlCurrentChar(), xmlGROW(), xmlNextChar(), xmlPopInput(), xmlSHRINK(), and xmlSkipBlankChars().

◆ xmlParserInputRead()

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

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

This function was internal and is deprecated.

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

Definition at line 268 of file parserInternals.c.

268 {
269 return(-1);
270}

◆ xmlPedanticParserDefault()

XMLPUBFUN int XMLCALL xmlPedanticParserDefault ( int  val)

xmlPedanticParserDefault: @val: int 0 or 1

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 1938 of file parserInternals.c.

1938 {
1940
1942 return(old);
1943}

Referenced by main().

◆ xmlReadDoc()

XMLPUBFUN xmlDocPtr XMLCALL 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 15204 of file parser.c.

15205{
15206 xmlParserCtxtPtr ctxt;
15207
15208 if (cur == NULL)
15209 return (NULL);
15210 xmlInitParser();
15211
15213 if (ctxt == NULL)
15214 return (NULL);
15215 return (xmlDoRead(ctxt, URL, encoding, options, 0));
15216}
xmlParserCtxtPtr xmlCreateDocParserCtxt(const xmlChar *cur)
Definition: parser.c:14542

◆ xmlReadFd()

XMLPUBFUN xmlDocPtr XMLCALL 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 15278 of file parser.c.

15279{
15280 xmlParserCtxtPtr ctxt;
15283
15284 if (fd < 0)
15285 return (NULL);
15286 xmlInitParser();
15287
15289 if (input == NULL)
15290 return (NULL);
15291 input->closecallback = NULL;
15292 ctxt = xmlNewParserCtxt();
15293 if (ctxt == NULL) {
15295 return (NULL);
15296 }
15298 if (stream == NULL) {
15300 xmlFreeParserCtxt(ctxt);
15301 return (NULL);
15302 }
15303 inputPush(ctxt, stream);
15304 return (xmlDoRead(ctxt, URL, encoding, options, 0));
15305}

Referenced by parseAndPrintFile().

◆ xmlReadFile()

XMLPUBFUN xmlDocPtr XMLCALL 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 15229 of file parser.c.

15230{
15231 xmlParserCtxtPtr ctxt;
15232
15233 xmlInitParser();
15235 if (ctxt == NULL)
15236 return (NULL);
15237 return (xmlDoRead(ctxt, NULL, encoding, options, 0));
15238}
xmlParserCtxtPtr xmlCreateURLParserCtxt(const char *filename, int options)
Definition: parser.c:14051

Referenced by parseAndPrintFile().

◆ xmlReadIO()

XMLPUBFUN xmlDocPtr XMLCALL 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 15321 of file parser.c.

15323{
15324 xmlParserCtxtPtr ctxt;
15327
15328 if (ioread == NULL)
15329 return (NULL);
15330 xmlInitParser();
15331
15332 input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
15334 if (input == NULL) {
15335 if (ioclose != NULL)
15336 ioclose(ioctx);
15337 return (NULL);
15338 }
15339 ctxt = xmlNewParserCtxt();
15340 if (ctxt == NULL) {
15342 return (NULL);
15343 }
15345 if (stream == NULL) {
15347 xmlFreeParserCtxt(ctxt);
15348 return (NULL);
15349 }
15350 inputPush(ctxt, stream);
15351 return (xmlDoRead(ctxt, URL, encoding, options, 0));
15352}

Referenced by parseAndPrintFile().

◆ xmlReadMemory()

XMLPUBFUN xmlDocPtr XMLCALL 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 15253 of file parser.c.

15254{
15255 xmlParserCtxtPtr ctxt;
15256
15257 xmlInitParser();
15259 if (ctxt == NULL)
15260 return (NULL);
15261 return (xmlDoRead(ctxt, URL, encoding, options, 0));
15262}

Referenced by parseAndPrintFile().

◆ xmlSetExternalEntityLoader()

XMLPUBFUN void XMLCALL xmlSetExternalEntityLoader ( xmlExternalEntityLoader  f)

Referenced by main().

◆ xmlStopParser()

XMLPUBFUN void XMLCALL xmlStopParser ( xmlParserCtxtPtr  ctxt)

xmlStopParser: @ctxt: an XML parser context

Blocks further parser processing

Definition at line 12583 of file parser.c.

12583 {
12584 if (ctxt == NULL)
12585 return;
12586 xmlHaltParser(ctxt);
12587 ctxt->errNo = XML_ERR_USER_STOP;
12588}
static void xmlHaltParser(xmlParserCtxtPtr ctxt)
Definition: parser.c:12549
@ XML_ERR_USER_STOP
Definition: xmlerror.h:211

Referenced by xmlNextChar(), and xmlSwitchEncoding().

◆ xmlSubstituteEntitiesDefault()

XMLPUBFUN int XMLCALL xmlSubstituteEntitiesDefault ( int  val)

xmlSubstituteEntitiesDefault: @val: int 0 or 1

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 1978 of file parserInternals.c.

1978 {
1980
1982 return(old);
1983}

Referenced by main().