ReactOS  0.4.15-dev-3451-gf606fec
parser.h File Reference
#include <stdarg.h>
#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 *) typede void) (XMLCDECL *errorSAXFunc) (void *ctx
 
typedef void(XMLCDECL *) typedef const char msg)
 
typedef void(XMLCDECL *) typedef const cha LIBXML_ATTR_FORMAT) (2, 3)
 
typedef void(XMLCDECLfatalErrorSAXFunc) (void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
 
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 148 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 33 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 139 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 673 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 156 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 445 of file parser.h.

◆ attributeSAXFunc

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

Definition at line 535 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 598 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 555 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 588 of file parser.h.

◆ elementDeclSAXFunc

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

Definition at line 461 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 503 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 715 of file parser.h.

◆ endElementSAXFunc

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

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

◆ externalSubsetSAXFunc

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

Definition at line 377 of file parser.h.

◆ fatalErrorSAXFunc

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

◆ getEntitySAXFunc

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

Definition at line 390 of file parser.h.

◆ getParameterEntitySAXFunc

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

Definition at line 401 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 661 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 651 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 567 of file parser.h.

◆ internalSubsetSAXFunc

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

Definition at line 364 of file parser.h.

◆ isStandaloneSAXFunc

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

◆ LIBXML_ATTR_FORMAT

static void XMLCDECL LIBXML_ATTR_FORMAT

xmlWarningMsg: @ctxt: an XML parser context @error: the error number @msg: the error message @str1: extra data @str2: extra data

Handle a warning.

xmlValidityError: @ctxt: an XML parser context @error: the error number @msg: the error message @str1: extra data

Handle a validity error.

xmlFatalErrMsgInt: @ctxt: an XML parser context @error: the error number @msg: the error message @val: an integer value

Handle a fatal parser error, i.e. violating Well-Formedness constraints

xmlFatalErrMsgStrIntStr: @ctxt: an XML parser context @error: the error number @msg: the error message @str1: an string info @val: an integer value @str2: an string info

Handle a fatal parser error, i.e. violating Well-Formedness constraints

xmlFatalErrMsgStr: @ctxt: an XML parser context @error: the error number @msg: the error message @val: a string value

Handle a fatal parser error, i.e. violating Well-Formedness constraints

xmlErrMsgStr: @ctxt: an XML parser context @error: the error number @msg: the error message @val: a string value

Handle a non fatal parser error

xmlNsErr: @ctxt: an XML parser context @error: the error number @msg: the message @info1: extra information string @info2: extra information string

Handle a fatal parser error, i.e. violating Well-Formedness constraints

xmlNsWarn @ctxt: an XML parser context @error: the error number @msg: the message @info1: extra information string @info2: extra information string

Handle a namespace warning error

xmlFatalErrMsg: @ctxt: an XML parser context @error: the error number @msg: the error message @str1: an error string @str2: an error string

Handle a fatal parser error, i.e. violating Well-Formedness constraints

xmlWarnMsg: @ctxt: an XML parser context @error: the error number @msg: the error message @str1: an error string @str2: an error string

Handle a parser warning

xmlNsErrMsg: @ctxt: an XML parser context @error: the error number @msg: the error message @str1: an error string @str2: an error string

Handle a namespace error

xmlNsWarnMsg: @ctxt: an XML parser context @error: the error number @msg: the error message @str1: an error string

Handle a namespace warning

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

Display and format a warning messages, gives file, line, position and extra parameters.

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

Display and format an validity error messages, gives file, line, position and extra parameters.

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

Display and format a validity warning messages, gives file, line, position and extra parameters.

warningDebug: @ctxt: An XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a warning messages, gives file, line, position and extra parameters.

errorDebug: @ctxt: An XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a error messages, gives file, line, position and extra parameters.

fatalErrorDebug: @ctxt: An XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a fatalError messages, gives file, line, position and extra parameters.

Definition at line 621 of file parser.h.

◆ msg

typedef void(XMLCDECL *) typedef const char msg)

Definition at line 621 of file parser.h.

◆ notationDeclSAXFunc

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

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

◆ referenceSAXFunc

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

Definition at line 545 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 352 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 488 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 496 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 694 of file parser.h.

◆ startElementSAXFunc

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

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

◆ void

typedef void(XMLCDECL *) typede void) (XMLCDECL *errorSAXFunc)(void *ctx

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 620 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 610 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 804 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 52 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 86 of file parser.h.

◆ xmlParserNodeInfoPtr

Definition at line 87 of file parser.h.

◆ xmlParserNodeInfoSeq

Definition at line 98 of file parser.h.

◆ xmlParserNodeInfoSeqPtr

Definition at line 99 of file parser.h.

◆ xmlSAXHandlerV1

Definition at line 760 of file parser.h.

◆ xmlSAXHandlerV1Ptr

Definition at line 761 of file parser.h.

◆ xmlStartTag

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

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

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

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

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

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

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

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 2863 of file encoding.c.

2863  {
2865 
2866  if (ctxt == NULL) return(-1);
2867  in = ctxt->input;
2868  if (in == NULL) return(-1);
2869  if ((in->buf != NULL) && (in->buf->encoder != NULL)) {
2870  unsigned int unused = 0;
2871  xmlCharEncodingHandler * handler = in->buf->encoder;
2872  /*
2873  * Encoding conversion, compute the number of unused original
2874  * bytes from the input not consumed and subtract that from
2875  * the raw consumed value, this is not a cheap operation
2876  */
2877  if (in->end - in->cur > 0) {
2878  unsigned char convbuf[32000];
2879  const unsigned char *cur = (const unsigned char *)in->cur;
2880  int toconv = in->end - in->cur, written = 32000;
2881 
2882  int ret;
2883 
2884  do {
2885  toconv = in->end - cur;
2886  written = 32000;
2887  ret = xmlEncOutputChunk(handler, &convbuf[0], &written,
2888  cur, &toconv);
2889  if (ret < 0) {
2890  if (written > 0)
2891  ret = -2;
2892  else
2893  return(-1);
2894  }
2895  unused += written;
2896  cur += toconv;
2897  } while (ret == -2);
2898  }
2899  if (in->buf->rawconsumed < unused)
2900  return(-1);
2901  return(in->buf->rawconsumed - unused);
2902  }
2903  return(in->consumed + (in->cur - in->base));
2904 }
xmlParserInputPtr input
Definition: parser.h:201
static int xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
Definition: encoding.c:2004
WORD unused[29]
Definition: crypt.c:1155
int ret
FxCollectionEntry * cur
GLuint in
Definition: glext.h:9616
#define NULL
Definition: types.h:112
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786

◆ 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 14732 of file parser.c.

14732  {
14733  if (!xmlParserInitialized)
14734  return;
14735 
14737 #ifdef LIBXML_CATALOG_ENABLED
14738  xmlCatalogCleanup();
14739 #endif
14740  xmlDictCleanup();
14742 #ifdef LIBXML_OUTPUT_ENABLED
14743  xmlCleanupOutputCallbacks();
14744 #endif
14745 #ifdef LIBXML_SCHEMAS_ENABLED
14746  xmlSchemaCleanupTypes();
14747  xmlRelaxNGCleanupTypes();
14748 #endif
14751  xmlCleanupThreads(); /* must be last if called not from the main thread */
14752  xmlCleanupMemory();
14754 }
XMLPUBFUN void XMLCALL xmlCleanupGlobals(void)
Definition: globals.c:58
XMLPUBFUN void XMLCALL xmlCleanupInputCallbacks(void)
XMLPUBFUN void XMLCALL xmlCleanupThreads(void)
Definition: threads.c:906
XMLPUBFUN void XMLCALL xmlCleanupCharEncodingHandlers(void)
Definition: encoding.c:1465
XMLPUBFUN void XMLCALL xmlCleanupMemory(void)
Definition: xmlmemory.c:1008
XMLPUBFUN void XMLCALL xmlResetLastError(void)
XMLPUBFUN void XMLCALL xmlDictCleanup(void)
Definition: dict.c:222
static int xmlParserInitialized
Definition: parser.c:14659

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

1951 {
1952  if (seq == NULL)
1953  return;
1954  if (seq->buffer != NULL)
1955  xmlFree(seq->buffer);
1956  xmlInitNodeInfoSeq(seq);
1957 }
xmlParserNodeInfo * buffer
Definition: parser.h:103
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
void xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
#define NULL
Definition: types.h:112

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

1892 {
1893  if (ctxt==NULL)
1894  return;
1895  xmlClearNodeInfoSeq(&ctxt->node_seq);
1896  xmlCtxtReset(ctxt);
1897 }
void xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
XMLPUBFUN void XMLCALL xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14795
#define NULL
Definition: types.h:112
xmlParserNodeInfoSeq node_seq
Definition: parser.h:213

◆ 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 14536 of file parser.c.

14536  {
14537  int len;
14538 
14539  if (cur == NULL)
14540  return(NULL);
14541  len = xmlStrlen(cur);
14542  return(xmlCreateMemoryParserCtxt((const char *)cur, len));
14543 }
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:425
GLenum GLsizei len
Definition: glext.h:6722
FxCollectionEntry * cur
xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size)
Definition: parser.c:14333
#define NULL
Definition: types.h:112

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 12600 of file parser.c.

12602  {
12603  xmlParserCtxtPtr ctxt;
12604  xmlParserInputPtr inputStream;
12606 
12607  if (ioread == NULL) return(NULL);
12608 
12609  buf = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, enc);
12610  if (buf == NULL) {
12611  if (ioclose != NULL)
12612  ioclose(ioctx);
12613  return (NULL);
12614  }
12615 
12616  ctxt = xmlNewParserCtxt();
12617  if (ctxt == NULL) {
12619  return(NULL);
12620  }
12621  if (sax != NULL) {
12622 #ifdef LIBXML_SAX1_ENABLED
12623  if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
12624 #endif /* LIBXML_SAX1_ENABLED */
12625  xmlFree(ctxt->sax);
12626  ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
12627  if (ctxt->sax == NULL) {
12628  xmlErrMemory(ctxt, NULL);
12629  xmlFreeParserCtxt(ctxt);
12630  return(NULL);
12631  }
12632  memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
12633  if (sax->initialized == XML_SAX2_MAGIC)
12634  memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
12635  else
12636  memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
12637  if (user_data != NULL)
12638  ctxt->userData = user_data;
12639  }
12640 
12641  inputStream = xmlNewIOInputStream(ctxt, buf, enc);
12642  if (inputStream == NULL) {
12643  xmlFreeParserCtxt(ctxt);
12644  return(NULL);
12645  }
12646  inputPush(ctxt, inputStream);
12647 
12648  return(ctxt);
12649 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
#define XML_SAX2_MAGIC
Definition: parser.h:673
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
static int sax
Definition: xmllint.c:199
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler
Definition: globals.h:321
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
xmlSAXHandler * xmlSAXHandlerPtr
Definition: tree.h:45
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _xmlSAXHandler * sax
Definition: parser.h:187
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
#define memset(x, y, z)
Definition: compat.h:39
void * userData
Definition: parser.h:188

◆ 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 15360 of file parser.c.

15362 {
15364 
15365  if (cur == NULL)
15366  return (NULL);
15367  if (ctxt == NULL)
15368  return (NULL);
15369  xmlInitParser();
15370 
15371  xmlCtxtReset(ctxt);
15372 
15374  if (stream == NULL) {
15375  return (NULL);
15376  }
15377  inputPush(ctxt, stream);
15378  return (xmlDoRead(ctxt, URL, encoding, options, 1));
15379 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15151
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14795
void xmlInitParser(void)
Definition: parser.c:14670
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
ed encoding
Definition: write.c:2825
FxCollectionEntry * cur
#define NULL
Definition: types.h:112

◆ 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 15475 of file parser.c.

15477 {
15480 
15481  if (fd < 0)
15482  return (NULL);
15483  if (ctxt == NULL)
15484  return (NULL);
15485  xmlInitParser();
15486 
15487  xmlCtxtReset(ctxt);
15488 
15489 
15491  if (input == NULL)
15492  return (NULL);
15493  input->closecallback = NULL;
15495  if (stream == NULL) {
15497  return (NULL);
15498  }
15499  inputPush(ctxt, stream);
15500  return (xmlDoRead(ctxt, URL, encoding, options, 1));
15501 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15151
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
static int fd
Definition: io.c:51
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14795
void xmlInitParser(void)
Definition: parser.c:14670
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
ed encoding
Definition: write.c:2825
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc)
GLenum GLenum GLenum input
Definition: glext.h:9031
#define NULL
Definition: types.h:112

◆ 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 15394 of file parser.c.

15396 {
15398 
15399  if (filename == NULL)
15400  return (NULL);
15401  if (ctxt == NULL)
15402  return (NULL);
15403  xmlInitParser();
15404 
15405  xmlCtxtReset(ctxt);
15406 
15408  if (stream == NULL) {
15409  return (NULL);
15410  }
15411  inputPush(ctxt, stream);
15412  return (xmlDoRead(ctxt, NULL, encoding, options, 1));
15413 }
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15151
const char * filename
Definition: ioapi.h:135
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14795
void xmlInitParser(void)
Definition: parser.c:14670
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
XMLPUBFUN xmlParserInputPtr XMLCALL xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
ed encoding
Definition: write.c:2825
#define NULL
Definition: types.h:112

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 15519 of file parser.c.

15523 {
15526 
15527  if (ioread == NULL)
15528  return (NULL);
15529  if (ctxt == NULL)
15530  return (NULL);
15531  xmlInitParser();
15532 
15533  xmlCtxtReset(ctxt);
15534 
15535  input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
15537  if (input == NULL) {
15538  if (ioclose != NULL)
15539  ioclose(ioctx);
15540  return (NULL);
15541  }
15543  if (stream == NULL) {
15545  return (NULL);
15546  }
15547  inputPush(ctxt, stream);
15548  return (xmlDoRead(ctxt, URL, encoding, options, 1));
15549 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15151
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14795
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
void xmlInitParser(void)
Definition: parser.c:14670
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
ed encoding
Definition: write.c:2825
GLenum GLenum GLenum input
Definition: glext.h:9031
#define NULL
Definition: types.h:112

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 15430 of file parser.c.

15432 {
15435 
15436  if (ctxt == NULL)
15437  return (NULL);
15438  if (buffer == NULL)
15439  return (NULL);
15440  xmlInitParser();
15441 
15442  xmlCtxtReset(ctxt);
15443 
15445  if (input == NULL) {
15446  return(NULL);
15447  }
15448 
15450  if (stream == NULL) {
15452  return(NULL);
15453  }
15454 
15455  inputPush(ctxt, stream);
15456  return (xmlDoRead(ctxt, URL, encoding, options, 1));
15457 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15151
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
GLuint buffer
Definition: glext.h:5915
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14795
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc)
void xmlInitParser(void)
Definition: parser.c:14670
GLsizeiptr size
Definition: glext.h:5919
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
ed encoding
Definition: write.c:2825
GLenum GLenum GLenum input
Definition: glext.h:9031
#define NULL
Definition: types.h:112

Referenced by parseAndPrintFile().

◆ xmlCtxtReset()

XMLPUBFUN void XMLCALL xmlCtxtReset ( xmlParserCtxtPtr  ctxt)

xmlCtxtReset: @ctxt: an XML parser context

Reset a parser context

Definition at line 14795 of file parser.c.

14796 {
14798  xmlDictPtr dict;
14799 
14800  if (ctxt == NULL)
14801  return;
14802 
14803  dict = ctxt->dict;
14804 
14805  while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
14807  }
14808  ctxt->inputNr = 0;
14809  ctxt->input = NULL;
14810 
14811  ctxt->spaceNr = 0;
14812  if (ctxt->spaceTab != NULL) {
14813  ctxt->spaceTab[0] = -1;
14814  ctxt->space = &ctxt->spaceTab[0];
14815  } else {
14816  ctxt->space = NULL;
14817  }
14818 
14819 
14820  ctxt->nodeNr = 0;
14821  ctxt->node = NULL;
14822 
14823  ctxt->nameNr = 0;
14824  ctxt->name = NULL;
14825 
14826  DICT_FREE(ctxt->version);
14827  ctxt->version = NULL;
14828  DICT_FREE(ctxt->encoding);
14829  ctxt->encoding = NULL;
14830  DICT_FREE(ctxt->directory);
14831  ctxt->directory = NULL;
14832  DICT_FREE(ctxt->extSubURI);
14833  ctxt->extSubURI = NULL;
14834  DICT_FREE(ctxt->extSubSystem);
14835  ctxt->extSubSystem = NULL;
14836  if (ctxt->myDoc != NULL)
14837  xmlFreeDoc(ctxt->myDoc);
14838  ctxt->myDoc = NULL;
14839 
14840  ctxt->standalone = -1;
14841  ctxt->hasExternalSubset = 0;
14842  ctxt->hasPErefs = 0;
14843  ctxt->html = 0;
14844  ctxt->external = 0;
14845  ctxt->instate = XML_PARSER_START;
14846  ctxt->token = 0;
14847 
14848  ctxt->wellFormed = 1;
14849  ctxt->nsWellFormed = 1;
14850  ctxt->disableSAX = 0;
14851  ctxt->valid = 1;
14852 #if 0
14853  ctxt->vctxt.userData = ctxt;
14856 #endif
14857  ctxt->record_info = 0;
14858  ctxt->checkIndex = 0;
14859  ctxt->inSubset = 0;
14860  ctxt->errNo = XML_ERR_OK;
14861  ctxt->depth = 0;
14863  ctxt->catalogs = NULL;
14864  ctxt->nbentities = 0;
14865  ctxt->sizeentities = 0;
14866  ctxt->sizeentcopy = 0;
14867  xmlInitNodeInfoSeq(&ctxt->node_seq);
14868 
14869  if (ctxt->attsDefault != NULL) {
14871  ctxt->attsDefault = NULL;
14872  }
14873  if (ctxt->attsSpecial != NULL) {
14874  xmlHashFree(ctxt->attsSpecial, NULL);
14875  ctxt->attsSpecial = NULL;
14876  }
14877 
14878 #ifdef LIBXML_CATALOG_ENABLED
14879  if (ctxt->catalogs != NULL)
14880  xmlCatalogFreeLocal(ctxt->catalogs);
14881 #endif
14882  if (ctxt->lastError.code != XML_ERR_OK)
14883  xmlResetError(&ctxt->lastError);
14884 }
xmlParserInputState instate
Definition: parser.h:225
unsigned long sizeentities
Definition: parser.h:306
int * spaceTab
Definition: parser.h:249
xmlChar * extSubURI
Definition: parser.h:242
long checkIndex
Definition: parser.h:237
int nsWellFormed
Definition: parser.h:288
xmlValidityErrorFunc error
Definition: valid.h:84
int external
Definition: parser.h:219
const xmlChar * name
Definition: parser.h:231
xmlParserInputPtr input
Definition: parser.h:201
int disableSAX
Definition: parser.h:239
xmlError lastError
Definition: parser.h:303
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:327
int standalone
Definition: parser.h:194
xmlHashTablePtr attsDefault
Definition: parser.h:286
xmlChar * extSubSystem
Definition: parser.h:243
XMLPUBFUN void XMLCALL xmlFreeInputStream(xmlParserInputPtr input)
xmlDictPtr dict
Definition: parser.h:265
Definition: dict.c:116
#define DICT_FREE(str)
Definition: parser.c:14783
XMLPUBFUN void XMLCALL xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
int wellFormed
Definition: parser.h:190
xmlNodePtr node
Definition: parser.h:207
int record_info
Definition: parser.h:212
int hasPErefs
Definition: parser.h:218
xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1783
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
xmlDocPtr myDoc
Definition: parser.h:189
const xmlChar * encoding
Definition: parser.h:193
const xmlChar * version
Definition: parser.h:192
void * catalogs
Definition: parser.h:262
int hasExternalSubset
Definition: parser.h:217
XMLPUBFUN void XMLCALL xmlResetError(xmlErrorPtr err)
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserValidityWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
unsigned long sizeentcopy
Definition: parser.h:315
GLenum GLenum GLenum input
Definition: glext.h:9031
int inSubset
Definition: parser.h:240
#define NULL
Definition: types.h:112
xmlHashTablePtr attsSpecial
Definition: parser.h:287
char * directory
Definition: parser.h:228
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserValidityError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
int code
Definition: xmlerror.h:80
void * userData
Definition: valid.h:83
xmlValidCtxt vctxt
Definition: parser.h:223
int * space
Definition: parser.h:246
xmlValidityWarningFunc warning
Definition: valid.h:85
xmlParserNodeInfoSeq node_seq
Definition: parser.h:213
XMLPUBFUN void XMLCALL xmlHashDefaultDeallocator(void *entry, const xmlChar *name)
unsigned long nbentities
Definition: parser.h:305

Referenced by xmlClearParserCtxt(), xmlCtxtReadDoc(), 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 14899 of file parser.c.

14901 {
14902  xmlParserInputPtr inputStream;
14905 
14906  if (ctxt == NULL)
14907  return(1);
14908 
14909  if ((encoding == NULL) && (chunk != NULL) && (size >= 4))
14910  enc = xmlDetectCharEncoding((const xmlChar *) chunk, size);
14911 
14913  if (buf == NULL)
14914  return(1);
14915 
14916  if (ctxt == NULL) {
14918  return(1);
14919  }
14920 
14921  xmlCtxtReset(ctxt);
14922 
14923  if (filename == NULL) {
14924  ctxt->directory = NULL;
14925  } else {
14927  }
14928 
14929  inputStream = xmlNewInputStream(ctxt);
14930  if (inputStream == NULL) {
14932  return(1);
14933  }
14934 
14935  if (filename == NULL)
14936  inputStream->filename = NULL;
14937  else
14938  inputStream->filename = (char *)
14939  xmlCanonicPath((const xmlChar *) filename);
14940  inputStream->buf = buf;
14941  xmlBufResetInput(buf->buffer, inputStream);
14942 
14943  inputPush(ctxt, inputStream);
14944 
14945  if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
14946  (ctxt->input->buf != NULL)) {
14947  size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input);
14948  size_t cur = ctxt->input->cur - ctxt->input->base;
14949 
14951 
14952  xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur);
14953 #ifdef DEBUG_PUSH
14954  xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
14955 #endif
14956  }
14957 
14958  if (encoding != NULL) {
14960 
14961  if (ctxt->encoding != NULL)
14962  xmlFree((xmlChar *) ctxt->encoding);
14963  ctxt->encoding = xmlStrdup((const xmlChar *) encoding);
14964 
14966  if (hdlr != NULL) {
14967  xmlSwitchToEncoding(ctxt, hdlr);
14968  } else {
14969  xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
14970  "Unsupported encoding %s\n", BAD_CAST encoding);
14971  }
14972  } else if (enc != XML_CHAR_ENCODING_NONE) {
14973  xmlSwitchEncoding(ctxt, enc);
14974  }
14975 
14976  return(0);
14977 }
XMLPUBFUN int XMLCALL xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, size_t base, size_t cur)
Definition: buf.c:1335
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
XMLPUBFUN char *XMLCALL xmlParserGetDirectory(const char *filename)
XMLPUBFUN int XMLCALL xmlParserInputBufferPush(xmlParserInputBufferPtr in, int len, const char *buf)
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
const xmlChar * cur
Definition: parser.h:61
xmlCharEncoding
Definition: encoding.h:58
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
Definition: buf.c:1285
const char * filename
Definition: ioapi.h:135
const xmlChar * base
Definition: parser.h:60
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14795
xmlParserInputPtr input
Definition: parser.h:201
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlChar *XMLCALL xmlCanonicPath(const xmlChar *path)
Definition: uri.c:2379
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlAllocParserInputBuffer(xmlCharEncoding enc)
#define BAD_CAST
Definition: xmlstring.h:35
GLsizeiptr size
Definition: glext.h:5919
xmlBufPtr buffer
Definition: xmlIO.h:132
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding(const unsigned char *in, int len)
Definition: encoding.c:942
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input)
Definition: buf.c:1304
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1660
const xmlChar * encoding
Definition: parser.h:193
unsigned char xmlChar
Definition: xmlstring.h:28
ed encoding
Definition: write.c:2825
FxCollectionEntry * cur
xmlParserInputBufferPtr buf
Definition: parser.h:56
const char * filename
Definition: parser.h:58
XMLPUBFUN int XMLCALL xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
#define NULL
Definition: types.h:112
char * directory
Definition: parser.h:228
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewInputStream(xmlParserCtxtPtr ctxt)
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

◆ 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 15133 of file parser.c.

15134 {
15135  return(xmlCtxtUseOptionsInternal(ctxt, options, NULL));
15136 }
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding)
Definition: parser.c:14992
#define NULL
Definition: types.h:112

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

1775 {
1777 
1778  if (ctxt == NULL) return;
1779 
1780  while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
1782  }
1783  if (ctxt->spaceTab != NULL) xmlFree(ctxt->spaceTab);
1784  if (ctxt->nameTab != NULL) xmlFree((xmlChar * *)ctxt->nameTab);
1785  if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab);
1786  if (ctxt->nodeInfoTab != NULL) xmlFree(ctxt->nodeInfoTab);
1787  if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab);
1788  if (ctxt->version != NULL) xmlFree((char *) ctxt->version);
1789  if (ctxt->encoding != NULL) xmlFree((char *) ctxt->encoding);
1790  if (ctxt->extSubURI != NULL) xmlFree((char *) ctxt->extSubURI);
1791  if (ctxt->extSubSystem != NULL) xmlFree((char *) ctxt->extSubSystem);
1792 #ifdef LIBXML_SAX1_ENABLED
1793  if ((ctxt->sax != NULL) &&
1795 #else
1796  if (ctxt->sax != NULL)
1797 #endif /* LIBXML_SAX1_ENABLED */
1798  xmlFree(ctxt->sax);
1799  if (ctxt->directory != NULL) xmlFree((char *) ctxt->directory);
1800  if (ctxt->vctxt.nodeTab != NULL) xmlFree(ctxt->vctxt.nodeTab);
1801  if (ctxt->atts != NULL) xmlFree((xmlChar * *)ctxt->atts);
1802  if (ctxt->dict != NULL) xmlDictFree(ctxt->dict);
1803  if (ctxt->nsTab != NULL) xmlFree((char *) ctxt->nsTab);
1804  if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab);
1805  if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs);
1806  if (ctxt->attsDefault != NULL)
1808  if (ctxt->attsSpecial != NULL)
1809  xmlHashFree(ctxt->attsSpecial, NULL);
1810  if (ctxt->freeElems != NULL) {
1811  xmlNodePtr cur, next;
1812 
1813  cur = ctxt->freeElems;
1814  while (cur != NULL) {
1815  next = cur->next;
1816  xmlFree(cur);
1817  cur = next;
1818  }
1819  }
1820  if (ctxt->freeAttrs != NULL) {
1821  xmlAttrPtr cur, next;
1822 
1823  cur = ctxt->freeAttrs;
1824  while (cur != NULL) {
1825  next = cur->next;
1826  xmlFree(cur);
1827  cur = next;
1828  }
1829  }
1830  /*
1831  * cleanup the error strings
1832  */
1833  if (ctxt->lastError.message != NULL)
1834  xmlFree(ctxt->lastError.message);
1835  if (ctxt->lastError.file != NULL)
1836  xmlFree(ctxt->lastError.file);
1837  if (ctxt->lastError.str1 != NULL)
1838  xmlFree(ctxt->lastError.str1);
1839  if (ctxt->lastError.str2 != NULL)
1840  xmlFree(ctxt->lastError.str2);
1841  if (ctxt->lastError.str3 != NULL)
1842  xmlFree(ctxt->lastError.str3);
1843 
1844 #ifdef LIBXML_CATALOG_ENABLED
1845  if (ctxt->catalogs != NULL)
1846  xmlCatalogFreeLocal(ctxt->catalogs);
1847 #endif
1848  xmlFree(ctxt);
1849 }
int * attallocs
Definition: parser.h:284
int * spaceTab
Definition: parser.h:249
xmlChar * extSubURI
Definition: parser.h:242
char * file
Definition: xmlerror.h:83
xmlParserInputPtr * inputTab
Definition: parser.h:204
xmlAttrPtr freeAttrs
Definition: parser.h:298
xmlNodePtr * nodeTab
Definition: parser.h:210
xmlNodePtr * nodeTab
Definition: valid.h:91
xmlError lastError
Definition: parser.h:303
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:327
char * message
Definition: xmlerror.h:81
xmlHashTablePtr attsDefault
Definition: parser.h:286
xmlChar * extSubSystem
Definition: parser.h:243
xmlDictPtr dict
Definition: parser.h:265
xmlStartTag * pushTab
Definition: parser.h:285
char * str2
Definition: xmlerror.h:86
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler
Definition: globals.h:321
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
void xmlFreeInputStream(xmlParserInputPtr input)
Definition: tree.h:489
const xmlChar * encoding
Definition: parser.h:193
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
Definition: dict.c:800
struct _xmlSAXHandler * sax
Definition: parser.h:187
const xmlChar * version
Definition: parser.h:192
void * catalogs
Definition: parser.h:262
FxCollectionEntry * cur
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1783
const xmlChar ** atts
Definition: parser.h:266
char * str3
Definition: xmlerror.h:87
static unsigned __int64 next
Definition: rand_nt.c:6
GLenum GLenum GLenum input
Definition: glext.h:9031
xmlParserNodeInfo * nodeInfoTab
Definition: parser.h:312
#define NULL
Definition: types.h:112
xmlHashTablePtr attsSpecial
Definition: parser.h:287
char * directory
Definition: parser.h:228
const xmlChar ** nsTab
Definition: parser.h:283
Definition: tree.h:434
const xmlChar ** nameTab
Definition: parser.h:234
xmlValidCtxt vctxt
Definition: parser.h:223
xmlNodePtr freeElems
Definition: parser.h:296
XMLPUBFUN void XMLCALL xmlHashDefaultDeallocator(void *entry, const xmlChar *name)
char * str1
Definition: xmlerror.h:85

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 885 of file parser.c.

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

1934 {
1935  if (seq == NULL)
1936  return;
1937  seq->length = 0;
1938  seq->maximum = 0;
1939  seq->buffer = NULL;
1940 }
xmlParserNodeInfo * buffer
Definition: parser.h:103
unsigned long length
Definition: parser.h:102
#define NULL
Definition: types.h:112
unsigned long maximum
Definition: parser.h:101

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 14670 of file parser.c.

14670  {
14671  if (xmlParserInitialized != 0)
14672  return;
14673 
14674 #if defined(_WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
14676 #endif
14677 
14678 #ifdef LIBXML_THREAD_ENABLED
14680  if (xmlParserInitialized == 0) {
14681 #endif
14682  xmlInitThreads();
14683  xmlInitGlobals();
14685  (xmlGenericError == NULL))
14687  xmlInitMemory();
14692 #ifdef LIBXML_OUTPUT_ENABLED
14693  xmlRegisterDefaultOutputCallbacks();
14694 #endif /* LIBXML_OUTPUT_ENABLED */
14695 #ifdef LIBXML_HTML_ENABLED
14696  htmlInitAutoClose();
14697  htmlDefaultSAXHandlerInit();
14698 #endif
14699 #ifdef LIBXML_XPATH_ENABLED
14700  xmlXPathInit();
14701 #endif
14703 #ifdef LIBXML_THREAD_ENABLED
14704  }
14706 #endif
14707 }
void __xmlGlobalInitMutexUnlock(void)
Definition: threads.c:502
XMLPUBFUN void XMLCALL xmlRegisterDefaultInputCallbacks(void)
int __cdecl atexit(void(__cdecl *)(void))
Definition: atonexit.c:97
void XMLCDECL xmlGenericErrorDefaultFunc(void *ctx, const char *msg,...)
void xmlCleanupParser(void)
Definition: parser.c:14732
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN int XMLCALL xmlInitMemory(void)
Definition: xmlmemory.c:964
XMLPUBFUN void XMLCALL initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler)
Definition: error.c:90
XMLPUBFUN void XMLCALL xmlInitThreads(void)
Definition: threads.c:858
XMLPUBFUN void XMLCALL xmlInitGlobals(void)
Definition: globals.c:47
XMLPUBFUN void XMLCALL xmlInitCharEncodingHandlers(void)
Definition: encoding.c:1407
#define NULL
Definition: types.h:112
XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit(void)
Definition: SAX2.c:2913
void void __xmlGlobalInitMutexLock(void)
Definition: threads.c:427
XMLPUBFUN int XMLCALL xmlInitializeDict(void)
Definition: dict.c:160
static int xmlParserInitialized
Definition: parser.c:14659

Referenced by DllMain(), xmlCheckVersion(), xmlCtxtReadDoc(), xmlCtxtReadFd(), xmlCtxtReadFile(), xmlCtxtReadIO(), xmlCtxtReadMemory(), 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 1589 of file parserInternals.c.

1590 {
1592 
1593  if(ctxt==NULL) {
1594  xmlErrInternal(NULL, "Got NULL parser context\n", NULL);
1595  return(-1);
1596  }
1597 
1599 
1600  if (ctxt->dict == NULL)
1601  ctxt->dict = xmlDictCreate();
1602  if (ctxt->dict == NULL) {
1603  xmlErrMemory(NULL, "cannot initialize parser context\n");
1604  return(-1);
1605  }
1607 
1608  if (ctxt->sax == NULL)
1609  ctxt->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
1610  if (ctxt->sax == NULL) {
1611  xmlErrMemory(NULL, "cannot initialize parser context\n");
1612  return(-1);
1613  }
1614  else
1615  xmlSAXVersion(ctxt->sax, 2);
1616 
1617  ctxt->maxatts = 0;
1618  ctxt->atts = NULL;
1619  /* Allocate the Input stack */
1620  if (ctxt->inputTab == NULL) {
1621  ctxt->inputTab = (xmlParserInputPtr *)
1622  xmlMalloc(5 * sizeof(xmlParserInputPtr));
1623  ctxt->inputMax = 5;
1624  }
1625  if (ctxt->inputTab == NULL) {
1626  xmlErrMemory(NULL, "cannot initialize parser context\n");
1627  ctxt->inputNr = 0;
1628  ctxt->inputMax = 0;
1629  ctxt->input = NULL;
1630  return(-1);
1631  }
1632  while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
1634  }
1635  ctxt->inputNr = 0;
1636  ctxt->input = NULL;
1637 
1638  ctxt->version = NULL;
1639  ctxt->encoding = NULL;
1640  ctxt->standalone = -1;
1641  ctxt->hasExternalSubset = 0;
1642  ctxt->hasPErefs = 0;
1643  ctxt->html = 0;
1644  ctxt->external = 0;
1645  ctxt->instate = XML_PARSER_START;
1646  ctxt->token = 0;
1647  ctxt->directory = NULL;
1648 
1649  /* Allocate the Node stack */
1650  if (ctxt->nodeTab == NULL) {
1651  ctxt->nodeTab = (xmlNodePtr *) xmlMalloc(10 * sizeof(xmlNodePtr));
1652  ctxt->nodeMax = 10;
1653  }
1654  if (ctxt->nodeTab == NULL) {
1655  xmlErrMemory(NULL, "cannot initialize parser context\n");
1656  ctxt->nodeNr = 0;
1657  ctxt->nodeMax = 0;
1658  ctxt->node = NULL;
1659  ctxt->inputNr = 0;
1660  ctxt->inputMax = 0;
1661  ctxt->input = NULL;
1662  return(-1);
1663  }
1664  ctxt->nodeNr = 0;
1665  ctxt->node = NULL;
1666 
1667  /* Allocate the Name stack */
1668  if (ctxt->nameTab == NULL) {
1669  ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
1670  ctxt->nameMax = 10;
1671  }
1672  if (ctxt->nameTab == NULL) {
1673  xmlErrMemory(NULL, "cannot initialize parser context\n");
1674  ctxt->nodeNr = 0;
1675  ctxt->nodeMax = 0;
1676  ctxt->node = NULL;
1677  ctxt->inputNr = 0;
1678  ctxt->inputMax = 0;
1679  ctxt->input = NULL;
1680  ctxt->nameNr = 0;
1681  ctxt->nameMax = 0;
1682  ctxt->name = NULL;
1683  return(-1);
1684  }
1685  ctxt->nameNr = 0;
1686  ctxt->name = NULL;
1687 
1688  /* Allocate the space stack */
1689  if (ctxt->spaceTab == NULL) {
1690  ctxt->spaceTab = (int *) xmlMalloc(10 * sizeof(int));
1691  ctxt->spaceMax = 10;
1692  }
1693  if (ctxt->spaceTab == NULL) {
1694  xmlErrMemory(NULL, "cannot initialize parser context\n");
1695  ctxt->nodeNr = 0;
1696  ctxt->nodeMax = 0;
1697  ctxt->node = NULL;
1698  ctxt->inputNr = 0;
1699  ctxt->inputMax = 0;
1700  ctxt->input = NULL;
1701  ctxt->nameNr = 0;
1702  ctxt->nameMax = 0;
1703  ctxt->name = NULL;
1704  ctxt->spaceNr = 0;
1705  ctxt->spaceMax = 0;
1706  ctxt->space = NULL;
1707  return(-1);
1708  }
1709  ctxt->spaceNr = 1;
1710  ctxt->spaceMax = 10;
1711  ctxt->spaceTab[0] = -1;
1712  ctxt->space = &ctxt->spaceTab[0];
1713  ctxt->userData = ctxt;
1714  ctxt->myDoc = NULL;
1715  ctxt->wellFormed = 1;
1716  ctxt->nsWellFormed = 1;
1717  ctxt->valid = 1;
1719  if (ctxt->loadsubset) {
1720  ctxt->options |= XML_PARSE_DTDLOAD;
1721  }
1724  if (ctxt->pedantic) {
1725  ctxt->options |= XML_PARSE_PEDANTIC;
1726  }
1729  if (ctxt->keepBlanks == 0) {
1730  ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
1731  ctxt->options |= XML_PARSE_NOBLANKS;
1732  }
1733 
1734  ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0;
1735  ctxt->vctxt.userData = ctxt;
1738  if (ctxt->validate) {
1739  if (xmlGetWarningsDefaultValue == 0)
1740  ctxt->vctxt.warning = NULL;
1741  else
1743  ctxt->vctxt.nodeMax = 0;
1744  ctxt->options |= XML_PARSE_DTDVALID;
1745  }
1747  if (ctxt->replaceEntities) {
1748  ctxt->options |= XML_PARSE_NOENT;
1749  }
1750  ctxt->record_info = 0;
1751  ctxt->checkIndex = 0;
1752  ctxt->inSubset = 0;
1753  ctxt->errNo = XML_ERR_OK;
1754  ctxt->depth = 0;
1756  ctxt->catalogs = NULL;
1757  ctxt->nbentities = 0;
1758  ctxt->sizeentities = 0;
1759  ctxt->sizeentcopy = 0;
1760  ctxt->input_id = 1;
1761  xmlInitNodeInfoSeq(&ctxt->node_seq);
1762  return(0);
1763 }
int nodeMax
Definition: valid.h:90
xmlParserInputState instate
Definition: parser.h:225
unsigned long sizeentities
Definition: parser.h:306
XMLPUBVAR int xmlGetWarningsDefaultValue
Definition: globals.h:378
int * spaceTab
Definition: parser.h:249
xmlParserInputPtr * inputTab
Definition: parser.h:204
unsigned int finishDtd
Definition: valid.h:93
XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreate(void)
Definition: dict.c:575
long checkIndex
Definition: parser.h:237
int pedantic
Definition: parser.h:257
XMLPUBFUN size_t XMLCALL xmlDictSetLimit(xmlDictPtr dict, size_t limit)
Definition: dict.c:1263
int nsWellFormed
Definition: parser.h:288
xmlValidityErrorFunc error
Definition: valid.h:84
xmlNodePtr * nodeTab
Definition: parser.h:210
XMLPUBVAR int xmlSubstituteEntitiesDefaultValue
Definition: globals.h:467
int external
Definition: parser.h:219
XMLPUBVAR int xmlLoadExtDtdDefaultValue
Definition: globals.h:423
const xmlChar * name
Definition: parser.h:231
int input_id
Definition: parser.h:314
xmlParserInputPtr input
Definition: parser.h:201
int spaceMax
Definition: parser.h:248
XMLPUBFUN int XMLCALL xmlSAXVersion(xmlSAXHandler *hdlr, int version)
Definition: SAX2.c:2840
int standalone
Definition: parser.h:194
XMLPUBVAR int xmlLineNumbersDefaultValue
Definition: globals.h:414
int linenumbers
Definition: parser.h:261
int replaceEntities
Definition: parser.h:191
xmlDictPtr dict
Definition: parser.h:265
#define XML_MAX_DICTIONARY_LIMIT
int validate
Definition: parser.h:222
XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace(void *ctx, const xmlChar *ch, int len)
int inputMax
Definition: parser.h:203
XMLPUBVAR int xmlKeepBlanksDefaultValue
Definition: globals.h:405
int wellFormed
Definition: parser.h:190
xmlNodePtr node
Definition: parser.h:207
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
int record_info
Definition: parser.h:212
int hasPErefs
Definition: parser.h:218
XMLPUBVAR int xmlPedanticParserDefaultValue
Definition: globals.h:449
XMLPUBVAR int xmlDoValidityCheckingDefaultValue
Definition: globals.h:337
void xmlFreeInputStream(xmlParserInputPtr input)
Definition: tree.h:489
xmlDocPtr myDoc
Definition: parser.h:189
const xmlChar * encoding
Definition: parser.h:193
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:187
const xmlChar * version
Definition: parser.h:192
void * catalogs
Definition: parser.h:262
int loadsubset
Definition: parser.h:260
int hasExternalSubset
Definition: parser.h:217
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1783
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserValidityWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
unsigned long sizeentcopy
Definition: parser.h:315
const xmlChar ** atts
Definition: parser.h:266
GLenum GLenum GLenum input
Definition: glext.h:9031
void xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
int inSubset
Definition: parser.h:240
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
char * directory
Definition: parser.h:228
XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit(void)
Definition: SAX2.c:2913
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserValidityError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
int keepBlanks
Definition: parser.h:238
void * userData
Definition: valid.h:83
const xmlChar ** nameTab
Definition: parser.h:234
xmlValidCtxt vctxt
Definition: parser.h:223
int * space
Definition: parser.h:246
void * userData
Definition: parser.h:188
xmlValidityWarningFunc warning
Definition: valid.h:85
xmlParserNodeInfoSeq node_seq
Definition: parser.h:213
unsigned long nbentities
Definition: parser.h:305

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

2155  {
2156  int old = xmlKeepBlanksDefaultValue;
2157 
2159  if (!val) xmlIndentTreeOutput = 1;
2160  return(old);
2161 }
XMLPUBVAR int xmlIndentTreeOutput
Definition: globals.h:387
GLuint GLfloat * val
Definition: glext.h:7180
XMLPUBVAR int xmlKeepBlanksDefaultValue
Definition: globals.h:405

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

2101  {
2102  int old = xmlLineNumbersDefaultValue;
2103 
2105  return(old);
2106 }
XMLPUBVAR int xmlLineNumbersDefaultValue
Definition: globals.h:414
GLuint GLfloat * val
Definition: glext.h:7180

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

1399  {
1400  xmlParserInputPtr inputStream;
1401 
1402  if (input == NULL) return(NULL);
1404  xmlGenericError(xmlGenericErrorContext, "new input from I/O\n");
1405  inputStream = xmlNewInputStream(ctxt);
1406  if (inputStream == NULL) {
1407  return(NULL);
1408  }
1409  inputStream->filename = NULL;
1410  inputStream->buf = input;
1411  xmlBufResetInput(inputStream->buf->buffer, inputStream);
1412 
1413  if (enc != XML_CHAR_ENCODING_NONE) {
1414  xmlSwitchEncoding(ctxt, enc);
1415  }
1416 
1417  return(inputStream);
1418 }
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
Definition: buf.c:1285
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
xmlBufPtr buffer
Definition: xmlIO.h:132
int xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
xmlParserInputPtr xmlNewInputStream(xmlParserCtxtPtr ctxt)
xmlParserInputBufferPtr buf
Definition: parser.h:56
const char * filename
Definition: parser.h:58
GLenum GLenum GLenum input
Definition: glext.h:9031
XMLPUBVAR int xmlParserDebugEntities
Definition: globals.h:432
#define NULL
Definition: types.h:112
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

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

1861 {
1862  xmlParserCtxtPtr ctxt;
1863 
1864  ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
1865  if (ctxt == NULL) {
1866  xmlErrMemory(NULL, "cannot allocate parser context\n");
1867  return(NULL);
1868  }
1869  memset(ctxt, 0, sizeof(xmlParserCtxt));
1870  if (xmlInitParserCtxt(ctxt) < 0) {
1871  xmlFreeParserCtxt(ctxt);
1872  return(NULL);
1873  }
1874  return(ctxt);
1875 }
void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
#define memset(x, y, z)
Definition: compat.h:39
int xmlInitParserCtxt(xmlParserCtxtPtr ctxt)

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 12962 of file parser.c.

12963  {
12964  void *userData;
12965 
12966  if (ctx == NULL) return(-1);
12967  /*
12968  * If the user provided their own SAX callbacks, then reuse the
12969  * userData callback field, otherwise the expected setup in a
12970  * DOM builder is to have userData == ctxt
12971  */
12972  if (ctx->userData == ctx)
12973  userData = NULL;
12974  else
12975  userData = ctx->userData;
12976  return xmlParseExternalEntityPrivate(ctx->myDoc, ctx, ctx->sax,
12977  userData, ctx->depth + 1,
12978  URL, ID, lst);
12979 }
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:12999
#define ID
Definition: ruserpass.c:36
#define NULL
Definition: types.h:112

◆ 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 10689 of file parser.c.

10689  {
10690  xmlChar start[4];
10691  xmlCharEncoding enc;
10692 
10693  xmlInitParser();
10694 
10695  if ((ctxt == NULL) || (ctxt->input == NULL))
10696  return(-1);
10697 
10698  GROW;
10699 
10700  /*
10701  * SAX: detecting the level.
10702  */
10703  xmlDetectSAX2(ctxt);
10704 
10705  /*
10706  * SAX: beginning of the document processing.
10707  */
10708  if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
10709  ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
10710  if (ctxt->instate == XML_PARSER_EOF)
10711  return(-1);
10712 
10713  if ((ctxt->encoding == NULL) &&
10714  ((ctxt->input->end - ctxt->input->cur) >= 4)) {
10715  /*
10716  * Get the 4 first bytes and decode the charset
10717  * if enc != XML_CHAR_ENCODING_NONE
10718  * plug some encoding conversion routines.
10719  */
10720  start[0] = RAW;
10721  start[1] = NXT(1);
10722  start[2] = NXT(2);
10723  start[3] = NXT(3);
10724  enc = xmlDetectCharEncoding(&start[0], 4);
10725  if (enc != XML_CHAR_ENCODING_NONE) {
10726  xmlSwitchEncoding(ctxt, enc);
10727  }
10728  }
10729 
10730 
10731  if (CUR == 0) {
10733  return(-1);
10734  }
10735 
10736  /*
10737  * Check for the XMLDecl in the Prolog.
10738  * do not GROW here to avoid the detected encoder to decode more
10739  * than just the first line, unless the amount of data is really
10740  * too small to hold "<?xml version="1.0" encoding="foo"
10741  */
10742  if ((ctxt->input->end - ctxt->input->cur) < 35) {
10743  GROW;
10744  }
10745  if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
10746 
10747  /*
10748  * Note that we will switch encoding on the fly.
10749  */
10750  xmlParseXMLDecl(ctxt);
10751  if ((ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) ||
10752  (ctxt->instate == XML_PARSER_EOF)) {
10753  /*
10754  * The XML REC instructs us to stop parsing right here
10755  */
10756  return(-1);
10757  }
10758  ctxt->standalone = ctxt->input->standalone;
10759  SKIP_BLANKS;
10760  } else {
10762  }
10763  if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
10764  ctxt->sax->startDocument(ctxt->userData);
10765  if (ctxt->instate == XML_PARSER_EOF)
10766  return(-1);
10767  if ((ctxt->myDoc != NULL) && (ctxt->input != NULL) &&
10768  (ctxt->input->buf != NULL) && (ctxt->input->buf->compressed >= 0)) {
10769  ctxt->myDoc->compression = ctxt->input->buf->compressed;
10770  }
10771 
10772  /*
10773  * The Misc part of the Prolog
10774  */
10775  GROW;
10776  xmlParseMisc(ctxt);
10777 
10778  /*
10779  * Then possibly doc type declaration(s) and more Misc
10780  * (doctypedecl Misc*)?
10781  */
10782  GROW;
10783  if (CMP9(CUR_PTR, '<', '!', 'D', 'O', 'C', 'T', 'Y', 'P', 'E')) {
10784 
10785  ctxt->inSubset = 1;
10786  xmlParseDocTypeDecl(ctxt);
10787  if (RAW == '[') {
10788  ctxt->instate = XML_PARSER_DTD;
10789  xmlParseInternalSubset(ctxt);
10790  if (ctxt->instate == XML_PARSER_EOF)
10791  return(-1);
10792  }
10793 
10794  /*
10795  * Create and update the external subset.
10796  */
10797  ctxt->inSubset = 2;
10798  if ((ctxt->sax != NULL) && (ctxt->sax->externalSubset != NULL) &&
10799  (!ctxt->disableSAX))
10800  ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName,
10801  ctxt->extSubSystem, ctxt->extSubURI);
10802  if (ctxt->instate == XML_PARSER_EOF)
10803  return(-1);
10804  ctxt->inSubset = 0;
10805 
10806  xmlCleanSpecialAttr(ctxt);
10807 
10808  ctxt->instate = XML_PARSER_PROLOG;
10809  xmlParseMisc(ctxt);
10810  }
10811 
10812  /*
10813  * Time to start parsing the tree itself
10814  */
10815  GROW;
10816  if (RAW != '<') {
10817  xmlFatalErrMsg(ctxt, XML_ERR_DOCUMENT_EMPTY,
10818  "Start tag expected, '<' not found\n");
10819  } else {
10820  ctxt->instate = XML_PARSER_CONTENT;
10821  xmlParseElement(ctxt);
10822  ctxt->instate = XML_PARSER_EPILOG;
10823 
10824 
10825  /*
10826  * The Misc part at the end
10827  */
10828  xmlParseMisc(ctxt);
10829 
10830  if (RAW != 0) {
10832  }
10833  ctxt->instate = XML_PARSER_EOF;
10834  }
10835 
10836  /*
10837  * SAX: end of the document processing.
10838  */
10839  if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
10840  ctxt->sax->endDocument(ctxt->userData);
10841 
10842  /*
10843  * Remove locally kept entity definitions if the tree was not built
10844  */
10845  if ((ctxt->myDoc != NULL) &&
10847  xmlFreeDoc(ctxt->myDoc);
10848  ctxt->myDoc = NULL;
10849  }
10850 
10851  if ((ctxt->wellFormed) && (ctxt->myDoc != NULL)) {
10853  if (ctxt->valid)
10854  ctxt->myDoc->properties |= XML_DOC_DTDVALID;
10855  if (ctxt->nsWellFormed)
10856  ctxt->myDoc->properties |= XML_DOC_NSVALID;
10857  if (ctxt->options & XML_PARSE_OLD10)
10858  ctxt->myDoc->properties |= XML_DOC_OLD10;
10859  }
10860  if (! ctxt->wellFormed) {
10861  ctxt->valid = 0;
10862  return(-1);
10863  }
10864  return(0);
10865 }
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator
Definition: globals.h:329
static void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
Definition: parser.c:389
xmlParserInputState instate
Definition: parser.h:225
int properties
Definition: tree.h:584
xmlChar * extSubURI
Definition: parser.h:242
#define GROW
Definition: parser.c:2126
static void xmlParseInternalSubset(xmlParserCtxtPtr ctxt)
Definition: parser.c:8345
const xmlChar * version
Definition: tree.h:573
#define NXT(val)
Definition: parser.c:2075
int nsWellFormed
Definition: parser.h:288
const xmlChar * cur
Definition: parser.h:61
#define CMP5(s, c1, c2, c3, c4, c5)
Definition: parser.c:2082
xmlCharEncoding
Definition: encoding.h:58
#define CMP9(s, c1, c2, c3, c4, c5, c6, c7, c8, c9)
Definition: parser.c:2090
#define SKIP_BLANKS
Definition: parser.c:2154
int compression
Definition: tree.h:563
xmlParserInputPtr input
Definition: parser.h:201
int disableSAX
Definition: parser.h:239
void xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt)
Definition: parser.c:8273
int standalone
Definition: parser.h:194
#define IS_BLANK_CH(c)
int standalone
Definition: parser.h:75
void xmlInitParser(void)
Definition: parser.c:14670
xmlChar * extSubSystem
Definition: parser.h:243
const xmlChar * intSubName
Definition: parser.h:241
#define XML_DEFAULT_VERSION
Definition: parser.h:33
int wellFormed
Definition: parser.h:190
void xmlParseElement(xmlParserCtxtPtr ctxt)
Definition: parser.c:9979
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding(const unsigned char *in, int len)
Definition: encoding.c:942
xmlDocPtr myDoc
Definition: parser.h:189
const xmlChar * encoding
Definition: parser.h:193
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:187
const xmlChar * version
Definition: parser.h:192
void xmlParseMisc(xmlParserCtxtPtr ctxt)
Definition: parser.c:10659
xmlParserInputBufferPtr buf
Definition: parser.h:56
#define CUR
Definition: parser.c:2074
int inSubset
Definition: parser.h:240
static void xmlDetectSAX2(xmlParserCtxtPtr ctxt)
Definition: parser.c:1105
GLuint start
Definition: gl.h:1545
XMLPUBFUN int XMLCALL xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
#define NULL
Definition: types.h:112
#define CUR_PTR
Definition: parser.c:2076
#define RAW
Definition: parser.c:2073
static void xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt)
Definition: parser.c:1408
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:159
void xmlParseXMLDecl(xmlParserCtxtPtr ctxt)
Definition: parser.c:10544
#define SAX_COMPAT_MODE
Definition: parser.c:288
XMLPUBFUN xmlChar *XMLCALL xmlCharStrdup(const char *cur)
Definition: xmlstring.c:113
const xmlChar * end
Definition: parser.h:62
void * userData
Definition: parser.h:188

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 10882 of file parser.c.

10882  {
10883  xmlChar start[4];
10884  xmlCharEncoding enc;
10885 
10886  if ((ctxt == NULL) || (ctxt->input == NULL))
10887  return(-1);
10888 
10890 
10891  xmlDetectSAX2(ctxt);
10892 
10893  GROW;
10894 
10895  /*
10896  * SAX: beginning of the document processing.
10897  */
10898  if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
10899  ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
10900 
10901  /*
10902  * Get the 4 first bytes and decode the charset
10903  * if enc != XML_CHAR_ENCODING_NONE
10904  * plug some encoding conversion routines.
10905  */
10906  if ((ctxt->input->end - ctxt->input->cur) >= 4) {
10907  start[0] = RAW;
10908  start[1] = NXT(1);
10909  start[2] = NXT(2);
10910  start[3] = NXT(3);
10911  enc = xmlDetectCharEncoding(start, 4);
10912  if (enc != XML_CHAR_ENCODING_NONE) {
10913  xmlSwitchEncoding(ctxt, enc);
10914  }
10915  }
10916 
10917 
10918  if (CUR == 0) {
10920  }
10921 
10922  /*
10923  * Check for the XMLDecl in the Prolog.
10924  */
10925  GROW;
10926  if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
10927 
10928  /*
10929  * Note that we will switch encoding on the fly.
10930  */
10931  xmlParseXMLDecl(ctxt);
10932  if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
10933  /*
10934  * The XML REC instructs us to stop parsing right here
10935  */
10936  return(-1);
10937  }
10938  SKIP_BLANKS;
10939  } else {
10941  }
10942  if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
10943  ctxt->sax->startDocument(ctxt->userData);
10944  if (ctxt->instate == XML_PARSER_EOF)
10945  return(-1);
10946 
10947  /*
10948  * Doing validity checking on chunk doesn't make sense
10949  */
10950  ctxt->instate = XML_PARSER_CONTENT;
10951  ctxt->validate = 0;
10952  ctxt->loadsubset = 0;
10953  ctxt->depth = 0;
10954 
10955  xmlParseContent(ctxt);
10956  if (ctxt->instate == XML_PARSER_EOF)
10957  return(-1);
10958 
10959  if ((RAW == '<') && (NXT(1) == '/')) {
10961  } else if (RAW != 0) {
10963  }
10964 
10965  /*
10966  * SAX: end of the document processing.
10967  */
10968  if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
10969  ctxt->sax->endDocument(ctxt->userData);
10970 
10971  if (! ctxt->wellFormed) return(-1);
10972  return(0);
10973 }
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator
Definition: globals.h:329
static void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
Definition: parser.c:389
xmlParserInputState instate
Definition: parser.h:225
#define GROW
Definition: parser.c:2126
#define NXT(val)
Definition: parser.c:2075
const xmlChar * cur
Definition: parser.h:61
#define CMP5(s, c1, c2, c3, c4, c5)
Definition: parser.c:2082
xmlCharEncoding
Definition: encoding.h:58
#define SKIP_BLANKS
Definition: parser.c:2154
xmlParserInputPtr input
Definition: parser.h:201
int disableSAX
Definition: parser.h:239
#define IS_BLANK_CH(c)
int validate
Definition: parser.h:222
#define XML_DEFAULT_VERSION
Definition: parser.h:33
int wellFormed
Definition: parser.h:190
XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding(const unsigned char *in, int len)
Definition: encoding.c:942
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:187
const xmlChar * version
Definition: parser.h:192
int loadsubset
Definition: parser.h:260
#define CUR
Definition: parser.c:2074
static void xmlDetectSAX2(xmlParserCtxtPtr ctxt)
Definition: parser.c:1105
GLuint start
Definition: gl.h:1545
XMLPUBFUN int XMLCALL xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
#define NULL
Definition: types.h:112
XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit(void)
Definition: SAX2.c:2913
void xmlParseContent(xmlParserCtxtPtr ctxt)
Definition: parser.c:9950
#define CUR_PTR
Definition: parser.c:2076
#define RAW
Definition: parser.c:2073
void xmlParseXMLDecl(xmlParserCtxtPtr ctxt)
Definition: parser.c:10544
XMLPUBFUN xmlChar *XMLCALL xmlCharStrdup(const char *cur)
Definition: xmlstring.c:113
const xmlChar * end
Definition: parser.h:62
void * userData
Definition: parser.h:188

◆ 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 13490 of file parser.c.

13491  {
13492 #ifdef SAX2
13493  xmlParserCtxtPtr ctxt;
13494  xmlDocPtr doc = NULL;
13495  xmlNodePtr fake, cur;
13496  int nsnr = 0;
13497 
13499 
13500  /*
13501  * check all input parameters, grab the document
13502  */
13503  if ((lst == NULL) || (node == NULL) || (data == NULL) || (datalen < 0))
13504  return(XML_ERR_INTERNAL_ERROR);
13505  switch (node->type) {
13506  case XML_ELEMENT_NODE:
13507  case XML_ATTRIBUTE_NODE:
13508  case XML_TEXT_NODE:
13510  case XML_ENTITY_REF_NODE:
13511  case XML_PI_NODE:
13512  case XML_COMMENT_NODE:
13513  case XML_DOCUMENT_NODE:
13515  break;
13516  default:
13517  return(XML_ERR_INTERNAL_ERROR);
13518 
13519  }
13520  while ((node != NULL) && (node->type != XML_ELEMENT_NODE) &&
13521  (node->type != XML_DOCUMENT_NODE) &&
13522  (node->type != XML_HTML_DOCUMENT_NODE))
13523  node = node->parent;
13524  if (node == NULL)
13525  return(XML_ERR_INTERNAL_ERROR);
13526  if (node->type == XML_ELEMENT_NODE)
13527  doc = node->doc;
13528  else
13529  doc = (xmlDocPtr) node;
13530  if (doc == NULL)
13531  return(XML_ERR_INTERNAL_ERROR);
13532 
13533  /*
13534  * allocate a context and set-up everything not related to the
13535  * node position in the tree
13536  */
13537  if (doc->type == XML_DOCUMENT_NODE)
13538  ctxt = xmlCreateMemoryParserCtxt((char *) data, datalen);
13539 #ifdef LIBXML_HTML_ENABLED
13540  else if (doc->type == XML_HTML_DOCUMENT_NODE) {
13541  ctxt = htmlCreateMemoryParserCtxt((char *) data, datalen);
13542  /*
13543  * When parsing in context, it makes no sense to add implied
13544  * elements like html/body/etc...
13545  */
13546  options |= HTML_PARSE_NOIMPLIED;
13547  }
13548 #endif
13549  else
13550  return(XML_ERR_INTERNAL_ERROR);
13551 
13552  if (ctxt == NULL)
13553  return(XML_ERR_NO_MEMORY);
13554 
13555  /*
13556  * Use input doc's dict if present, else assure XML_PARSE_NODICT is set.
13557  * We need a dictionary for xmlDetectSAX2, so if there's no doc dict
13558  * we must wait until the last moment to free the original one.
13559  */
13560  if (doc->dict != NULL) {
13561  if (ctxt->dict != NULL)
13562  xmlDictFree(ctxt->dict);
13563  ctxt->dict = doc->dict;
13564  } else
13566 
13567  if (doc->encoding != NULL) {
13569 
13570  if (ctxt->encoding != NULL)
13571  xmlFree((xmlChar *) ctxt->encoding);
13572  ctxt->encoding = xmlStrdup((const xmlChar *) doc->encoding);
13573 
13574  hdlr = xmlFindCharEncodingHandler((const char *) doc->encoding);
13575  if (hdlr != NULL) {
13576  xmlSwitchToEncoding(ctxt, hdlr);
13577  } else {
13579  }
13580  }
13581 
13583  xmlDetectSAX2(ctxt);
13584  ctxt->myDoc = doc;
13585  /* parsing in context, i.e. as within existing content */
13586  ctxt->input_id = 2;
13587  ctxt->instate = XML_PARSER_CONTENT;
13588 
13589  fake = xmlNewComment(NULL);
13590  if (fake == NULL) {
13591  xmlFreeParserCtxt(ctxt);
13592  return(XML_ERR_NO_MEMORY);
13593  }
13594  xmlAddChild(node, fake);
13595 
13596  if (node->type == XML_ELEMENT_NODE) {
13597  nodePush(ctxt, node);
13598  /*
13599  * initialize the SAX2 namespaces stack
13600  */
13601  cur = node;
13602  while ((cur != NULL) && (cur->type == XML_ELEMENT_NODE)) {
13603  xmlNsPtr ns = cur->nsDef;
13604  const xmlChar *iprefix, *ihref;
13605 
13606  while (ns != NULL) {
13607  if (ctxt->dict) {
13608  iprefix = xmlDictLookup(ctxt->dict, ns->prefix, -1);
13609  ihref = xmlDictLookup(ctxt->dict, ns->href, -1);
13610  } else {
13611  iprefix = ns->prefix;
13612  ihref = ns->href;
13613  }
13614 
13615  if (xmlGetNamespace(ctxt, iprefix) == NULL) {
13616  nsPush(ctxt, iprefix, ihref);
13617  nsnr++;
13618  }
13619  ns = ns->next;
13620  }
13621  cur = cur->parent;
13622  }
13623  }
13624 
13625  if ((ctxt->validate) || (ctxt->replaceEntities != 0)) {
13626  /*
13627  * ID/IDREF registration will be done in xmlValidateElement below
13628  */
13629  ctxt->loadsubset |= XML_SKIP_IDS;
13630  }
13631 
13632 #ifdef LIBXML_HTML_ENABLED
13633  if (doc->type == XML_HTML_DOCUMENT_NODE)
13634  __htmlParseContent(ctxt);
13635  else
13636 #endif
13637  xmlParseContent(ctxt);
13638 
13639  nsPop(ctxt, nsnr);
13640  if ((RAW == '<') && (NXT(1) == '/')) {
13642  } else if (RAW != 0) {
13644  }
13645  if ((ctxt->node != NULL) && (ctxt->node != node)) {
13647  ctxt->wellFormed = 0;
13648  }
13649 
13650  if (!ctxt->wellFormed) {
13651  if (ctxt->errNo == 0)
13653  else
13654  ret = (xmlParserErrors)ctxt->errNo;
13655  } else {
13656  ret = XML_ERR_OK;
13657  }
13658 
13659  /*
13660  * Return the newly created nodeset after unlinking it from
13661  * the pseudo sibling.
13662  */
13663 
13664  cur = fake->next;
13665  fake->next = NULL;
13666  node->last = fake;
13667 
13668  if (cur != NULL) {
13669  cur->prev = NULL;
13670  }
13671 
13672  *lst = cur;
13673 
13674  while (cur != NULL) {
13675  cur->parent = NULL;
13676  cur = cur->next;
13677  }
13678 
13679  xmlUnlinkNode(fake);
13680  xmlFreeNode(fake);
13681 
13682 
13683  if (ret != XML_ERR_OK) {
13684  xmlFreeNodeList(*lst);
13685  *lst = NULL;
13686  }
13687 
13688  if (doc->dict != NULL)
13689  ctxt->dict = NULL;
13690  xmlFreeParserCtxt(ctxt);
13691 
13692  return(ret);
13693 #else /* !SAX2 */
13694  return(XML_ERR_INTERNAL_ERROR);
13695 #endif
13696 }
static void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
Definition: parser.c:389
XMLPUBFUN int XMLCALL xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
xmlElementType type
Definition: tree.h:553
xmlParserInputState instate
Definition: parser.h:225
static const xmlChar * xmlGetNamespace(xmlParserCtxtPtr ctxt, const xmlChar *prefix)
Definition: parser.c:8751
Definition: tree.h:389
XMLPUBFUN void XMLCALL xmlFreeNodeList(xmlNodePtr cur)
#define NXT(val)
Definition: parser.c:2075
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1030
int input_id
Definition: parser.h:314
struct node node
int replaceEntities
Definition: parser.h:191
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding)
Definition: parser.c:14992
xmlDictPtr dict
Definition: parser.h:265
int validate
Definition: parser.h:222
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
int wellFormed
Definition: parser.h:190
xmlParserErrors
Definition: xmlerror.h:99
xmlNodePtr node
Definition: parser.h:207
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
static int nsPop(xmlParserCtxtPtr ctxt, int nr)
Definition: parser.c:1688
static int nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL)
Definition: parser.c:1638
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:865
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: tree.h:489
int ret
xmlDocPtr myDoc
Definition: parser.h:189
XMLPUBFUN xmlNodePtr XMLCALL xmlNewComment(const xmlChar *content)
Definition: mxnamespace.c:44
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1660
const xmlChar * encoding
Definition: parser.h:193
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
Definition: dict.c:800
int loadsubset
Definition: parser.h:260
BSTR prefix
Definition: mxnamespace.c:46
const xmlChar * encoding
Definition: tree.h:574
FxCollectionEntry * cur
xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size)
Definition: parser.c:14333
xmlDoc * xmlDocPtr
Definition: tree.h:550
struct _xmlNode * next
Definition: tree.h:496
static void xmlDetectSAX2(xmlParserCtxtPtr ctxt)
Definition: parser.c:1105
#define NULL
Definition: types.h:112
Definition: tree.h:551
XMLPUBFUN void XMLCALL xmlFreeNode(xmlNodePtr cur)
void xmlParseContent(xmlParserCtxtPtr ctxt)
Definition: parser.c:9950
int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value)
Definition: parser.c:1810
#define RAW
Definition: parser.c:2073
#define XML_SKIP_IDS
Definition: parser.h:156
struct _xmlDict * dict
Definition: tree.h:580
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
Definition: dlist.c:348

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

2012 {
2013  unsigned long pos;
2014 
2015  if ((ctxt == NULL) || (info == NULL)) return;
2016 
2017  /* Find pos and check to see if node is already in the sequence */
2019  info->node);
2020 
2021  if ((pos < ctxt->node_seq.length) &&
2022  (ctxt->node_seq.buffer != NULL) &&
2023  (ctxt->node_seq.buffer[pos].node == info->node)) {
2024  ctxt->node_seq.buffer[pos] = *info;
2025  }
2026 
2027  /* Otherwise, we need to add new node to buffer */
2028  else {
2029  if ((ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) ||
2030  (ctxt->node_seq.buffer == NULL)) {
2031  xmlParserNodeInfo *tmp_buffer;
2032  unsigned int byte_size;
2033 
2034  if (ctxt->node_seq.maximum == 0)
2035  ctxt->node_seq.maximum = 2;
2036  byte_size = (sizeof(*ctxt->node_seq.buffer) *
2037  (2 * ctxt->node_seq.maximum));
2038 
2039  if (ctxt->node_seq.buffer == NULL)
2040  tmp_buffer = (xmlParserNodeInfo *) xmlMalloc(byte_size);
2041  else
2042  tmp_buffer =
2044  byte_size);
2045 
2046  if (tmp_buffer == NULL) {
2047  xmlErrMemory(ctxt, "failed to allocate buffer\n");
2048  return;
2049  }
2050  ctxt->node_seq.buffer = tmp_buffer;
2051  ctxt->node_seq.maximum *= 2;
2052  }
2053 
2054  /* If position is not at end, move elements out of the way */
2055  if (pos != ctxt->node_seq.length) {
2056  unsigned long i;
2057 
2058  for (i = ctxt->node_seq.length; i > pos; i--)
2059  ctxt->node_seq.buffer[i] = ctxt->node_seq.buffer[i - 1];
2060  }
2061 
2062  /* Copy element and increase length */
2063  ctxt->node_seq.buffer[pos] = *info;
2064  ctxt->node_seq.length++;
2065  }
2066 }
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, const xmlNodePtr node)
xmlParserNodeInfo * buffer
Definition: parser.h:103
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
struct _test_info info[]
Definition: SetCursorPos.c:19
Definition: tree.h:489
const struct _xmlNode * node
Definition: parser.h:90
unsigned long length
Definition: parser.h:102
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
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
unsigned long maximum
Definition: parser.h:101
xmlParserNodeInfoSeq node_seq
Definition: parser.h:213

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

1911 {
1912  unsigned long pos;
1913 
1914  if ((ctx == NULL) || (node == NULL))
1915  return (NULL);
1916  /* Find position where node should be at */
1917  pos = xmlParserFindNodeInfoIndex(&ctx->node_seq, node);
1918  if (pos < ctx->node_seq.length
1919  && ctx->node_seq.buffer[pos].node == node)
1920  return &ctx->node_seq.buffer[pos];
1921  else
1922  return NULL;
1923 }
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, const xmlNodePtr node)
#define NULL
Definition: types.h:112
Definition: dlist.c:348

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

1973 {
1974  unsigned long upper, lower, middle;
1975  int found = 0;
1976 
1977  if ((seq == NULL) || (node == NULL))
1978  return ((unsigned long) -1);
1979 
1980  /* Do a binary search for the key */
1981  lower = 1;
1982  upper = seq->length;
1983  middle = 0;
1984  while (lower <= upper && !found) {
1985  middle = lower + (upper - lower) / 2;
1986  if (node == seq->buffer[middle - 1].node)
1987  found = 1;
1988  else if (node < seq->buffer[middle - 1].node)
1989  upper = middle - 1;
1990  else
1991  lower = middle + 1;
1992  }
1993 
1994  /* Return position */
1995  if (middle == 0 || seq->buffer[middle - 1].node < node)
1996  return middle;
1997  else
1998  return middle - 1;
1999 }
GLuint buffer
Definition: glext.h:5915
xmlParserNodeInfo * buffer
Definition: parser.h:103
const struct _xmlNode * node
Definition: parser.h:90
unsigned long length
Definition: parser.h:102
#define NULL
Definition: types.h:112
Definition: dlist.c:348

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

300  {
301  int ret;
302  size_t indx;
303  const xmlChar *content;
304 
305  if ((in == NULL) || (len < 0)) return(-1);
306 #ifdef DEBUG_INPUT
308 #endif
309  if (in->buf == NULL) return(-1);
310  if (in->base == NULL) return(-1);
311  if (in->cur == NULL) return(-1);
312  if (in->buf->buffer == NULL) return(-1);
313 
314  CHECK_BUFFER(in);
315 
316  indx = in->cur - in->base;
317  if (xmlBufUse(in->buf->buffer) > (unsigned int) indx + INPUT_CHUNK) {
318 
319  CHECK_BUFFER(in);
320 
321  return(0);
322  }
323  if (in->buf->readcallback != NULL) {
325  } else
326  return(0);
327 
328  /*
329  * NOTE : in->base may be a "dangling" i.e. freed pointer in this
330  * block, but we use it really as an integer to do some
331  * pointer arithmetic. Insure will raise it as a bug but in
332  * that specific case, that's not !
333  */
334 
335  content = xmlBufContent(in->buf->buffer);
336  if (in->base != content) {
337  /*
338  * the buffer has been reallocated
339  */
340  indx = in->cur - in->base;
341  in->base = content;
342  in->cur = &content[indx];
343  }
344  in->end = xmlBufEnd(in->buf->buffer);
345 
346  CHECK_BUFFER(in);
347 
348  return(ret);
349 }
XMLPUBFUN xmlChar *XMLCALL xmlBufContent(const xmlBuf *buf)
Definition: buf.c:582
XMLPUBFUN xmlChar *XMLCALL xmlBufEnd(xmlBufPtr buf)
Definition: buf.c:600
content
Definition: atl_ax.c:993
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
#define INPUT_CHUNK
GLuint in
Definition: glext.h:9616
#define NULL
Definition: types.h:112
XMLPUBFUN int XMLCALL xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len)
#define CHECK_BUFFER(in)
XMLPUBFUN size_t XMLCALL xmlBufUse(const xmlBufPtr buf)
Definition: buf.c:687
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

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

284  {
285  return(-1);
286 }

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

2083  {
2085 
2087  return(old);
2088 }
GLuint GLfloat * val
Definition: glext.h:7180
XMLPUBVAR int xmlPedanticParserDefaultValue
Definition: globals.h:449

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 15196 of file parser.c.

15197 {
15198  xmlParserCtxtPtr ctxt;
15199 
15200  if (cur == NULL)
15201  return (NULL);
15202  xmlInitParser();
15203 
15204  ctxt = xmlCreateDocParserCtxt(cur);
15205  if (ctxt == NULL)
15206  return (NULL);
15207  return (xmlDoRead(ctxt, URL, encoding, options, 0));
15208 }
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15151
void xmlInitParser(void)
Definition: parser.c:14670
xmlParserCtxtPtr xmlCreateDocParserCtxt(const xmlChar *cur)
Definition: parser.c:14536
ed encoding
Definition: write.c:2825
FxCollectionEntry * cur
#define NULL
Definition: types.h:112

◆ 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 15270 of file parser.c.

15271 {
15272  xmlParserCtxtPtr ctxt;
15275 
15276  if (fd < 0)
15277  return (NULL);
15278  xmlInitParser();
15279 
15281  if (input == NULL)
15282  return (NULL);
15283  input->closecallback = NULL;
15284  ctxt = xmlNewParserCtxt();
15285  if (ctxt == NULL) {
15287  return (NULL);
15288  }
15