parser

Name

parser -- 

Synopsis



#define     XML_DEFAULT_VERSION
void        (*xmlParserInputDeallocate)     (xmlChar*);
struct      xmlParserInput;
struct      xmlParserNodeInfo;
typedef     xmlParserNodeInfoPtr;
struct      xmlParserNodeInfoSeq;
typedef     xmlParserNodeInfoSeqPtr;
enum        xmlParserInputState;
#define     XML_DETECT_IDS
#define     XML_COMPLETE_ATTRS
struct      xmlParserCtxt;
struct      xmlSAXLocator;
typedef     xmlSAXLocatorPtr;
xmlParserInputPtr (*resolveEntitySAXFunc)   (void *ctx,
                                             const xmlChar *publicId,
                                             const xmlChar *systemId);
void        (*internalSubsetSAXFunc)        (void *ctx,
                                             const xmlChar *name,
                                             const xmlChar *ExternalID,
                                             const xmlChar *SystemID);
void        (*externalSubsetSAXFunc)        (void *ctx,
                                             const xmlChar *name,
                                             const xmlChar *ExternalID,
                                             const xmlChar *SystemID);
xmlEntityPtr (*getEntitySAXFunc)            (void *ctx,
                                             const xmlChar *name);
xmlEntityPtr (*getParameterEntitySAXFunc)   (void *ctx,
                                             const xmlChar *name);
void        (*entityDeclSAXFunc)            (void *ctx,
                                             const xmlChar *name,
                                             int type,
                                             const xmlChar *publicId,
                                             const xmlChar *systemId,
                                             xmlChar *content);
void        (*notationDeclSAXFunc)          (void *ctx,
                                             const xmlChar *name,
                                             const xmlChar *publicId,
                                             const xmlChar *systemId);
void        (*attributeDeclSAXFunc)         (void *ctx,
                                             const xmlChar *elem,
                                             const xmlChar *name,
                                             int type,
                                             int def,
                                             const xmlChar *defaultValue,
                                             xmlEnumerationPtr tree);
void        (*elementDeclSAXFunc)           (void *ctx,
                                             const xmlChar *name,
                                             int type,
                                             xmlElementContentPtr content);
void        (*unparsedEntityDeclSAXFunc)    (void *ctx,
                                             const xmlChar *name,
                                             const xmlChar *publicId,
                                             const xmlChar *systemId,
                                             const xmlChar *notationName);
void        (*setDocumentLocatorSAXFunc)    (void *ctx,
                                             xmlSAXLocatorPtr loc);
void        (*startDocumentSAXFunc)         (void *ctx);
void        (*endDocumentSAXFunc)           (void *ctx);
void        (*startElementSAXFunc)          (void *ctx,
                                             const xmlChar *name,
                                             const xmlChar **atts);
void        (*endElementSAXFunc)            (void *ctx,
                                             const xmlChar *name);
void        (*attributeSAXFunc)             (void *ctx,
                                             const xmlChar *name,
                                             const xmlChar *value);
void        (*referenceSAXFunc)             (void *ctx,
                                             const xmlChar *name);
void        (*charactersSAXFunc)            (void *ctx,
                                             const xmlChar *ch,
                                             int len);
void        (*ignorableWhitespaceSAXFunc)   (void *ctx,
                                             const xmlChar *ch,
                                             int len);
void        (*processingInstructionSAXFunc) (void *ctx,
                                             const xmlChar *target,
                                             const xmlChar *data);
void        (*commentSAXFunc)               (void *ctx,
                                             const xmlChar *value);
void        (*cdataBlockSAXFunc)            (void *ctx,
                                             const xmlChar *value,
                                             int len);
void        (*warningSAXFunc)               (void *ctx,
                                             const char *msg,
                                             ...);
void        (*errorSAXFunc)                 (void *ctx,
                                             const char *msg,
                                             ...);
void        (*fatalErrorSAXFunc)            (void *ctx,
                                             const char *msg,
                                             ...);
int         (*isStandaloneSAXFunc)          (void *ctx);
int         (*hasInternalSubsetSAXFunc)     (void *ctx);
int         (*hasExternalSubsetSAXFunc)     (void *ctx);
struct      xmlSAXHandler;
typedef     xmlSAXHandlerPtr;
xmlParserInputPtr (*xmlExternalEntityLoader)
                                            (const char *URL,
                                             const char *ID,
                                             xmlParserCtxtPtr context);
#define     xmlSubstituteEntitiesDefaultValue
void        xmlInitParser                   (void);
void        xmlCleanupParser                (void);
int         xmlParserInputRead              (xmlParserInputPtr in,
                                             int len);
int         xmlParserInputGrow              (xmlParserInputPtr in,
                                             int len);
xmlChar*    xmlStrdup                       (const xmlChar *cur);
xmlChar*    xmlStrndup                      (const xmlChar *cur,
                                             int len);
xmlChar*    xmlCharStrndup                  (const char *cur,
                                             int len);
xmlChar*    xmlCharStrdup                   (const char *cur);
xmlChar*    xmlStrsub                       (const xmlChar *str,
                                             int start,
                                             int len);
const xmlChar* xmlStrchr                    (const xmlChar *str,
                                             xmlChar val);
const xmlChar* xmlStrstr                    (const xmlChar *str,
                                             const xmlChar *val);
const xmlChar* xmlStrcasestr                (const xmlChar *str,
                                             xmlChar *val);
int         xmlStrcmp                       (const xmlChar *str1,
                                             const xmlChar *str2);
int         xmlStrncmp                      (const xmlChar *str1,
                                             const xmlChar *str2,
                                             int len);
int         xmlStrcasecmp                   (const xmlChar *str1,
                                             const xmlChar *str2);
int         xmlStrncasecmp                  (const xmlChar *str1,
                                             const xmlChar *str2,
                                             int len);
int         xmlStrEqual                     (const xmlChar *str1,
                                             const xmlChar *str2);
int         xmlStrlen                       (const xmlChar *str);
xmlChar*    xmlStrcat                       (xmlChar *cur,
                                             const xmlChar *add);
xmlChar*    xmlStrncat                      (xmlChar *cur,
                                             const xmlChar *add,
                                             int len);
xmlDocPtr   xmlParseDoc                     (xmlChar *cur);
xmlDocPtr   xmlParseMemory                  (const char *buffer,
                                             int size);
xmlDocPtr   xmlParseFile                    (const char *filename);
int         xmlSubstituteEntitiesDefault    (int val);
int         xmlKeepBlanksDefault            (int val);
void        xmlStopParser                   (xmlParserCtxtPtr ctxt);
int         xmlPedanticParserDefault        (int val);
int         xmlLineNumbersDefault           (int val);
xmlDocPtr   xmlRecoverDoc                   (xmlChar *cur);
xmlDocPtr   xmlRecoverMemory                (const char *buffer,
                                             int size);
xmlDocPtr   xmlRecoverFile                  (const char *filename);
int         xmlParseDocument                (xmlParserCtxtPtr ctxt);
int         xmlParseExtParsedEnt            (xmlParserCtxtPtr ctxt);
xmlDocPtr   xmlSAXParseDoc                  (xmlSAXHandlerPtr sax,
                                             xmlChar *cur,
                                             int recovery);
int         xmlSAXUserParseFile             (xmlSAXHandlerPtr sax,
                                             void *user_data,
                                             const char *filename);
int         xmlSAXUserParseMemory           (xmlSAXHandlerPtr sax,
                                             void *user_data,
                                             const char *buffer,
                                             int size);
xmlDocPtr   xmlSAXParseMemory               (xmlSAXHandlerPtr sax,
                                             const char *buffer,
                                             int size,
                                             int recovery);
xmlDocPtr   xmlSAXParseFile                 (xmlSAXHandlerPtr sax,
                                             const char *filename,
                                             int recovery);
xmlDocPtr   xmlSAXParseFileWithData         (xmlSAXHandlerPtr sax,
                                             const char *filename,
                                             int recovery,
                                             void *data);
xmlDocPtr   xmlSAXParseEntity               (xmlSAXHandlerPtr sax,
                                             const char *filename);
xmlDocPtr   xmlParseEntity                  (const char *filename);
xmlDtdPtr   xmlParseDTD                     (const xmlChar *ExternalID,
                                             const xmlChar *SystemID);
xmlDtdPtr   xmlSAXParseDTD                  (xmlSAXHandlerPtr sax,
                                             const xmlChar *ExternalID,
                                             const xmlChar *SystemID);
xmlDtdPtr   xmlIOParseDTD                   (xmlSAXHandlerPtr sax,
                                             xmlParserInputBufferPtr input,
                                             xmlCharEncoding enc);
int         xmlParseBalancedChunkMemory     (xmlDocPtr doc,
                                             xmlSAXHandlerPtr sax,
                                             void *user_data,
                                             int depth,
                                             const xmlChar *string,
                                             xmlNodePtr *lst);
int         xmlParseExternalEntity          (xmlDocPtr doc,
                                             xmlSAXHandlerPtr sax,
                                             void *user_data,
                                             int depth,
                                             const xmlChar *URL,
                                             const xmlChar *ID,
                                             xmlNodePtr *lst);
int         xmlParseCtxtExternalEntity      (xmlParserCtxtPtr ctx,
                                             const xmlChar *URL,
                                             const xmlChar *ID,
                                             xmlNodePtr *lst);
void        xmlDefaultSAXHandlerInit        (void);
void        htmlDefaultSAXHandlerInit       (void);
void        xmlInitParserCtxt               (xmlParserCtxtPtr ctxt);
void        xmlClearParserCtxt              (xmlParserCtxtPtr ctxt);
void        xmlFreeParserCtxt               (xmlParserCtxtPtr ctxt);
void        xmlSetupParserForBuffer         (xmlParserCtxtPtr ctxt,
                                             const xmlChar *buffer,
                                             const char *filename);
xmlParserCtxtPtr xmlCreateDocParserCtxt     (xmlChar *cur);
int         xmlGetFeaturesList              (int *len,
                                             const char **result);
int         xmlGetFeature                   (xmlParserCtxtPtr ctxt,
                                             const char *name,
                                             void *result);
int         xmlSetFeature                   (xmlParserCtxtPtr ctxt,
                                             const char *name,
                                             void *value);
xmlParserCtxtPtr xmlCreatePushParserCtxt    (xmlSAXHandlerPtr sax,
                                             void *user_data,
                                             const char *chunk,
                                             int size,
                                             const char *filename);
int         xmlParseChunk                   (xmlParserCtxtPtr ctxt,
                                             const char *chunk,
                                             int size,
                                             int terminate);
xmlParserCtxtPtr xmlCreateIOParserCtxt      (xmlSAXHandlerPtr sax,
                                             void *user_data,
                                             xmlInputReadCallback ioread,
                                             xmlInputCloseCallback ioclose,
                                             void *ioctx,
                                             xmlCharEncoding enc);
xmlParserInputPtr xmlNewIOInputStream       (xmlParserCtxtPtr ctxt,
                                             xmlParserInputBufferPtr input,
                                             xmlCharEncoding enc);
const xmlParserNodeInfo* xmlParserFindNodeInfo
                                            (const xmlParserCtxtPtr ctxt,
                                             const xmlNodePtr node);
void        xmlInitNodeInfoSeq              (xmlParserNodeInfoSeqPtr seq);
void        xmlClearNodeInfoSeq             (xmlParserNodeInfoSeqPtr seq);
unsigned long xmlParserFindNodeInfoIndex    (const xmlParserNodeInfoSeqPtr seq,
                                             const xmlNodePtr node);
void        xmlParserAddNodeInfo            (xmlParserCtxtPtr ctxt,
                                             const xmlParserNodeInfoPtr info);
void        xmlSetExternalEntityLoader      (xmlExternalEntityLoader f);
xmlExternalEntityLoader xmlGetExternalEntityLoader
                                            (void);
xmlParserInputPtr xmlLoadExternalEntity     (const char *URL,
                                             const char *ID,
                                             xmlParserCtxtPtr context);

Description

Details

>XML_DEFAULT_VERSION

#define XML_DEFAULT_VERSION	"1.0"

The default version of XML used: 1.0


>xmlParserInputDeallocate ()

void        (*xmlParserInputDeallocate)     (xmlChar*);

Param1 : 


>struct xmlParserInput

struct xmlParserInput {
    /* Input buffer */
    xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */

    const char *filename;             /* The file analyzed, if any */
    const char *directory;            /* the directory/base of the file */
    const xmlChar *base;              /* Base of the array to parse */
    const xmlChar *cur;               /* Current char being parsed */
    const xmlChar *end;               /* end of the array to parse */
    int length;                       /* length if known */
    int line;                         /* Current line */
    int col;                          /* Current column */
    int consumed;                     /* How many xmlChars already consumed */
    xmlParserInputDeallocate free;    /* function to deallocate the base */
    const xmlChar *encoding;          /* the encoding string for entity */
    const xmlChar *version;           /* the version string for entity */
    int standalone;                   /* Was that entity marked standalone */
};

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.


>struct xmlParserNodeInfo

struct xmlParserNodeInfo {
  const struct _xmlNode* node;
  /* Position & line # that text that created the node begins & ends on */
  unsigned long begin_pos;
  unsigned long begin_line;
  unsigned long end_pos;
  unsigned long end_line;
};

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


>xmlParserNodeInfoPtr

typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;


>struct xmlParserNodeInfoSeq

struct xmlParserNodeInfoSeq {
  unsigned long maximum;
  unsigned long length;
  xmlParserNodeInfo* buffer;
};


>xmlParserNodeInfoSeqPtr

typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;


>enum xmlParserInputState

typedef enum {
    XML_PARSER_EOF = -1,	/* nothing is to be parsed */
    XML_PARSER_START = 0,	/* nothing has been parsed */
    XML_PARSER_MISC,		/* Misc* before int subset */
    XML_PARSER_PI,		/* Within a processing instruction */
    XML_PARSER_DTD,		/* within some DTD content */
    XML_PARSER_PROLOG,		/* Misc* after internal subset */
    XML_PARSER_COMMENT,		/* within a comment */
    XML_PARSER_START_TAG,	/* within a start tag */
    XML_PARSER_CONTENT,		/* within the content */
    XML_PARSER_CDATA_SECTION,	/* within a CDATA section */
    XML_PARSER_END_TAG,		/* within a closing tag */
    XML_PARSER_ENTITY_DECL,	/* within an entity declaration */
    XML_PARSER_ENTITY_VALUE,	/* within an entity value in a decl */
    XML_PARSER_ATTRIBUTE_VALUE,	/* within an attribute value */
    XML_PARSER_SYSTEM_LITERAL,	/* within a SYSTEM value */
    XML_PARSER_EPILOG, 		/* the Misc* after the last end tag */
    XML_PARSER_IGNORE		/* within an IGNORED section */
} xmlParserInputState;

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


>XML_DETECT_IDS

#define XML_DETECT_IDS		2

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


>XML_COMPLETE_ATTRS

#define XML_COMPLETE_ATTRS	4

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


>struct xmlParserCtxt

struct xmlParserCtxt {
    struct _xmlSAXHandler *sax;       /* The SAX handler */
    void            *userData;        /* For SAX interface only, used by DOM build */
    xmlDocPtr           myDoc;        /* the document being built */
    int            wellFormed;        /* is the document well formed */
    int       replaceEntities;        /* shall we replace entities ? */
    const xmlChar    *version;        /* the XML version string */
    const xmlChar   *encoding;        /* the declared encoding, if any */
    int            standalone;        /* standalone document */
    int                  html;        /* an HTML(1)/Docbook(2) document */

    /* Input stream stack */
    xmlParserInputPtr  input;         /* Current input stream */
    int                inputNr;       /* Number of current input streams */
    int                inputMax;      /* Max number of input streams */
    xmlParserInputPtr *inputTab;      /* stack of inputs */

    /* Node analysis stack only used for DOM building */
    xmlNodePtr         node;          /* Current parsed Node */
    int                nodeNr;        /* Depth of the parsing stack */
    int                nodeMax;       /* Max depth of the parsing stack */
    xmlNodePtr        *nodeTab;       /* array of nodes */

    int record_info;                  /* Whether node info should be kept */
    xmlParserNodeInfoSeq node_seq;    /* info about each node parsed */

    int errNo;                        /* error code */

    int     hasExternalSubset;        /* reference and external subset */
    int             hasPErefs;        /* the internal subset has PE refs */
    int              external;        /* are we parsing an external entity */

    int                 valid;        /* is the document valid */
    int              validate;        /* shall we try to validate ? */
    xmlValidCtxt        vctxt;        /* The validity context */

    xmlParserInputState instate;      /* current type of input */
    int                 token;        /* next char look-ahead */    

    char           *directory;        /* the data directory */

    /* Node name stack */
    xmlChar           *name;          /* Current parsed Node */
    int                nameNr;        /* Depth of the parsing stack */
    int                nameMax;       /* Max depth of the parsing stack */
    xmlChar *         *nameTab;       /* array of nodes */

    long               nbChars;       /* number of xmlChar processed */
    long            checkIndex;       /* used by progressive parsing lookup */
    int             keepBlanks;       /* ugly but ... */
    int             disableSAX;       /* SAX callbacks are disabled */
    int               inSubset;       /* Parsing is in int 1/ext 2 subset */
    xmlChar *          intSubName;    /* name of subset */
    xmlChar *          extSubURI;     /* URI of external subset */
    xmlChar *          extSubSystem;  /* SYSTEM ID of external subset */

    /* xml:space values */
    int *              space;         /* Should the parser preserve spaces */
    int                spaceNr;       /* Depth of the parsing stack */
    int                spaceMax;      /* Max depth of the parsing stack */
    int *              spaceTab;      /* array of space infos */

    int                depth;         /* to prevent entity substitution loops */
    xmlParserInputPtr  entity;        /* used to check entities boundaries */
    int                charset;       /* encoding of the in-memory content
				         actually an xmlCharEncoding */
    int                nodelen;       /* Those two fields are there to */
    int                nodemem;       /* Speed up large node parsing */
    int                pedantic;      /* signal pedantic warnings */
    void              *_private;      /* For user data, libxml won't touch it */

    int                loadsubset;    /* should the external subset be loaded */
    int                linenumbers;   /* set line number in element content */
    void              *catalogs;       /* document's own catalog */
};

The parser context. NOTE This doesn't completely defines the parser state, the (current ?) design of the parser uses recursive function calls since this allow and easy mapping from the production rules of the specification to the actual code. The drawback is that the actual function call also reflect the parser state. However most of the parsing routines takes as the only argument the parser context pointer, so migrating to a state based parser for progressive parsing shouldn't be too hard.


>struct xmlSAXLocator

struct xmlSAXLocator {
    const xmlChar *(*getPublicId)(void *ctx);
    const xmlChar *(*getSystemId)(void *ctx);
    int (*getLineNumber)(void *ctx);
    int (*getColumnNumber)(void *ctx);
};

a SAX Locator.


>xmlSAXLocatorPtr

typedef xmlSAXLocator *xmlSAXLocatorPtr;


>resolveEntitySAXFunc ()

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

ctx : 
publicId : 
systemId : 
Returns : 


>internalSubsetSAXFunc ()

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

ctx : 
name : 
ExternalID : 
SystemID : 


>externalSubsetSAXFunc ()

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

ctx : 
name : 
ExternalID : 
SystemID : 


>getEntitySAXFunc ()

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

ctx : 
name : 
Returns : 


>getParameterEntitySAXFunc ()

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

ctx : 
name : 
Returns : 


>entityDeclSAXFunc ()

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

ctx : 
name : 
type : 
publicId : 
systemId : 
content : 


>notationDeclSAXFunc ()

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

ctx : 
name : 
publicId : 
systemId : 


>attributeDeclSAXFunc ()

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

ctx : 
elem : 
name : 
type : 
def : 
defaultValue : 
tree : 


>elementDeclSAXFunc ()

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

ctx : 
name : 
type : 
content : 


>unparsedEntityDeclSAXFunc ()

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

ctx : 
name : 
publicId : 
systemId : 
notationName : 


>setDocumentLocatorSAXFunc ()

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

ctx : 
loc : 


>startDocumentSAXFunc ()

void        (*startDocumentSAXFunc)         (void *ctx);

ctx : 


>endDocumentSAXFunc ()

void        (*endDocumentSAXFunc)           (void *ctx);

ctx : 


>startElementSAXFunc ()

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

ctx : 
name : 
atts : 


>endElementSAXFunc ()

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

ctx : 
name : 


>attributeSAXFunc ()

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

ctx : 
name : 
value : 


>referenceSAXFunc ()

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

ctx : 
name : 


>charactersSAXFunc ()

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

ctx : 
ch : 
len : 


>ignorableWhitespaceSAXFunc ()

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

ctx : 
ch : 
len : 


>processingInstructionSAXFunc ()

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

ctx : 
target : 
data : 


>commentSAXFunc ()

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

ctx : 
value : 


>cdataBlockSAXFunc ()

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

ctx : 
value : 
len : 


>warningSAXFunc ()

void        (*warningSAXFunc)               (void *ctx,
                                             const char *msg,
                                             ...);

ctx : 
msg : 
... : 


>errorSAXFunc ()

void        (*errorSAXFunc)                 (void *ctx,
                                             const char *msg,
                                             ...);

ctx : 
msg : 
... : 


>fatalErrorSAXFunc ()

void        (*fatalErrorSAXFunc)            (void *ctx,
                                             const char *msg,
                                             ...);

ctx : 
msg : 
... : 


>isStandaloneSAXFunc ()

int         (*isStandaloneSAXFunc)          (void *ctx);

ctx : 
Returns : 


>hasInternalSubsetSAXFunc ()

int         (*hasInternalSubsetSAXFunc)     (void *ctx);

ctx : 
Returns : 


>hasExternalSubsetSAXFunc ()

int         (*hasExternalSubsetSAXFunc)     (void *ctx);

ctx : 
Returns : 


>struct xmlSAXHandler

struct xmlSAXHandler {
    internalSubsetSAXFunc internalSubset;
    isStandaloneSAXFunc isStandalone;
    hasInternalSubsetSAXFunc hasInternalSubset;
    hasExternalSubsetSAXFunc hasExternalSubset;
    resolveEntitySAXFunc resolveEntity;
    getEntitySAXFunc getEntity;
    entityDeclSAXFunc entityDecl;
    notationDeclSAXFunc notationDecl;
    attributeDeclSAXFunc attributeDecl;
    elementDeclSAXFunc elementDecl;
    unparsedEntityDeclSAXFunc unparsedEntityDecl;
    setDocumentLocatorSAXFunc setDocumentLocator;
    startDocumentSAXFunc startDocument;
    endDocumentSAXFunc endDocument;
    startElementSAXFunc startElement;
    endElementSAXFunc endElement;
    referenceSAXFunc reference;
    charactersSAXFunc characters;
    ignorableWhitespaceSAXFunc ignorableWhitespace;
    processingInstructionSAXFunc processingInstruction;
    commentSAXFunc comment;
    warningSAXFunc warning;
    errorSAXFunc error;
    fatalErrorSAXFunc fatalError;
    getParameterEntitySAXFunc getParameterEntity;
    cdataBlockSAXFunc cdataBlock;
    externalSubsetSAXFunc externalSubset;
    int initialized;
};

a SAX handler is bunch of callbacks called by the parser when processing of the input generate data or structure informations.


>xmlSAXHandlerPtr

typedef xmlSAXHandler *xmlSAXHandlerPtr;


>xmlExternalEntityLoader ()

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

External entity loaders types

URL : The System ID of the resource requested
ID : The Public ID of the resource requested
context : the XML parser context
Returns :the entity input parser


>xmlSubstituteEntitiesDefaultValue

#define     xmlSubstituteEntitiesDefaultValue

global variable controlling the entity substitution default behavior


>xmlInitParser ()

void        xmlInitParser                   (void);

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


>xmlCleanupParser ()

void        xmlCleanupParser                (void);

Cleanup function for the XML parser. It tries to reclaim all parsing related global memory allocated for the parser processing. It doesn't deallocate any document related memory. Calling this function should not prevent reusing the parser.


>xmlParserInputRead ()

int         xmlParserInputRead              (xmlParserInputPtr in,
                                             int len);

This function refresh the input for the parser. It doesn't try to preserve pointers to the input buffer, and discard already read data

in : an XML parser input
len : an indicative size for the lookahead
Returns :the number of xmlChars read, or -1 in case of error, 0 indicate the end of this entity


>xmlParserInputGrow ()

int         xmlParserInputGrow              (xmlParserInputPtr in,
                                             int len);

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

in : an XML parser input
len : an indicative size for the lookahead
Returns :the number of xmlChars read, or -1 in case of error, 0 indicate the end of this entity


>xmlStrdup ()

xmlChar*    xmlStrdup                       (const xmlChar *cur);

a strdup for array of xmlChar's. Since they are supposed to be encoded in UTF-8 or an encoding with 8bit based chars, we assume a termination mark of '0'.

cur : the input xmlChar *
Returns :a new xmlChar * or NULL


>xmlStrndup ()

xmlChar*    xmlStrndup                      (const xmlChar *cur,
                                             int len);

a strndup for array of xmlChar's

cur : the input xmlChar *
len : the len of cur
Returns :a new xmlChar * or NULL


>xmlCharStrndup ()

xmlChar*    xmlCharStrndup                  (const char *cur,
                                             int len);

a strndup for char's to xmlChar's

cur : the input char *
len : the len of cur
Returns :a new xmlChar * or NULL


>xmlCharStrdup ()

xmlChar*    xmlCharStrdup                   (const char *cur);

a strdup for char's to xmlChar's

cur : the input char *
Returns :a new xmlChar * or NULL


>xmlStrsub ()

xmlChar*    xmlStrsub                       (const xmlChar *str,
                                             int start,
                                             int len);

Extract a substring of a given string

str : the xmlChar * array (haystack)
start : the index of the first char (zero based)
len : the length of the substring
Returns :the xmlChar * for the first occurrence or NULL.


>xmlStrchr ()

const xmlChar* xmlStrchr                    (const xmlChar *str,
                                             xmlChar val);

a strchr for xmlChar's

str : the xmlChar * array
val : the xmlChar to search
Returns :the xmlChar * for the first occurrence or NULL.


>xmlStrstr ()

const xmlChar* xmlStrstr                    (const xmlChar *str,
                                             const xmlChar *val);

a strstr for xmlChar's

str : the xmlChar * array (haystack)
val : the xmlChar to search (needle)
Returns :the xmlChar * for the first occurrence or NULL.


>xmlStrcasestr ()

const xmlChar* xmlStrcasestr                (const xmlChar *str,
                                             xmlChar *val);

a case-ignoring strstr for xmlChar's

str : the xmlChar * array (haystack)
val : the xmlChar to search (needle)
Returns :the xmlChar * for the first occurrence or NULL.


>xmlStrcmp ()

int         xmlStrcmp                       (const xmlChar *str1,
                                             const xmlChar *str2);

a strcmp for xmlChar's

str1 : the first xmlChar *
str2 : the second xmlChar *
Returns :the integer result of the comparison


>xmlStrncmp ()

int         xmlStrncmp                      (const xmlChar *str1,
                                             const xmlChar *str2,
                                             int len);

a strncmp for xmlChar's

str1 : the first xmlChar *
str2 : the second xmlChar *
len : the max comparison length
Returns :the integer result of the comparison


>xmlStrcasecmp ()

int         xmlStrcasecmp                   (const xmlChar *str1,
                                             const xmlChar *str2);

a strcasecmp for xmlChar's

str1 : the first xmlChar *
str2 : the second xmlChar *
Returns :the integer result of the comparison


>xmlStrncasecmp ()

int         xmlStrncasecmp                  (const xmlChar *str1,
                                             const xmlChar *str2,
                                             int len);

a strncasecmp for xmlChar's

str1 : the first xmlChar *
str2 : the second xmlChar *
len : the max comparison length
Returns :the integer result of the comparison


>xmlStrEqual ()

int         xmlStrEqual                     (const xmlChar *str1,
                                             const xmlChar *str2);

Check if both string are equal of have same content Should be a bit more readable and faster than xmlStrEqual()

str1 : the first xmlChar *
str2 : the second xmlChar *
Returns :1 if they are equal, 0 if they are different


>xmlStrlen ()

int         xmlStrlen                       (const xmlChar *str);

length of a xmlChar's string

str : the xmlChar * array
Returns :the number of xmlChar contained in the ARRAY.


>xmlStrcat ()

xmlChar*    xmlStrcat                       (xmlChar *cur,
                                             const xmlChar *add);

a strcat for array of xmlChar's. Since they are supposed to be encoded in UTF-8 or an encoding with 8bit based chars, we assume a termination mark of '0'.

cur : the original xmlChar * array
add : the xmlChar * array added
Returns :a new xmlChar * containing the concatenated string.


>xmlStrncat ()

xmlChar*    xmlStrncat                      (xmlChar *cur,
                                             const xmlChar *add,
                                             int len);

a strncat for array of xmlChar's, it will extend cur with the len first bytes of add.

cur : the original xmlChar * array
add : the xmlChar * array added
len : the length of add
Returns :a new xmlChar *, the original cur is reallocated if needed and should not be freed


>xmlParseDoc ()

xmlDocPtr   xmlParseDoc                     (xmlChar *cur);

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

cur : a pointer to an array of xmlChar
Returns :the resulting document tree


>xmlParseMemory ()

xmlDocPtr   xmlParseMemory                  (const char *buffer,
                                             int size);

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

buffer : an pointer to a char array
size : the size of the array
Returns :the resulting document tree


>xmlParseFile ()

xmlDocPtr   xmlParseFile                    (const char *filename);

parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.

filename : the filename
Returns :the resulting document tree if the file was wellformed, NULL otherwise.


>xmlSubstituteEntitiesDefault ()

int         xmlSubstituteEntitiesDefault    (int val);

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

val : int 0 or 1
Returns :the last value for 0 for no substitution, 1 for substitution.


>xmlKeepBlanksDefault ()

int         xmlKeepBlanksDefault            (int val);

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 ignorableWhitespace() 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.

val : int 0 or 1
Returns :the last value for 0 for no substitution, 1 for substitution.


>xmlStopParser ()

void        xmlStopParser                   (xmlParserCtxtPtr ctxt);

Blocks further parser processing

ctxt : an XML parser context


>xmlPedanticParserDefault ()

int         xmlPedanticParserD