ReactOS  0.4.15-dev-3207-ga415bd4
parser.c File Reference
#include "libxml.h"
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <libxml/xmlmemory.h>
#include <libxml/threads.h>
#include <libxml/globals.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/valid.h>
#include <libxml/entities.h>
#include <libxml/xmlerror.h>
#include <libxml/encoding.h>
#include <libxml/xmlIO.h>
#include <libxml/uri.h>
#include <ctype.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "buf.h"
#include "enc.h"
#include "elfgcchack.h"
Include dependency graph for parser.c:

Go to the source code of this file.

Classes

struct  _xmlStartTag
 
struct  _xmlDefAttrs
 

Macros

#define IN_LIBXML
 
#define XML_DIR_SEP   '/'
 
#define XML_PARSER_BIG_ENTITY   1000
 
#define XML_PARSER_LOT_ENTITY   5000
 
#define XML_PARSER_NON_LINEAR   10
 
#define SAX2   1
 
#define XML_PARSER_BIG_BUFFER_SIZE   300
 
#define XML_PARSER_BUFFER_SIZE   100
 
#define SAX_COMPAT_MODE   BAD_CAST "SAX compatibility mode document"
 
#define XML_PARSER_CHUNK_SIZE   100
 
#define RAW   (*ctxt->input->cur)
 
#define CUR   (*ctxt->input->cur)
 
#define NXT(val)   ctxt->input->cur[(val)]
 
#define CUR_PTR   ctxt->input->cur
 
#define BASE_PTR   ctxt->input->base
 
#define CMP4(s, c1, c2, c3, c4)
 
#define CMP5(s, c1, c2, c3, c4, c5)   ( CMP4( s, c1, c2, c3, c4 ) && ((unsigned char *) s)[ 4 ] == c5 )
 
#define CMP6(s, c1, c2, c3, c4, c5, c6)   ( CMP5( s, c1, c2, c3, c4, c5 ) && ((unsigned char *) s)[ 5 ] == c6 )
 
#define CMP7(s, c1, c2, c3, c4, c5, c6, c7)   ( CMP6( s, c1, c2, c3, c4, c5, c6 ) && ((unsigned char *) s)[ 6 ] == c7 )
 
#define CMP8(s, c1, c2, c3, c4, c5, c6, c7, c8)   ( CMP7( s, c1, c2, c3, c4, c5, c6, c7 ) && ((unsigned char *) s)[ 7 ] == c8 )
 
#define CMP9(s, c1, c2, c3, c4, c5, c6, c7, c8, c9)
 
#define CMP10(s, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
 
#define SKIP(val)
 
#define SKIPL(val)
 
#define SHRINK
 
#define GROW
 
#define SKIP_BLANKS   xmlSkipBlankChars(ctxt)
 
#define NEXT   xmlNextChar(ctxt)
 
#define NEXT1
 
#define NEXTL(l)
 
#define CUR_CHAR(l)   xmlCurrentChar(ctxt, &l)
 
#define CUR_SCHAR(s, l)   xmlStringCurrentChar(ctxt, s, &l)
 
#define COPY_BUF(l, b, i, v)
 
#define growBuffer(buffer, n)
 

Typedefs

typedef struct _xmlDefAttrs xmlDefAttrs
 
typedef xmlDefAttrsxmlDefAttrsPtr
 

Functions

static void xmlFatalErr (xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
 
static int xmlParserEntityCheck (xmlParserCtxtPtr ctxt, size_t size, xmlEntityPtr ent, size_t replacement)
 
static void xmlErrAttributeDup (xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *localname)
 
static void LIBXML_ATTR_FORMAT (3, 0)
 
int xmlHasFeature (xmlFeature feature)
 
static void xmlDetectSAX2 (xmlParserCtxtPtr ctxt)
 
static xmlCharxmlAttrNormalizeSpace (const xmlChar *src, xmlChar *dst)
 
static const xmlCharxmlAttrNormalizeSpace2 (xmlParserCtxtPtr ctxt, xmlChar *src, int *len)
 
static void xmlAddDefAttrs (xmlParserCtxtPtr ctxt, const xmlChar *fullname, const xmlChar *fullattr, const xmlChar *value)
 
static void xmlAddSpecialAttr (xmlParserCtxtPtr ctxt, const xmlChar *fullname, const xmlChar *fullattr, int type)
 
static void xmlCleanSpecialAttrCallback (void *payload, void *data, const xmlChar *fullname, const xmlChar *fullattr, const xmlChar *unused ATTRIBUTE_UNUSED)
 
static void xmlCleanSpecialAttr (xmlParserCtxtPtr ctxt)
 
int xmlCheckLanguageID (const xmlChar *lang)
 
static int nsPush (xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL)
 
static int nsPop (xmlParserCtxtPtr ctxt, int nr)
 
static int xmlCtxtGrowAttrs (xmlParserCtxtPtr ctxt, int nr)
 
int inputPush (xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
 
xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt)
 
int nodePush (xmlParserCtxtPtr ctxt, xmlNodePtr value)
 
xmlNodePtr nodePop (xmlParserCtxtPtr ctxt)
 
static int nameNsPush (xmlParserCtxtPtr ctxt, const xmlChar *value, const xmlChar *prefix, const xmlChar *URI, int line, int nsNr)
 
int namePush (xmlParserCtxtPtr ctxt, const xmlChar *value)
 
const xmlCharnamePop (xmlParserCtxtPtr ctxt)
 
static int spacePush (xmlParserCtxtPtr ctxt, int val)
 
static int spacePop (xmlParserCtxtPtr ctxt)
 
static void xmlSHRINK (xmlParserCtxtPtr ctxt)
 
static void xmlGROW (xmlParserCtxtPtr ctxt)
 
int xmlSkipBlankChars (xmlParserCtxtPtr ctxt)
 
xmlChar xmlPopInput (xmlParserCtxtPtr ctxt)
 
int xmlPushInput (xmlParserCtxtPtr ctxt, xmlParserInputPtr input)
 
int xmlParseCharRef (xmlParserCtxtPtr ctxt)
 
static int xmlParseStringCharRef (xmlParserCtxtPtr ctxt, const xmlChar **str)
 
void xmlParserHandlePEReference (xmlParserCtxtPtr ctxt)
 
xmlCharxmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3)
 
xmlCharxmlStringDecodeEntities (xmlParserCtxtPtr ctxt, const xmlChar *str, int what, xmlChar end, xmlChar end2, xmlChar end3)
 
static int areBlanks (xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int blank_chars)
 
: the name of the element being defined.

xmlParseElementContentDecl: @ctxt: an XML parser context

Returns
: the Element Content pointer will be stored here if any

parse the declaration for an Element content either Mixed or Children, the cases EMPTY and ANY are handled directly in xmlParseElementDecl

[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children

returns: the type of element content XML_ELEMENT_TYPE_xxx

static xmlEntityPtr xmlParseStringPEReference (xmlParserCtxtPtr ctxt, const xmlChar **str)
 
static int xmlLoadEntityContent (xmlParserCtxtPtr ctxt, xmlEntityPtr entity)
 
static xmlEntityPtr xmlParseStringEntityRef (xmlParserCtxtPtr ctxt, const xmlChar **str)
 
int xmlParseElementContentDecl (xmlParserCtxtPtr ctxt, const xmlChar *name, xmlElementContentPtr *result)
 
int xmlParseElementDecl (xmlParserCtxtPtr ctxt)
 
static void xmlParseConditionalSections (xmlParserCtxtPtr ctxt)
 
void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt)
 
void xmlParseTextDecl (xmlParserCtxtPtr ctxt)
 
void xmlParseExternalSubset (xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, const xmlChar *SystemID)
 
void xmlParseReference (xmlParserCtxtPtr ctxt)
 
xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt)
 
void xmlParsePEReference (xmlParserCtxtPtr ctxt)
 
void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt)
 
static void xmlParseInternalSubset (xmlParserCtxtPtr ctxt)
 
static const xmlCharxmlGetNamespace (xmlParserCtxtPtr ctxt, const xmlChar *prefix)
 
static const xmlCharxmlParseQName (xmlParserCtxtPtr ctxt, const xmlChar **prefix)
 

Variables

unsigned int xmlParserMaxDepth = 256
 
static const charxmlW3CPIs []
 

: an XML parser context

xmlSplitQName: @ctxt: an XML parser context

@prefix: a xmlChar **

parse an UTF8 encoded XML qualified name string

[NS 5] QName ::= (Prefix ':')? LocalPart

[NS 6] Prefix ::= NCName

[NS 7] LocalPart ::= NCName

Returns the local part, and prefix is updated to get the Prefix if any.

static const unsigned char test_char_data [256]
 
xmlCharxmlSplitQName (xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix)
 
static int xmlIsNameStartChar (xmlParserCtxtPtr ctxt, int c)
 
static int xmlIsNameChar (xmlParserCtxtPtr ctxt, int c)
 
static xmlCharxmlParseAttValueInternal (xmlParserCtxtPtr ctxt, int *len, int *alloc, int normalize)
 
static const xmlCharxmlParseNameComplex (xmlParserCtxtPtr ctxt)
 
const xmlCharxmlParseName (xmlParserCtxtPtr ctxt)
 
static const xmlCharxmlParseNCNameComplex (xmlParserCtxtPtr ctxt)
 
static const xmlCharxmlParseNCName (xmlParserCtxtPtr ctxt)
 
static const xmlCharxmlParseNameAndCompare (xmlParserCtxtPtr ctxt, xmlChar const *other)
 
static xmlCharxmlParseStringName (xmlParserCtxtPtr ctxt, const xmlChar **str)
 
xmlCharxmlParseNmtoken (xmlParserCtxtPtr ctxt)
 
xmlCharxmlParseEntityValue (xmlParserCtxtPtr ctxt, xmlChar **orig)
 
static xmlCharxmlParseAttValueComplex (xmlParserCtxtPtr ctxt, int *attlen, int normalize)
 
xmlCharxmlParseAttValue (xmlParserCtxtPtr ctxt)
 
xmlCharxmlParseSystemLiteral (xmlParserCtxtPtr ctxt)
 
xmlCharxmlParsePubidLiteral (xmlParserCtxtPtr ctxt)
 
static void xmlParseCharDataComplex (xmlParserCtxtPtr ctxt, int cdata)
 
void xmlParseCharData (xmlParserCtxtPtr ctxt, int cdata)
 
xmlCharxmlParseExternalID (xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict)
 
static void xmlParseCommentComplex (xmlParserCtxtPtr ctxt, xmlChar *buf, size_t len, size_t size)
 
void xmlParseComment (xmlParserCtxtPtr ctxt)
 
const xmlCharxmlParsePITarget (xmlParserCtxtPtr ctxt)
 
void xmlParsePI (xmlParserCtxtPtr ctxt)
 
void xmlParseNotationDecl (xmlParserCtxtPtr ctxt)
 
void xmlParseEntityDecl (xmlParserCtxtPtr ctxt)
 
int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, xmlChar **value)
 
xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt)
 
xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt)
 
int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree)
 
int xmlParseAttributeType (xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree)
 
void xmlParseAttributeListDecl (xmlParserCtxtPtr ctxt)
 
xmlElementContentPtr xmlParseElementMixedContentDecl (xmlParserCtxtPtr ctxt, int inputchk)
 
static xmlElementContentPtr xmlParseElementChildrenContentDeclPriv (xmlParserCtxtPtr ctxt, int inputchk, int depth)
 
xmlElementContentPtr xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk)
 

: the localname

xmlParseQNameAndCompare: @ctxt: an XML parser context

@prefix: the prefix, if any.

parse an XML name and compares for match (specialized for endtag parsing)

Returns NULL for an illegal name, (xmlChar*) 1 for success and the name for mismatch

#define GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
 
#define DICT_FREE(str)
 
#define bottom_parser
 
static int xmlParserInitialized = 0
 
static xmlParserCtxtPtr xmlCreateEntityParserCtxtInternal (const xmlChar *URL, const xmlChar *ID, const xmlChar *base, xmlParserCtxtPtr pctx)
 
static void xmlHaltParser (xmlParserCtxtPtr ctxt)
 
static int xmlParseElementStart (xmlParserCtxtPtr ctxt)
 
static void xmlParseElementEnd (xmlParserCtxtPtr ctxt)
 
static xmlParserErrors xmlParseExternalEntityPrivate (xmlDocPtr doc, xmlParserCtxtPtr oldctxt, xmlSAXHandlerPtr sax, void *user_data, int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *list)
 
static int xmlCtxtUseOptionsInternal (xmlParserCtxtPtr ctxt, int options, const char *encoding)
 
static xmlParserErrors xmlParseBalancedChunkMemoryInternal (xmlParserCtxtPtr oldctxt, const xmlChar *string, void *user_data, xmlNodePtr *lst)
 
static const xmlCharxmlParseQNameAndCompare (xmlParserCtxtPtr ctxt, xmlChar const *name, xmlChar const *prefix)
 
static const xmlCharxmlParseAttribute2 (xmlParserCtxtPtr ctxt, const xmlChar *pref, const xmlChar *elem, const xmlChar **prefix, xmlChar **value, int *len, int *alloc)
 
static const xmlCharxmlParseStartTag2 (xmlParserCtxtPtr ctxt, const xmlChar **pref, const xmlChar **URI, int *tlen)
 
static void xmlParseEndTag2 (xmlParserCtxtPtr ctxt, const xmlStartTag *tag)
 
void xmlParseCDSect (xmlParserCtxtPtr ctxt)
 
static void xmlParseContentInternal (xmlParserCtxtPtr ctxt)
 
void xmlParseContent (xmlParserCtxtPtr ctxt)
 
void xmlParseElement (xmlParserCtxtPtr ctxt)
 
xmlCharxmlParseVersionNum (xmlParserCtxtPtr ctxt)
 
xmlCharxmlParseVersionInfo (xmlParserCtxtPtr ctxt)
 
xmlCharxmlParseEncName (xmlParserCtxtPtr ctxt)
 
const xmlCharxmlParseEncodingDecl (xmlParserCtxtPtr ctxt)
 
int xmlParseSDDecl (xmlParserCtxtPtr ctxt)
 
void xmlParseXMLDecl (xmlParserCtxtPtr ctxt)
 
void xmlParseMisc (xmlParserCtxtPtr ctxt)
 
int xmlParseDocument (xmlParserCtxtPtr ctxt)
 
int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt)
 
void xmlStopParser (xmlParserCtxtPtr ctxt)
 
xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, void *user_data, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
 
int xmlParseCtxtExternalEntity (xmlParserCtxtPtr ctx, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst)
 
xmlParserErrors xmlParseInNodeContext (xmlNodePtr node, const char *data, int datalen, int options, xmlNodePtr *lst)
 
xmlParserCtxtPtr xmlCreateEntityParserCtxt (const xmlChar *URL, const xmlChar *ID, const xmlChar *base)
 
xmlParserCtxtPtr xmlCreateURLParserCtxt (const char *filename, int options)
 
xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename)
 
xmlParserCtxtPtr xmlCreateMemoryParserCtxt (const char *buffer, int size)
 
xmlParserCtxtPtr xmlCreateDocParserCtxt (const xmlChar *cur)
 
void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx, const char *msg,...)
 
void xmlInitParser (void)
 
void xmlCleanupParser (void)
 
void xmlCtxtReset (xmlParserCtxtPtr ctxt)
 
int xmlCtxtResetPush (xmlParserCtxtPtr ctxt, const char *chunk, int size, const char *filename, const char *encoding)
 
int xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, int options)
 
static xmlDocPtr xmlDoRead (xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
 
xmlDocPtr xmlReadDoc (const xmlChar *cur, const char *URL, const char *encoding, int options)
 
xmlDocPtr xmlReadFile (const char *filename, const char *encoding, int options)
 
xmlDocPtr xmlReadMemory (const char *buffer, int size, const char *URL, const char *encoding, int options)
 
xmlDocPtr xmlReadFd (int fd, const char *URL, const char *encoding, int options)
 
xmlDocPtr xmlReadIO (xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
 
xmlDocPtr xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, const xmlChar *cur, const char *URL, const char *encoding, int options)
 
xmlDocPtr xmlCtxtReadFile (xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options)
 
xmlDocPtr xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options)
 
xmlDocPtr xmlCtxtReadFd (xmlParserCtxtPtr ctxt, int fd, const char *URL, const char *encoding, int options)
 
xmlDocPtr xmlCtxtReadIO (xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
 

Macro Definition Documentation

◆ BASE_PTR

#define BASE_PTR   ctxt->input->base

Definition at line 2077 of file parser.c.

◆ bottom_parser

#define bottom_parser

Definition at line 15551 of file parser.c.

◆ CMP10

#define CMP10 (   s,
  c1,
  c2,
  c3,
  c4,
  c5,
  c6,
  c7,
  c8,
  c9,
  c10 
)
Value:
( CMP9( s, c1, c2, c3, c4, c5, c6, c7, c8, c9 ) && \
((unsigned char *) s)[ 9 ] == c10 )
#define CMP9(s, c1, c2, c3, c4, c5, c6, c7, c8, c9)
Definition: parser.c:2090
GLdouble s
Definition: gl.h:2039

Definition at line 2093 of file parser.c.

◆ CMP4

#define CMP4 (   s,
  c1,
  c2,
  c3,
  c4 
)
Value:
( ((unsigned char *) s)[ 0 ] == c1 && ((unsigned char *) s)[ 1 ] == c2 && \
((unsigned char *) s)[ 2 ] == c3 && ((unsigned char *) s)[ 3 ] == c4 )
GLdouble s
Definition: gl.h:2039

Definition at line 2079 of file parser.c.

◆ CMP5

#define CMP5 (   s,
  c1,
  c2,
  c3,
  c4,
  c5 
)    ( CMP4( s, c1, c2, c3, c4 ) && ((unsigned char *) s)[ 4 ] == c5 )

Definition at line 2082 of file parser.c.

◆ CMP6

#define CMP6 (   s,
  c1,
  c2,
  c3,
  c4,
  c5,
  c6 
)    ( CMP5( s, c1, c2, c3, c4, c5 ) && ((unsigned char *) s)[ 5 ] == c6 )

Definition at line 2084 of file parser.c.

◆ CMP7

#define CMP7 (   s,
  c1,
  c2,
  c3,
  c4,
  c5,
  c6,
  c7 
)    ( CMP6( s, c1, c2, c3, c4, c5, c6 ) && ((unsigned char *) s)[ 6 ] == c7 )

Definition at line 2086 of file parser.c.

◆ CMP8

#define CMP8 (   s,
  c1,
  c2,
  c3,
  c4,
  c5,
  c6,
  c7,
  c8 
)    ( CMP7( s, c1, c2, c3, c4, c5, c6, c7 ) && ((unsigned char *) s)[ 7 ] == c8 )

Definition at line 2088 of file parser.c.

◆ CMP9

#define CMP9 (   s,
  c1,
  c2,
  c3,
  c4,
  c5,
  c6,
  c7,
  c8,
  c9 
)
Value:
( CMP8( s, c1, c2, c3, c4, c5, c6, c7, c8 ) && \
((unsigned char *) s)[ 8 ] == c9 )
GLdouble s
Definition: gl.h:2039
#define CMP8(s, c1, c2, c3, c4, c5, c6, c7, c8)
Definition: parser.c:2088

Definition at line 2090 of file parser.c.

◆ COPY_BUF

#define COPY_BUF (   l,
  b,
  i,
  v 
)
Value:
if (l == 1) b[i++] = (xmlChar) v; \
else i += xmlCopyCharMultiByte(&b[i],v)
XMLPUBFUN int XMLCALL xmlCopyCharMultiByte(xmlChar *out, int val)
r l[0]
Definition: byte_order.h:167
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned char xmlChar
Definition: xmlstring.h:28
const GLdouble * v
Definition: gl.h:2040
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

Definition at line 2175 of file parser.c.

◆ CUR

#define CUR   (*ctxt->input->cur)

Definition at line 2074 of file parser.c.

◆ CUR_CHAR

#define CUR_CHAR (   l)    xmlCurrentChar(ctxt, &l)

Definition at line 2172 of file parser.c.

◆ CUR_PTR

#define CUR_PTR   ctxt->input->cur

Definition at line 2076 of file parser.c.

◆ CUR_SCHAR

#define CUR_SCHAR (   s,
  l 
)    xmlStringCurrentChar(ctxt, s, &l)

Definition at line 2173 of file parser.c.

◆ DICT_FREE

#define DICT_FREE (   str)
Value:
if ((str) && ((!dict) || \
(xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \
xmlFree((char *)(str));
const WCHAR * str
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1218

DICT_FREE: @str: a string

Free a string if it is not owned by the "dict" dictionary in the current scope

Definition at line 14783 of file parser.c.

◆ GROW

#define GROW
Value:
if ((ctxt->progressive == 0) && \
(ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \
xmlGROW (ctxt);
#define INPUT_CHUNK

Definition at line 2126 of file parser.c.

◆ GROW_PARSE_ATT_VALUE_INTERNAL

#define GROW_PARSE_ATT_VALUE_INTERNAL (   ctxt,
  in,
  start,
  end 
)
Value:
const xmlChar *oldbase = ctxt->input->base;\
GROW;\
if (ctxt->instate == XML_PARSER_EOF)\
return(NULL);\
if (oldbase != ctxt->input->base) {\
ptrdiff_t delta = ctxt->input->base - oldbase;\
start = start + delta;\
in = in + delta;\
}\
end = ctxt->input->end;
unsigned char xmlChar
Definition: xmlstring.h:28
GLuint in
Definition: glext.h:9616
GLuint start
Definition: gl.h:1545
#define NULL
Definition: types.h:112

xmlParseAttValueInternal: @ctxt: an XML parser context @len: attribute len result @alloc: whether the attribute was reallocated as a new string @normalize: if 1 then further non-CDATA normalization must be done

parse a value for an attribute. NOTE: if no normalization is needed, the routine will return pointers directly from the data buffer.

3.3.3 Attribute-Value Normalization: Before the value of an attribute is passed to the application or checked for validity, the XML processor must normalize it as follows:

  • a character reference is processed by appending the referenced character to the attribute value
  • an entity reference is processed by recursively processing the replacement text of the entity
  • a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, except that only a single #x20 is appended for a "#xD#xA" sequence that is part of an external parsed entity or the literal entity value of an internal parsed entity
  • other characters are processed by appending them to the normalized value If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by a single space (#x20) character. All attributes for which no declaration has been read should be treated by a non-validating parser as if declared CDATA.

Returns the AttValue parsed or NULL. The value has to be freed by the caller if it was copied, this can be detected by val[*len] == 0.

Definition at line 8938 of file parser.c.

◆ growBuffer

#define growBuffer (   buffer,
  n 
)
Value:
{ \
xmlChar *tmp; \
size_t new_size = buffer##_size * 2 + n; \
if (new_size < buffer##_size) goto mem_error; \
tmp = (xmlChar *) xmlRealloc(buffer, new_size); \
if (tmp == NULL) goto mem_error; \
buffer = tmp; \
buffer##_size = new_size; \
}
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
unsigned char xmlChar
Definition: xmlstring.h:28
#define NULL
Definition: types.h:112

Definition at line 2616 of file parser.c.

◆ IN_LIBXML

#define IN_LIBXML

Definition at line 38 of file parser.c.

◆ NEXT

#define NEXT   xmlNextChar(ctxt)

Definition at line 2156 of file parser.c.

◆ NEXT1

#define NEXT1
Value:
{ \
ctxt->input->col++; \
ctxt->input->cur++; \
if (*ctxt->input->cur == 0) \
xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
}
#define INPUT_CHUNK

Definition at line 2158 of file parser.c.

◆ NEXTL

#define NEXTL (   l)
Value:
do { \
if (*(ctxt->input->cur) == '\n') { \
ctxt->input->line++; ctxt->input->col = 1; \
} else ctxt->input->col++; \
ctxt->input->cur += l; \
} while (0)
r l[0]
Definition: byte_order.h:167

Definition at line 2165 of file parser.c.

◆ NXT

#define NXT (   val)    ctxt->input->cur[(val)]

Definition at line 2075 of file parser.c.

◆ RAW

#define RAW   (*ctxt->input->cur)

Definition at line 2073 of file parser.c.

◆ SAX2

#define SAX2   1

Definition at line 285 of file parser.c.

◆ SAX_COMPAT_MODE

#define SAX_COMPAT_MODE   BAD_CAST "SAX compatibility mode document"

Definition at line 288 of file parser.c.

◆ SHRINK

#define SHRINK
Value:
if ((ctxt->progressive == 0) && \
(ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
(ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
xmlSHRINK (ctxt);
#define INPUT_CHUNK

Definition at line 2115 of file parser.c.

◆ SKIP

#define SKIP (   val)
Value:
do { \
ctxt->input->cur += (val),ctxt->input->col+=(val); \
if (*ctxt->input->cur == 0) \
xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
} while (0)
GLuint GLfloat * val
Definition: glext.h:7180
#define INPUT_CHUNK

Definition at line 2097 of file parser.c.

◆ SKIP_BLANKS

#define SKIP_BLANKS   xmlSkipBlankChars(ctxt)

Definition at line 2154 of file parser.c.

◆ SKIPL

#define SKIPL (   val)
Value:
do { \
int skipl; \
for(skipl=0; skipl<val; skipl++) { \
if (*(ctxt->input->cur) == '\n') { \
ctxt->input->line++; ctxt->input->col = 1; \
} else ctxt->input->col++; \
ctxt->input->cur++; \
} \
if (*ctxt->input->cur == 0) \
xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
} while (0)
GLuint GLfloat * val
Definition: glext.h:7180
#define INPUT_CHUNK

Definition at line 2103 of file parser.c.

◆ XML_DIR_SEP

#define XML_DIR_SEP   '/'

Definition at line 44 of file parser.c.

◆ XML_PARSER_BIG_BUFFER_SIZE

#define XML_PARSER_BIG_BUFFER_SIZE   300

Definition at line 286 of file parser.c.

◆ XML_PARSER_BIG_ENTITY

#define XML_PARSER_BIG_ENTITY   1000

Definition at line 118 of file parser.c.

◆ XML_PARSER_BUFFER_SIZE

#define XML_PARSER_BUFFER_SIZE   100

Definition at line 287 of file parser.c.

◆ XML_PARSER_CHUNK_SIZE

#define XML_PARSER_CHUNK_SIZE   100

XML_PARSER_CHUNK_SIZE

When calling GROW that's the minimal amount of data the parser expected to have received. It is not a hard limit but an optimization when reading strings like Names It is not strictly needed as long as inputs available characters are followed by 0, which should be provided by the I/O level

Definition at line 299 of file parser.c.

◆ XML_PARSER_LOT_ENTITY

#define XML_PARSER_LOT_ENTITY   5000

Definition at line 119 of file parser.c.

◆ XML_PARSER_NON_LINEAR

#define XML_PARSER_NON_LINEAR   10

Definition at line 127 of file parser.c.

Typedef Documentation

◆ xmlDefAttrs

Definition at line 1128 of file parser.c.

◆ xmlDefAttrsPtr

Definition at line 1129 of file parser.c.

Function Documentation

◆ areBlanks()

static int areBlanks ( xmlParserCtxtPtr  ctxt,
const xmlChar str,
int  len,
int  blank_chars 
)
static

areBlanks: @ctxt: an XML parser context @str: a xmlChar * @len: the size of @str @blank_chars: we know the chars are blanks

Is this a sequence of blank chars that one can ignore ?

Returns 1 if ignorable 0 otherwise.

Definition at line 2867 of file parser.c.

2868  {
2869  int i, ret;
2870  xmlNodePtr lastChild;
2871 
2872  /*
2873  * Don't spend time trying to differentiate them, the same callback is
2874  * used !
2875  */
2876  if (ctxt->sax->ignorableWhitespace == ctxt->sax->characters)
2877  return(0);
2878 
2879  /*
2880  * Check for xml:space value.
2881  */
2882  if ((ctxt->space == NULL) || (*(ctxt->space) == 1) ||
2883  (*(ctxt->space) == -2))
2884  return(0);
2885 
2886  /*
2887  * Check that the string is made of blanks
2888  */
2889  if (blank_chars == 0) {
2890  for (i = 0;i < len;i++)
2891  if (!(IS_BLANK_CH(str[i]))) return(0);
2892  }
2893 
2894  /*
2895  * Look if the element is mixed content in the DTD if available
2896  */
2897  if (ctxt->node == NULL) return(0);
2898  if (ctxt->myDoc != NULL) {
2899  ret = xmlIsMixedElement(ctxt->myDoc, ctxt->node->name);
2900  if (ret == 0) return(1);
2901  if (ret == 1) return(0);
2902  }
2903 
2904  /*
2905  * Otherwise, heuristic :-\
2906  */
2907  if ((RAW != '<') && (RAW != 0xD)) return(0);
2908  if ((ctxt->node->children == NULL) &&
2909  (RAW == '<') && (NXT(1) == '/')) return(0);
2910 
2911  lastChild = xmlGetLastChild(ctxt->node);
2912  if (lastChild == NULL) {
2913  if ((ctxt->node->type != XML_ELEMENT_NODE) &&
2914  (ctxt->node->content != NULL)) return(0);
2915  } else if (xmlNodeIsText(lastChild))
2916  return(0);
2917  else if ((ctxt->node->children != NULL) &&
2918  (xmlNodeIsText(ctxt->node->children)))
2919  return(0);
2920  return(1);
2921 }
const xmlChar * name
Definition: tree.h:492
#define NXT(val)
Definition: parser.c:2075
#define IS_BLANK_CH(c)
const WCHAR * str
XMLPUBFUN xmlNodePtr XMLCALL xmlGetLastChild(const xmlNode *parent)
xmlNodePtr node
Definition: parser.h:207
XMLPUBFUN int XMLCALL xmlNodeIsText(const xmlNode *node)
xmlChar * content
Definition: tree.h:502
Definition: tree.h:489
int ret
xmlDocPtr myDoc
Definition: parser.h:189
GLenum GLsizei len
Definition: glext.h:6722
struct _xmlSAXHandler * sax
Definition: parser.h:187
xmlElementType type
Definition: tree.h:491
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
XMLPUBFUN int XMLCALL xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name)
Definition: valid.c:3456
#define NULL
Definition: types.h:112
struct _xmlNode * children
Definition: tree.h:493
#define RAW
Definition: parser.c:2073
int * space
Definition: parser.h:246

Referenced by xmlParseCharData(), and xmlParseCharDataComplex().

◆ inputPop()

xmlParserInputPtr inputPop ( xmlParserCtxtPtr  ctxt)

inputPop: @ctxt: an XML parser context

Pops the top parser input from the input stack

Returns the input just removed

Definition at line 1783 of file parser.c.

1784 {
1786 
1787  if (ctxt == NULL)
1788  return(NULL);
1789  if (ctxt->inputNr <= 0)
1790  return (NULL);
1791  ctxt->inputNr--;
1792  if (ctxt->inputNr > 0)
1793  ctxt->input = ctxt->inputTab[ctxt->inputNr - 1];
1794  else
1795  ctxt->input = NULL;
1796  ret = ctxt->inputTab[ctxt->inputNr];
1797  ctxt->inputTab[ctxt->inputNr] = NULL;
1798  return (ret);
1799 }
xmlParserInputPtr * inputTab
Definition: parser.h:204
xmlParserInputPtr input
Definition: parser.h:201
int ret
#define NULL
Definition: types.h:112

Referenced by xmlCtxtReset(), xmlFreeParserCtxt(), xmlHaltParser(), xmlInitParserCtxt(), xmlPopInput(), and xmlPushInput().

◆ inputPush()

int inputPush ( xmlParserCtxtPtr  ctxt,
xmlParserInputPtr  value 
)

inputPush: @ctxt: an XML parser context @value: the parser input

Pushes a new parser input on top of the input stack

Returns -1 in case of error, the index in the stack otherwise

Definition at line 1752 of file parser.c.

1753 {
1754  if ((ctxt == NULL) || (value == NULL))
1755  return(-1);
1756  if (ctxt->inputNr >= ctxt->inputMax) {
1757  ctxt->inputMax *= 2;
1758  ctxt->inputTab =
1760  ctxt->inputMax *
1761  sizeof(ctxt->inputTab[0]));
1762  if (ctxt->inputTab == NULL) {
1763  xmlErrMemory(ctxt, NULL);
1765  ctxt->inputMax /= 2;
1766  value = NULL;
1767  return (-1);
1768  }
1769  }
1770  ctxt->inputTab[ctxt->inputNr] = value;
1771  ctxt->input = value;
1772  return (ctxt->inputNr++);
1773 }
Definition: pdh_main.c:93
xmlParserInputPtr * inputTab
Definition: parser.h:204
xmlParserInputPtr input
Definition: parser.h:201
XMLPUBFUN void XMLCALL xmlFreeInputStream(xmlParserInputPtr input)
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
int inputMax
Definition: parser.h:203
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
GLsizei const GLfloat * value
Definition: glext.h:6069
#define NULL
Definition: types.h:112

Referenced by testSAX(), xmlCreateEntityParserCtxtInternal(), xmlCreateIOParserCtxt(), xmlCreateMemoryParserCtxt(), xmlCreateURLParserCtxt(), xmlCtxtReadDoc(), xmlCtxtReadFd(), xmlCtxtReadFile(), xmlCtxtReadIO(), xmlCtxtReadMemory(), xmlCtxtResetPush(), xmlPushInput(), xmlReadFd(), xmlReadIO(), and xsltDocDefaultLoaderFunc().

◆ LIBXML_ATTR_FORMAT()

static void LIBXML_ATTR_FORMAT ( ,
 
)
static

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

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

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

Definition at line 604 of file parser.c.

607 {
608  if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
609  (ctxt->instate == XML_PARSER_EOF))
610  return;
611  if (ctxt != NULL)
612  ctxt->errNo = error;
613  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
614  XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg);
615  if (ctxt != NULL) {
616  ctxt->wellFormed = 0;
617  if (ctxt->recovery == 0)
618  ctxt->disableSAX = 1;
619  }
620 }
DWORD error
Definition: parser.c:105
#define NULL
Definition: types.h:112
#define msg(x)
Definition: auth_time.c:54

◆ nameNsPush()

static int nameNsPush ( xmlParserCtxtPtr  ctxt,
const xmlChar value,
const xmlChar prefix,
const xmlChar URI,
int  line,
int  nsNr 
)
static

nameNsPush: @ctxt: an XML parser context @value: the element name @prefix: the element prefix @URI: the element namespace name the current line number for error messages @nsNr: the number of namespaces pushed on the namespace table

Pushes a new element name/prefix/URL on top of the name stack

Returns -1 in case of error, the index in the stack otherwise

Definition at line 1879 of file parser.c.

1881 {
1882  xmlStartTag *tag;
1883 
1884  if (ctxt->nameNr >= ctxt->nameMax) {
1885  const xmlChar * *tmp;
1886  xmlStartTag *tmp2;
1887  ctxt->nameMax *= 2;
1888  tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab,
1889  ctxt->nameMax *
1890  sizeof(ctxt->nameTab[0]));
1891  if (tmp == NULL) {
1892  ctxt->nameMax /= 2;
1893  goto mem_error;
1894  }
1895  ctxt->nameTab = tmp;
1896  tmp2 = (xmlStartTag *) xmlRealloc((void * *)ctxt->pushTab,
1897  ctxt->nameMax *
1898  sizeof(ctxt->pushTab[0]));
1899  if (tmp2 == NULL) {
1900  ctxt->nameMax /= 2;
1901  goto mem_error;
1902  }
1903  ctxt->pushTab = tmp2;
1904  } else if (ctxt->pushTab == NULL) {
1905  ctxt->pushTab = (xmlStartTag *) xmlMalloc(ctxt->nameMax *
1906  sizeof(ctxt->pushTab[0]));
1907  if (ctxt->pushTab == NULL)
1908  goto mem_error;
1909  }
1910  ctxt->nameTab[ctxt->nameNr] = value;
1911  ctxt->name = value;
1912  tag = &ctxt->pushTab[ctxt->nameNr];
1913  tag->prefix = prefix;
1914  tag->URI = URI;
1915  tag->line = line;
1916  tag->nsNr = nsNr;
1917  return (ctxt->nameNr++);
1918 mem_error:
1919  xmlErrMemory(ctxt, NULL);
1920  return (-1);
1921 }
Definition: ecma_167.h:138
const xmlChar * name
Definition: parser.h:231
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
xmlStartTag * pushTab
Definition: parser.h:285
unsigned char xmlChar
Definition: xmlstring.h:28
GLsizei const GLfloat * value
Definition: glext.h:6069
IN PCTCH line
Definition: pager.h:36
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
const xmlChar ** nameTab
Definition: parser.h:234
char * tag
Definition: main.c:59

Referenced by xmlParseElementStart().

◆ namePop()

const xmlChar* namePop ( xmlParserCtxtPtr  ctxt)

namePop: @ctxt: an XML parser context

Pops the top element name from the name stack

Returns the name just removed

Definition at line 1990 of file parser.c.

1991 {
1992  const xmlChar *ret;
1993 
1994  if ((ctxt == NULL) || (ctxt->nameNr <= 0))
1995  return (NULL);
1996  ctxt->nameNr--;
1997  if (ctxt->nameNr > 0)
1998  ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
1999  else
2000  ctxt->name = NULL;
2001  ret = ctxt->nameTab[ctxt->nameNr];
2002  ctxt->nameTab[ctxt->nameNr] = NULL;
2003  return (ret);
2004 }
const xmlChar * name
Definition: parser.h:231
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
#define NULL
Definition: types.h:112
const xmlChar ** nameTab
Definition: parser.h:234

Referenced by xmlParseElementEnd(), and xmlParseElementStart().

◆ namePush()

int namePush ( xmlParserCtxtPtr  ctxt,
const xmlChar value 
)

namePush: @ctxt: an XML parser context @value: the element name

Pushes a new element name on top of the name stack

Returns -1 in case of error, the index in the stack otherwise

Definition at line 1959 of file parser.c.

1960 {
1961  if (ctxt == NULL) return (-1);
1962 
1963  if (ctxt->nameNr >= ctxt->nameMax) {
1964  const xmlChar * *tmp;
1965  tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab,
1966  ctxt->nameMax * 2 *
1967  sizeof(ctxt->nameTab[0]));
1968  if (tmp == NULL) {
1969  goto mem_error;
1970  }
1971  ctxt->nameTab = tmp;
1972  ctxt->nameMax *= 2;
1973  }
1974  ctxt->nameTab[ctxt->nameNr] = value;
1975  ctxt->name = value;
1976  return (ctxt->nameNr++);
1977 mem_error:
1978  xmlErrMemory(ctxt, NULL);
1979  return (-1);
1980 }
const xmlChar * name
Definition: parser.h:231
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
unsigned char xmlChar
Definition: xmlstring.h:28
GLsizei const GLfloat * value
Definition: glext.h:6069
#define NULL
Definition: types.h:112
const xmlChar ** nameTab
Definition: parser.h:234

◆ nodePop()

xmlNodePtr nodePop ( xmlParserCtxtPtr  ctxt)

nodePop: @ctxt: an XML parser context

Pops the top element node from the node stack

Returns the node just removed

Definition at line 1848 of file parser.c.

1849 {
1850  xmlNodePtr ret;
1851 
1852  if (ctxt == NULL) return(NULL);
1853  if (ctxt->nodeNr <= 0)
1854  return (NULL);
1855  ctxt->nodeNr--;
1856  if (ctxt->nodeNr > 0)
1857  ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1];
1858  else
1859  ctxt->node = NULL;
1860  ret = ctxt->nodeTab[ctxt->nodeNr];
1861  ctxt->nodeTab[ctxt->nodeNr] = NULL;
1862  return (ret);
1863 }
xmlNodePtr * nodeTab
Definition: parser.h:210
xmlNodePtr node
Definition: parser.h:207
Definition: tree.h:489
int ret
#define NULL
Definition: types.h:112

Referenced by xmlParseElementStart(), and xmlSAX2EndElementNs().

◆ nodePush()

int nodePush ( xmlParserCtxtPtr  ctxt,
xmlNodePtr  value 
)

nodePush: @ctxt: an XML parser context @value: the element node

Pushes a new element node on top of the node stack

Returns -1 in case of error, the index in the stack otherwise

Definition at line 1810 of file parser.c.

1811 {
1812  if (ctxt == NULL) return(0);
1813  if (ctxt->nodeNr >= ctxt->nodeMax) {
1814  xmlNodePtr *tmp;
1815 
1816  tmp = (xmlNodePtr *) xmlRealloc(ctxt->nodeTab,
1817  ctxt->nodeMax * 2 *
1818  sizeof(ctxt->nodeTab[0]));
1819  if (tmp == NULL) {
1820  xmlErrMemory(ctxt, NULL);
1821  return (-1);
1822  }
1823  ctxt->nodeTab = tmp;
1824  ctxt->nodeMax *= 2;
1825  }
1826  if ((((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) &&
1827  ((ctxt->options & XML_PARSE_HUGE) == 0)) {
1828  xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR,
1829  "Excessive depth in document: %d use XML_PARSE_HUGE option\n",
1831  xmlHaltParser(ctxt);
1832  return(-1);
1833  }
1834  ctxt->nodeTab[ctxt->nodeNr] = value;
1835  ctxt->node = value;
1836  return (ctxt->nodeNr++);
1837 }
xmlNodePtr * nodeTab
Definition: parser.h:210
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
xmlNodePtr node
Definition: parser.h:207
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
unsigned int xmlParserMaxDepth
Definition: parser.c:281
Definition: tree.h:489
GLsizei const GLfloat * value
Definition: glext.h:6069
#define NULL
Definition: types.h:112
static void xmlHaltParser(xmlParserCtxtPtr ctxt)
Definition: parser.c:12544

Referenced by xmlParseBalancedChunkMemoryInternal(), xmlParseExternalEntityPrivate(), xmlParseInNodeContext(), and xmlSAX2StartElementNs().

◆ nsPop()

static int nsPop ( xmlParserCtxtPtr  ctxt,
int  nr 
)
static

nsPop: @ctxt: an XML parser context @nr: the number to pop

Pops the top @nr parser prefix/namespace from the ns stack

Returns the number of namespaces removed

Definition at line 1688 of file parser.c.

1689 {
1690  int i;
1691 
1692  if (ctxt->nsTab == NULL) return(0);
1693  if (ctxt->nsNr < nr) {
1694  xmlGenericError(xmlGenericErrorContext, "Pbm popping %d NS\n", nr);
1695  nr = ctxt->nsNr;
1696  }
1697  if (ctxt->nsNr <= 0)
1698  return (0);
1699 
1700  for (i = 0;i < nr;i++) {
1701  ctxt->nsNr--;
1702  ctxt->nsTab[ctxt->nsNr] = NULL;
1703  }
1704  return(nr);
1705 }
ULONG nr
Definition: thread.c:7
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
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
const xmlChar ** nsTab
Definition: parser.h:283
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlParseElementStart(), xmlParseEndTag2(), and xmlParseInNodeContext().

◆ nsPush()

static int nsPush ( xmlParserCtxtPtr  ctxt,
const xmlChar prefix,
const xmlChar URL 
)
static

nsPush: @ctxt: an XML parser context @prefix: the namespace prefix or NULL @URL: the namespace name

Pushes a new parser namespace on top of the ns stack

Returns -1 in case of error, -2 if the namespace should be discarded and the index in the stack otherwise.

Definition at line 1638 of file parser.c.

1639 {
1640  if (ctxt->options & XML_PARSE_NSCLEAN) {
1641  int i;
1642  for (i = ctxt->nsNr - 2;i >= 0;i -= 2) {
1643  if (ctxt->nsTab[i] == prefix) {
1644  /* in scope */
1645  if (ctxt->nsTab[i + 1] == URL)
1646  return(-2);
1647  /* out of scope keep it */
1648  break;
1649  }
1650  }
1651  }
1652  if ((ctxt->nsMax == 0) || (ctxt->nsTab == NULL)) {
1653  ctxt->nsMax = 10;
1654  ctxt->nsNr = 0;
1655  ctxt->nsTab = (const xmlChar **)
1656  xmlMalloc(ctxt->nsMax * sizeof(xmlChar *));
1657  if (ctxt->nsTab == NULL) {
1658  xmlErrMemory(ctxt, NULL);
1659  ctxt->nsMax = 0;
1660  return (-1);
1661  }
1662  } else if (ctxt->nsNr >= ctxt->nsMax) {
1663  const xmlChar ** tmp;
1664  ctxt->nsMax *= 2;
1665  tmp = (const xmlChar **) xmlRealloc((char *) ctxt->nsTab,
1666  ctxt->nsMax * sizeof(ctxt->nsTab[0]));
1667  if (tmp == NULL) {
1668  xmlErrMemory(ctxt, NULL);
1669  ctxt->nsMax /= 2;
1670  return (-1);
1671  }
1672  ctxt->nsTab = tmp;
1673  }
1674  ctxt->nsTab[ctxt->nsNr++] = prefix;
1675  ctxt->nsTab[ctxt->nsNr++] = URL;
1676  return (ctxt->nsNr);
1677 }
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
unsigned char xmlChar
Definition: xmlstring.h:28
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
const xmlChar ** nsTab
Definition: parser.h:283

Referenced by xmlParseBalancedChunkMemoryInternal(), xmlParseInNodeContext(), and xmlParseStartTag2().

◆ spacePop()

static int spacePop ( xmlParserCtxtPtr  ctxt)
static

Definition at line 2025 of file parser.c.

2025  {
2026  int ret;
2027  if (ctxt->spaceNr <= 0) return(0);
2028  ctxt->spaceNr--;
2029  if (ctxt->spaceNr > 0)
2030  ctxt->space = &ctxt->spaceTab[ctxt->spaceNr - 1];
2031  else
2032  ctxt->space = &ctxt->spaceTab[0];
2033  ret = ctxt->spaceTab[ctxt->spaceNr];
2034  ctxt->spaceTab[ctxt->spaceNr] = -1;
2035  return(ret);
2036 }
int * spaceTab
Definition: parser.h:249
int ret
int * space
Definition: parser.h:246

Referenced by xmlParseElementStart(), and xmlParseEndTag2().

◆ spacePush()

static int spacePush ( xmlParserCtxtPtr  ctxt,
int  val 
)
static

Definition at line 2006 of file parser.c.

2006  {
2007  if (ctxt->spaceNr >= ctxt->spaceMax) {
2008  int *tmp;
2009 
2010  ctxt->spaceMax *= 2;
2011  tmp = (int *) xmlRealloc(ctxt->spaceTab,
2012  ctxt->spaceMax * sizeof(ctxt->spaceTab[0]));
2013  if (tmp == NULL) {
2014  xmlErrMemory(ctxt, NULL);
2015  ctxt->spaceMax /=2;
2016  return(-1);
2017  }
2018  ctxt->spaceTab = tmp;
2019  }
2020  ctxt->spaceTab[ctxt->spaceNr] = val;
2021  ctxt->space = &ctxt->spaceTab[ctxt->spaceNr];
2022  return(ctxt->spaceNr++);
2023 }
int * spaceTab
Definition: parser.h:249
int spaceMax
Definition: parser.h:248
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
GLuint GLfloat * val
Definition: glext.h:7180
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
#define NULL
Definition: types.h:112
int * space
Definition: parser.h:246

Referenced by xmlParseElementStart().

◆ xmlAddDefAttrs()

static void xmlAddDefAttrs ( xmlParserCtxtPtr  ctxt,
const xmlChar fullname,
const xmlChar fullattr,
const xmlChar value 
)
static

xmlAddDefAttrs: @ctxt: an XML parser context @fullname: the element fullname @fullattr: the attribute fullname @value: the attribute value

Add a defaulted attribute for an element

Definition at line 1249 of file parser.c.

1252  {
1254  int len;
1255  const xmlChar *name;
1256  const xmlChar *prefix;
1257 
1258  /*
1259  * Allows to detect attribute redefinitions
1260  */
1261  if (ctxt->attsSpecial != NULL) {
1262  if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL)
1263  return;
1264  }
1265 
1266  if (ctxt->attsDefault == NULL) {
1267  ctxt->attsDefault = xmlHashCreateDict(10, ctxt->dict);
1268  if (ctxt->attsDefault == NULL)
1269  goto mem_error;
1270  }
1271 
1272  /*
1273  * split the element name into prefix:localname , the string found
1274  * are within the DTD and then not associated to namespace names.
1275  */
1277  if (name == NULL) {
1278  name = xmlDictLookup(ctxt->dict, fullname, -1);
1279  prefix = NULL;
1280  } else {
1281  name = xmlDictLookup(ctxt->dict, name, -1);
1282  prefix = xmlDictLookup(ctxt->dict, fullname, len);
1283  }
1284 
1285  /*
1286  * make sure there is some storage
1287  */
1288  defaults = xmlHashLookup2(ctxt->attsDefault, name, prefix);
1289  if (defaults == NULL) {
1291  (4 * 5) * sizeof(const xmlChar *));
1292  if (defaults == NULL)
1293  goto mem_error;
1294  defaults->nbAttrs = 0;
1295  defaults->maxAttrs = 4;
1296  if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix,
1297  defaults, NULL) < 0) {
1298  xmlFree(defaults);
1299  goto mem_error;
1300  }
1301  } else if (defaults->nbAttrs >= defaults->maxAttrs) {
1303 
1305  (2 * defaults->maxAttrs * 5) * sizeof(const xmlChar *));
1306  if (temp == NULL)
1307  goto mem_error;
1308  defaults = temp;
1309  defaults->maxAttrs *= 2;
1310  if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix,
1311  defaults, NULL) < 0) {
1312  xmlFree(defaults);
1313  goto mem_error;
1314  }
1315  }
1316 
1317  /*
1318  * Split the element name into prefix:localname , the string found
1319  * are within the DTD and hen not associated to namespace names.
1320  */
1321  name = xmlSplitQName3(fullattr, &len);
1322  if (name == NULL) {
1323  name = xmlDictLookup(ctxt->dict, fullattr, -1);
1324  prefix = NULL;
1325  } else {
1326  name = xmlDictLookup(ctxt->dict, name, -1);
1327  prefix = xmlDictLookup(ctxt->dict, fullattr, len);
1328  }
1329 
1330  defaults->values[5 * defaults->nbAttrs] = name;
1331  defaults->values[5 * defaults->nbAttrs + 1] = prefix;
1332  /* intern the string and precompute the end */
1333  len = xmlStrlen(value);
1334  value = xmlDictLookup(ctxt->dict, value, len);
1335  defaults->values[5 * defaults->nbAttrs + 2] = value;
1336  defaults->values[5 * defaults->nbAttrs + 3] = value + len;
1337  if (ctxt->external)
1338  defaults->values[5 * defaults->nbAttrs + 4] = BAD_CAST "external";
1339  else
1340  defaults->values[5 * defaults->nbAttrs + 4] = NULL;
1341  defaults->nbAttrs++;
1342 
1343  return;
1344 
1345 mem_error:
1346  xmlErrMemory(ctxt, NULL);
1347  return;
1348 }
Definition: pdh_main.c:93
XMLPUBFUN const xmlChar *XMLCALL xmlSplitQName3(const xmlChar *name, int *len)
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:425
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:481
int external
Definition: parser.h:219
static const ASMPROP_RES defaults[ASM_NAME_MAX_PARAMS]
Definition: asmname.c:82
xmlHashTablePtr attsDefault
Definition: parser.h:286
#define BAD_CAST
Definition: xmlstring.h:35
xmlDictPtr dict
Definition: parser.h:265
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:865
const char * fullname
Definition: shader.c:1766
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
GLsizei const GLfloat * value
Definition: glext.h:6069
XMLPUBFUN int XMLCALL xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f)
Definition: hash.c:450
static calc_node_t temp
Definition: rpn_ieee.c:38
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:215
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
xmlHashTablePtr attsSpecial
Definition: parser.h:287
Definition: name.c:38
xmlDefAttrs * xmlDefAttrsPtr
Definition: parser.c:1129
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by xmlParseAttributeListDecl().

◆ xmlAddSpecialAttr()

static void xmlAddSpecialAttr ( xmlParserCtxtPtr  ctxt,
const xmlChar fullname,
const xmlChar fullattr,
int  type 
)
static

xmlAddSpecialAttr: @ctxt: an XML parser context @fullname: the element fullname @fullattr: the attribute fullname @type: the attribute type

Register this attribute type

Definition at line 1360 of file parser.c.

1364 {
1365  if (ctxt->attsSpecial == NULL) {
1366  ctxt->attsSpecial = xmlHashCreateDict(10, ctxt->dict);
1367  if (ctxt->attsSpecial == NULL)
1368  goto mem_error;
1369  }
1370 
1371  if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL)
1372  return;
1373 
1374  xmlHashAddEntry2(ctxt->attsSpecial, fullname, fullattr,
1375  (void *) (ptrdiff_t) type);
1376  return;
1377 
1378 mem_error:
1379  xmlErrMemory(ctxt, NULL);
1380  return;
1381 }
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:411
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:481
xmlDictPtr dict
Definition: parser.h:265
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
const char * fullname
Definition: shader.c:1766
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:215
#define NULL
Definition: types.h:112
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
xmlHashTablePtr attsSpecial
Definition: parser.h:287
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by xmlParseAttributeListDecl().

◆ xmlAttrNormalizeSpace()

static xmlChar* xmlAttrNormalizeSpace ( const xmlChar src,
xmlChar dst 
)
static

xmlAttrNormalizeSpace: @src: the source string @dst: the target string

Normalize the space in non CDATA attribute values: If the attribute type is not CDATA, then the XML processor MUST further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by a single space (#x20) character. Note that the size of dst need to be at least src, and if one doesn't need to preserve dst (and it doesn't come from a dictionary or read-only) then passing src as dst is just fine.

Returns a pointer to the normalized value (dst) or NULL if no conversion is needed.

Definition at line 1159 of file parser.c.

1160 {
1161  if ((src == NULL) || (dst == NULL))
1162  return(NULL);
1163 
1164  while (*src == 0x20) src++;
1165  while (*src != 0) {
1166  if (*src == 0x20) {
1167  while (*src == 0x20) src++;
1168  if (*src != 0)
1169  *dst++ = 0x20;
1170  } else {
1171  *dst++ = *src++;
1172  }
1173  }
1174  *dst = 0;
1175  if (dst == src)
1176  return(NULL);
1177  return(dst);
1178 }
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define NULL
Definition: types.h:112

Referenced by xmlAttrNormalizeSpace2(), and xmlParseAttributeListDecl().

◆ xmlAttrNormalizeSpace2()

static const xmlChar* xmlAttrNormalizeSpace2 ( xmlParserCtxtPtr  ctxt,
xmlChar src,
int len 
)
static

xmlAttrNormalizeSpace2: @src: the source string

Normalize the space in non CDATA attribute values, a slightly more complex front end to avoid allocation problems when running on attribute values coming from the input.

Returns a pointer to the normalized value (dst) or NULL if no conversion is needed.

Definition at line 1192 of file parser.c.

1193 {
1194  int i;
1195  int remove_head = 0;
1196  int need_realloc = 0;
1197  const xmlChar *cur;
1198 
1199  if ((ctxt == NULL) || (src == NULL) || (len == NULL))
1200  return(NULL);
1201  i = *len;
1202  if (i <= 0)
1203  return(NULL);
1204 
1205  cur = src;
1206  while (*cur == 0x20) {
1207  cur++;
1208  remove_head++;
1209  }
1210  while (*cur != 0) {
1211  if (*cur == 0x20) {
1212  cur++;
1213  if ((*cur == 0x20) || (*cur == 0)) {
1214  need_realloc = 1;
1215  break;
1216  }
1217  } else
1218  cur++;
1219  }
1220  if (need_realloc) {
1221  xmlChar *ret;
1222 
1223  ret = xmlStrndup(src + remove_head, i - remove_head + 1);
1224  if (ret == NULL) {
1225  xmlErrMemory(ctxt, NULL);
1226  return(NULL);
1227  }
1229  *len = (int) strlen((const char *)ret);
1230  return(ret);
1231  } else if (remove_head) {
1232  *len -= remove_head;
1233  memmove(src, src + remove_head, 1 + *len);
1234  return(src);
1235  }
1236  return(NULL);
1237 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
static xmlChar * xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst)
Definition: parser.c:1159
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
FxCollectionEntry * cur
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
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by xmlParseAttribute2().

◆ xmlCheckLanguageID()

int xmlCheckLanguageID ( const xmlChar lang)

xmlCheckLanguageID: @lang: pointer to the string value

Checks that the value conforms to the LanguageID production:

NOTE: this is somewhat deprecated, those productions were removed from the XML Second edition.

[33] LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::= ISO639Code | IanaCode | UserCode [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+

The current REC reference the successors of RFC 1766, currently 5646

http://www.rfc-editor.org/rfc/rfc5646.txt langtag = language ["-" script] ["-" region] *("-" variant) *("-" extension) ["-" privateuse] language = 2*3ALPHA ; shortest ISO 639 code ["-" extlang] ; sometimes followed by ; extended language subtags / 4ALPHA ; or reserved for future use / 5*8ALPHA ; or registered language subtag

extlang = 3ALPHA ; selected ISO 639 codes *2("-" 3ALPHA) ; permanently reserved

script = 4ALPHA ; ISO 15924 code

region = 2ALPHA ; ISO 3166-1 code / 3DIGIT ; UN M.49 code

variant = 5*8alphanum ; registered variants / (DIGIT 3alphanum)

extension = singleton 1*("-" (2*8alphanum))

                                ; Single alphanumerics
                                ; "x" reserved for private use

singleton = DIGIT ; 0 - 9 / x41-57 ; A - W / x59-5A ; Y - Z / x61-77 ; a - w / x79-7A ; y - z

it sounds right to still allow Irregular i-xxx IANA and user codes too The parser below doesn't try to cope with extension or privateuse that could be added but that's not interoperable anyway

Returns 1 if correct 0 otherwise

Definition at line 1481 of file parser.c.

1482 {
1483  const xmlChar *cur = lang, *nxt;
1484 
1485  if (cur == NULL)
1486  return (0);
1487  if (((cur[0] == 'i') && (cur[1] == '-')) ||
1488  ((cur[0] == 'I') && (cur[1] == '-')) ||
1489  ((cur[0] == 'x') && (cur[1] == '-')) ||
1490  ((cur[0] == 'X') && (cur[1] == '-'))) {
1491  /*
1492  * Still allow IANA code and user code which were coming
1493  * from the previous version of the XML-1.0 specification
1494  * it's deprecated but we should not fail
1495  */
1496  cur += 2;
1497  while (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
1498  ((cur[0] >= 'a') && (cur[0] <= 'z')))
1499  cur++;
1500  return(cur[0] == 0);
1501  }
1502  nxt = cur;
1503  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1504  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1505  nxt++;
1506  if (nxt - cur >= 4) {
1507  /*
1508  * Reserved
1509  */
1510  if ((nxt - cur > 8) || (nxt[0] != 0))
1511  return(0);
1512  return(1);
1513  }
1514  if (nxt - cur < 2)
1515  return(0);
1516  /* we got an ISO 639 code */
1517  if (nxt[0] == 0)
1518  return(1);
1519  if (nxt[0] != '-')
1520  return(0);
1521 
1522  nxt++;
1523  cur = nxt;
1524  /* now we can have extlang or script or region or variant */
1525  if ((nxt[0] >= '0') && (nxt[0] <= '9'))
1526  goto region_m49;
1527 
1528  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1529  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1530  nxt++;
1531  if (nxt - cur == 4)
1532  goto script;
1533  if (nxt - cur == 2)
1534  goto region;
1535  if ((nxt - cur >= 5) && (nxt - cur <= 8))
1536  goto variant;
1537  if (nxt - cur != 3)
1538  return(0);
1539  /* we parsed an extlang */
1540  if (nxt[0] == 0)
1541  return(1);
1542  if (nxt[0] != '-')
1543  return(0);
1544 
1545  nxt++;
1546  cur = nxt;
1547  /* now we can have script or region or variant */
1548  if ((nxt[0] >= '0') && (nxt[0] <= '9'))
1549  goto region_m49;
1550 
1551  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1552  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1553  nxt++;
1554  if (nxt - cur == 2)
1555  goto region;
1556  if ((nxt - cur >= 5) && (nxt - cur <= 8))
1557  goto variant;
1558  if (nxt - cur != 4)
1559  return(0);
1560  /* we parsed a script */
1561 script:
1562  if (nxt[0] == 0)
1563  return(1);
1564  if (nxt[0] != '-')
1565  return(0);
1566 
1567  nxt++;
1568  cur = nxt;
1569  /* now we can have region or variant */
1570  if ((nxt[0] >= '0') && (nxt[0] <= '9'))
1571  goto region_m49;
1572 
1573  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1574  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1575  nxt++;
1576 
1577  if ((nxt - cur >= 5) && (nxt - cur <= 8))
1578  goto variant;
1579  if (nxt - cur != 2)
1580  return(0);
1581  /* we parsed a region */
1582 region:
1583  if (nxt[0] == 0)
1584  return(1);
1585  if (nxt[0] != '-')
1586  return(0);
1587 
1588  nxt++;
1589  cur = nxt;
1590  /* now we can just have a variant */
1591  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1592  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1593  nxt++;
1594 
1595  if ((nxt - cur < 5) || (nxt - cur > 8))
1596  return(0);
1597 
1598  /* we parsed a variant */
1599 variant:
1600  if (nxt[0] == 0)
1601  return(1);
1602  if (nxt[0] != '-')
1603  return(0);
1604  /* extensions and private use subtags not checked */
1605  return (1);
1606 
1607 region_m49:
1608  if (((nxt[1] >= '0') && (nxt[1] <= '9')) &&
1609  ((nxt[2] >= '0') && (nxt[2] <= '9'))) {
1610  nxt += 3;
1611  goto region;
1612  }
1613  return(0);
1614 }
script
Definition: msipriv.h:374
static const WCHAR lang[]
Definition: wbemdisp.c:287
unsigned char xmlChar
Definition: xmlstring.h:28
FxCollectionEntry * cur
#define NULL
Definition: types.h:112

Referenced by xmlParseAttribute2().

◆ xmlCleanSpecialAttr()

static void xmlCleanSpecialAttr ( xmlParserCtxtPtr  ctxt)
static

xmlCleanSpecialAttr: @ctxt: an XML parser context

Trim the list of attributes defined to remove all those of type CDATA as they are not special. This call should be done when finishing to parse the DTD and before starting to parse the document root.

Definition at line 1408 of file parser.c.

1409 {
1410  if (ctxt->attsSpecial == NULL)
1411  return;
1412 
1414 
1415  if (xmlHashSize(ctxt->attsSpecial) == 0) {
1416  xmlHashFree(ctxt->attsSpecial, NULL);
1417  ctxt->attsSpecial = NULL;
1418  }
1419  return;
1420 }
XMLPUBFUN int XMLCALL xmlHashSize(xmlHashTablePtr table)
Definition: hash.c:1039
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:327
XMLPUBFUN void XMLCALL xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data)
Definition: hash.c:880
#define NULL
Definition: types.h:112
xmlHashTablePtr attsSpecial
Definition: parser.h:287
static void xmlCleanSpecialAttrCallback(void *payload, void *data, const xmlChar *fullname, const xmlChar *fullattr, const xmlChar *unused ATTRIBUTE_UNUSED)
Definition: parser.c:1389

Referenced by xmlParseDocument().

◆ xmlCleanSpecialAttrCallback()

static void xmlCleanSpecialAttrCallback ( void payload,
void data,
const xmlChar fullname,
const xmlChar fullattr,
const xmlChar *unused  ATTRIBUTE_UNUSED 
)
static

xmlCleanSpecialAttrCallback:

Removes CDATA attributes from the special attribute table

Definition at line 1389 of file parser.c.

1391  {
1393 
1394  if (((ptrdiff_t) payload) == XML_ATTRIBUTE_CDATA) {
1395  xmlHashRemoveEntry2(ctxt->attsSpecial, fullname, fullattr, NULL);
1396  }
1397 }
XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f)
Definition: hash.c:1076
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const char * fullname
Definition: shader.c:1766
#define NULL
Definition: types.h:112
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
xmlHashTablePtr attsSpecial
Definition: parser.h:287
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39

Referenced by xmlCleanSpecialAttr().

◆ xmlCleanupParser()

void xmlCleanupParser ( void  )

xmlCleanupParser:

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

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

Definition at line 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().

◆ xmlCreateDocParserCtxt()

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

◆ xmlCreateEntityParserCtxt()

xmlParserCtxtPtr xmlCreateEntityParserCtxt ( const xmlChar URL,
const xmlChar ID,
const xmlChar base 
)

xmlCreateEntityParserCtxt: @URL: the entity URL @ID: the entity PUBLIC ID @base: a possible base for the target URI

Create a parser context for an external entity Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.

Returns the new parser context or NULL

Definition at line 14021 of file parser.c.

14022  {
14024 
14025 }
static xmlParserCtxtPtr xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID, const xmlChar *base, xmlParserCtxtPtr pctx)
Definition: parser.c:13948
#define ID
Definition: ruserpass.c:36
#define NULL
Definition: types.h:112

◆ xmlCreateEntityParserCtxtInternal()

static xmlParserCtxtPtr xmlCreateEntityParserCtxtInternal ( const xmlChar URL,
const xmlChar ID,
const xmlChar base,
xmlParserCtxtPtr  pctx 
)
static

xmlCreateEntityParserCtxtInternal: @URL: the entity URL @ID: the entity PUBLIC ID @base: a possible base for the target URI @pctx: parser context used to set options on new context

Create a parser context for an external entity Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.

Returns the new parser context or NULL

Definition at line 13948 of file parser.c.

13949  {
13950  xmlParserCtxtPtr ctxt;
13951  xmlParserInputPtr inputStream;
13952  char *directory = NULL;
13953  xmlChar *uri;
13954 
13955  ctxt = xmlNewParserCtxt();
13956  if (ctxt == NULL) {
13957  return(NULL);
13958  }
13959 
13960  if (pctx != NULL) {
13961  ctxt->options = pctx->options;
13962  ctxt->_private = pctx->_private;
13963  /*
13964  * this is a subparser of pctx, so the input_id should be
13965  * incremented to distinguish from main entity
13966  */
13967  ctxt->input_id = pctx->input_id + 1;
13968  }
13969 
13970  /* Don't read from stdin. */
13971  if (xmlStrcmp(URL, BAD_CAST "-") == 0)
13972  URL = BAD_CAST "./-";
13973 
13974  uri = xmlBuildURI(URL, base);
13975 
13976  if (uri == NULL) {
13977  inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt);
13978  if (inputStream == NULL) {
13979  xmlFreeParserCtxt(ctxt);
13980  return(NULL);
13981  }
13982 
13983  inputPush(ctxt, inputStream);
13984 
13985  if ((ctxt->directory == NULL) && (directory == NULL))
13986  directory = xmlParserGetDirectory((char *)URL);
13987  if ((ctxt->directory == NULL) && (directory != NULL))
13988  ctxt->directory = directory;
13989  } else {
13990  inputStream = xmlLoadExternalEntity((char *)uri, (char *)ID, ctxt);
13991  if (inputStream == NULL) {
13992  xmlFree(uri);
13993  xmlFreeParserCtxt(ctxt);
13994  return(NULL);
13995  }
13996 
13997  inputPush(ctxt, inputStream);
13998 
13999  if ((ctxt->directory == NULL) && (directory == NULL))
14000  directory = xmlParserGetDirectory((char *)uri);
14001  if ((ctxt->directory == NULL) && (directory != NULL))
14002  ctxt->directory = directory;
14003  xmlFree(uri);
14004  }
14005  return(ctxt);
14006 }
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
const char * uri
Definition: sec_mgr.c:1588
XMLPUBFUN char *XMLCALL xmlParserGetDirectory(const char *filename)
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
int input_id
Definition: parser.h:314
XMLPUBFUN xmlChar *XMLCALL xmlBuildURI(const xmlChar *URI, const xmlChar *base)
Definition: uri.c:1891
void * _private
Definition: parser.h:258
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
#define ID
Definition: ruserpass.c:36
XMLPUBFUN xmlParserInputPtr XMLCALL xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
#define NULL
Definition: types.h:112
char * directory
Definition: parser.h:228
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
XMLPUBFUN int XMLCALL xmlStrcmp(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:132

Referenced by xmlCreateEntityParserCtxt(), and xmlParseExternalEntityPrivate().

◆ xmlCreateFileParserCtxt()

xmlParserCtxtPtr xmlCreateFileParserCtxt ( const char filename)

xmlCreateFileParserCtxt: @filename: the filename

Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.

Returns the new parser context or NULL

Definition at line 14087 of file parser.c.

14088 {
14089  return(xmlCreateURLParserCtxt(filename, 0));
14090 }
const char * filename
Definition: ioapi.h:135
xmlParserCtxtPtr xmlCreateURLParserCtxt(const char *filename, int options)
Definition: parser.c:14045

◆ xmlCreateIOParserCtxt()

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

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

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

Returns the new parser context or NULL

Definition at line 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

◆ xmlCreateMemoryParserCtxt()

xmlParserCtxtPtr xmlCreateMemoryParserCtxt ( const char buffer,
int  size 
)

xmlCreateMemoryParserCtxt: @buffer: a pointer to a char array @size: the size of the array

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

Returns the new parser context or NULL

Definition at line 14333 of file parser.c.

14333  {
14334  xmlParserCtxtPtr ctxt;
14337 
14338  if (buffer == NULL)
14339  return(NULL);
14340  if (size <= 0)
14341  return(NULL);
14342 
14343  ctxt = xmlNewParserCtxt();
14344  if (ctxt == NULL)
14345  return(NULL);
14346 
14347  /* TODO: xmlParserInputBufferCreateStatic, requires some serious changes */
14349  if (buf == NULL) {
14350  xmlFreeParserCtxt(ctxt);
14351  return(NULL);
14352  }
14353 
14354  input = xmlNewInputStream(ctxt);
14355  if (input == NULL) {
14357  xmlFreeParserCtxt(ctxt);
14358  return(NULL);
14359  }
14360 
14361  input->filename = NULL;
14362  input->buf = buf;
14363  xmlBufResetInput(input->buf->buffer, input);
14364 
14365  inputPush(ctxt, input);
14366  return(ctxt);
14367 }
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
GLuint buffer
Definition: glext.h:5915
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
Definition: buf.c:1285
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum GLenum input
Definition: glext.h:9031
#define NULL
Definition: types.h:112
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewInputStream(xmlParserCtxtPtr ctxt)

Referenced by xmlCreateDocParserCtxt(), xmlParseBalancedChunkMemoryInternal(), xmlParseInNodeContext(), and xmlReadMemory().

◆ xmlCreateURLParserCtxt()

xmlParserCtxtPtr xmlCreateURLParserCtxt ( const char filename,
int  options 
)

xmlCreateURLParserCtxt: @filename: the filename or URL @options: a combination of xmlParserOption

Create a parser context for a file or URL content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time and for file accesses

Returns the new parser context or NULL

Definition at line 14045 of file parser.c.

14046 {
14047  xmlParserCtxtPtr ctxt;
14048  xmlParserInputPtr inputStream;
14049  char *directory = NULL;
14050 
14051  ctxt = xmlNewParserCtxt();
14052  if (ctxt == NULL) {
14053  xmlErrMemory(NULL, "cannot allocate parser context");
14054  return(NULL);
14055  }
14056 
14057  if (options)
14059  ctxt->linenumbers = 1;
14060 
14061  inputStream = xmlLoadExternalEntity(filename, NULL, ctxt);
14062  if (inputStream == NULL) {
14063  xmlFreeParserCtxt(ctxt);
14064  return(NULL);
14065  }
14066 
14067  inputPush(ctxt, inputStream);
14068  if ((ctxt->directory == NULL) && (directory == NULL))
14070  if ((ctxt->directory == NULL) && (directory != NULL))
14071  ctxt->directory = directory;
14072 
14073  return(ctxt);
14074 }
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
XMLPUBFUN char *XMLCALL xmlParserGetDirectory(const char *filename)
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
const char * filename
Definition: ioapi.h:135
int linenumbers
Definition: parser.h:261
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding)
Definition: parser.c:14992
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBFUN xmlParserInputPtr XMLCALL xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
#define NULL
Definition: types.h:112
char * directory
Definition: parser.h:228
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)

Referenced by xmlCreateFileParserCtxt(), and xmlReadFile().

◆ xmlCtxtGrowAttrs()

static int xmlCtxtGrowAttrs ( xmlParserCtxtPtr  ctxt,
int  nr 
)
static

Definition at line 1709 of file parser.c.

1709  {
1710  const xmlChar **atts;
1711  int *attallocs;
1712  int maxatts;
1713 
1714  if (ctxt->atts == NULL) {
1715  maxatts = 55; /* allow for 10 attrs by default */
1716  atts = (const xmlChar **)
1717  xmlMalloc(maxatts * sizeof(xmlChar *));
1718  if (atts == NULL) goto mem_error;
1719  ctxt->atts = atts;
1720  attallocs = (int *) xmlMalloc((maxatts / 5) * sizeof(int));
1721  if (attallocs == NULL) goto mem_error;
1722  ctxt->attallocs = attallocs;
1723  ctxt->maxatts = maxatts;
1724  } else if (nr + 5 > ctxt->maxatts) {
1725  maxatts = (nr + 5) * 2;
1726  atts = (const xmlChar **) xmlRealloc((void *) ctxt->atts,
1727  maxatts * sizeof(const xmlChar *));
1728  if (atts == NULL) goto mem_error;
1729  ctxt->atts = atts;
1730  attallocs = (int *) xmlRealloc((void *) ctxt->attallocs,
1731  (maxatts / 5) * sizeof(int));
1732  if (attallocs == NULL) goto mem_error;
1733  ctxt->attallocs = attallocs;
1734  ctxt->maxatts = maxatts;
1735  }
1736  return(ctxt->maxatts);
1737 mem_error:
1738  xmlErrMemory(ctxt, NULL);
1739  return(-1);
1740 }
int * attallocs
Definition: parser.h:284
ULONG nr
Definition: thread.c:7
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
unsigned char xmlChar
Definition: xmlstring.h:28
const xmlChar ** atts
Definition: parser.h:266
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
_In_ uint16_t _Out_ ULONG * atts
Definition: btrfs_drv.h:1109
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by xmlParseStartTag2().

◆ xmlCtxtReadDoc()

xmlDocPtr 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()

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

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

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

Returns the resulting document tree

Definition at line 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()

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

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

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

Returns the resulting document tree

Definition at line 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()

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

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

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

Returns the resulting document tree

Definition at line 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()

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

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

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

Returns the resulting document tree

Definition at line 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()

void 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()

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

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

Reset a push parser context

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

Definition at line 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()

int xmlCtxtUseOptions ( xmlParserCtxtPtr  ctxt,
int  options 
)

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

Applies the options to the parser context

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

Definition at line 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().

◆ xmlCtxtUseOptionsInternal()

static int xmlCtxtUseOptionsInternal ( xmlParserCtxtPtr  ctxt,
int  options,
const char encoding 
)
static

xmlCtxtUseOptionsInternal: @ctxt: an XML parser context @options: a combination of xmlParserOption @encoding: the user provided encoding to use

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

14993 {
14994  if (ctxt == NULL)
14995  return(-1);
14996  if (encoding != NULL) {
14997  if (ctxt->encoding != NULL)
14998  xmlFree((xmlChar *) ctxt->encoding);
14999  ctxt->encoding = xmlStrdup((const xmlChar *) encoding);
15000  }
15001  if (options & XML_PARSE_RECOVER) {
15002  ctxt->recovery = 1;
15004  ctxt->options |= XML_PARSE_RECOVER;
15005  } else
15006  ctxt->recovery = 0;
15007  if (options & XML_PARSE_DTDLOAD) {
15008  ctxt->loadsubset = XML_DETECT_IDS;
15010  ctxt->options |= XML_PARSE_DTDLOAD;
15011  } else
15012  ctxt->loadsubset = 0;
15013  if (options & XML_PARSE_DTDATTR) {
15014  ctxt->loadsubset |= XML_COMPLETE_ATTRS;
15016  ctxt->options |= XML_PARSE_DTDATTR;
15017  }
15018  if (options & XML_PARSE_NOENT) {
15019  ctxt->replaceEntities = 1;
15020  /* ctxt->loadsubset |= XML_DETECT_IDS; */
15022  ctxt->options |= XML_PARSE_NOENT;
15023  } else
15024  ctxt->replaceEntities = 0;
15025  if (options & XML_PARSE_PEDANTIC) {
15026  ctxt->pedantic = 1;
15028  ctxt->options |= XML_PARSE_PEDANTIC;
15029  } else
15030  ctxt->pedantic = 0;
15031  if (options & XML_PARSE_NOBLANKS) {
15032  ctxt->keepBlanks = 0;
15033  ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
15035  ctxt->options |= XML_PARSE_NOBLANKS;
15036  } else
15037  ctxt->keepBlanks = 1;
15038  if (options & XML_PARSE_DTDVALID) {
15039  ctxt->validate = 1;
15041  ctxt->vctxt.warning = NULL;
15042  if (options & XML_PARSE_NOERROR)
15043  ctxt->vctxt.error = NULL;
15045  ctxt->options |= XML_PARSE_DTDVALID;
15046  } else
15047  ctxt->validate = 0;
15048  if (options & XML_PARSE_NOWARNING) {
15049  ctxt->sax->warning = NULL;
15051  }
15052  if (options & XML_PARSE_NOERROR) {
15053  ctxt->sax->error = NULL;
15054  ctxt->sax->fatalError = NULL;
15056  }
15057 #ifdef LIBXML_SAX1_ENABLED
15058  if (options & XML_PARSE_SAX1) {
15059  ctxt->sax->startElement = xmlSAX2StartElement;
15060  ctxt->sax->endElement = xmlSAX2EndElement;
15061  ctxt->sax->startElementNs = NULL;
15062  ctxt->sax->endElementNs = NULL;
15063  ctxt->sax->initialized = 1;
15065  ctxt->options |= XML_PARSE_SAX1;
15066  }
15067 #endif /* LIBXML_SAX1_ENABLED */
15068  if (options & XML_PARSE_NODICT) {
15069  ctxt->dictNames = 0;
15071  ctxt->options |= XML_PARSE_NODICT;
15072  } else {
15073  ctxt->dictNames = 1;
15074  }
15075  if (options & XML_PARSE_NOCDATA) {
15076  ctxt->sax->cdataBlock = NULL;
15078  ctxt->options |= XML_PARSE_NOCDATA;
15079  }
15080  if (options & XML_PARSE_NSCLEAN) {
15081  ctxt->options |= XML_PARSE_NSCLEAN;
15083  }
15084  if (options & XML_PARSE_NONET) {
15085  ctxt->options |= XML_PARSE_NONET;
15087  }
15088  if (options & XML_PARSE_COMPACT) {
15089  ctxt->options |= XML_PARSE_COMPACT;
15091  }
15092  if (options & XML_PARSE_OLD10) {
15093  ctxt->options |= XML_PARSE_OLD10;
15095  }
15096  if (options & XML_PARSE_NOBASEFIX) {
15097  ctxt->options |= XML_PARSE_NOBASEFIX;
15099  }
15100  if (options & XML_PARSE_HUGE) {
15101  ctxt->options |= XML_PARSE_HUGE;
15103  if (ctxt->dict != NULL)
15104  xmlDictSetLimit(ctxt->dict, 0);
15105  }
15106  if (options & XML_PARSE_OLDSAX) {
15107  ctxt->options |= XML_PARSE_OLDSAX;
15109  }
15110  if (options & XML_PARSE_IGNORE_ENC) {
15111  ctxt->options |= XML_PARSE_IGNORE_ENC;
15113  }
15114  if (options & XML_PARSE_BIG_LINES) {
15115  ctxt->options |= XML_PARSE_BIG_LINES;
15117  }
15118  ctxt->linenumbers = 1;
15119  return (options);
15120 }
#define XML_DETECT_IDS
Definition: parser.h:139
int pedantic
Definition: parser.h:257
XMLPUBFUN size_t XMLCALL xmlDictSetLimit(xmlDictPtr dict, size_t limit)
Definition: dict.c:1263
xmlValidityErrorFunc error
Definition: valid.h:84
int recovery
Definition: parser.h:263
int linenumbers
Definition: parser.h:261
int replaceEntities
Definition: parser.h:191
xmlDictPtr dict
Definition: parser.h:265
int validate
Definition: parser.h:222
XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace(void *ctx, const xmlChar *ch, int len)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
const xmlChar * encoding
Definition: parser.h:193
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:187
int loadsubset
Definition: parser.h:260
int dictNames
Definition: parser.h:294
ed encoding
Definition: write.c:2825
#define XML_COMPLETE_ATTRS
Definition: parser.h:148
#define NULL
Definition: types.h:112
int keepBlanks
Definition: parser.h:238
xmlValidCtxt vctxt
Definition: parser.h:223
xmlValidityWarningFunc warning
Definition: valid.h:85
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xmlCreateURLParserCtxt(), xmlCtxtUseOptions(), xmlDoRead(), and xmlParseInNodeContext().

◆ xmlDetectSAX2()

static void xmlDetectSAX2 ( xmlParserCtxtPtr  ctxt)
static

xmlDetectSAX2: @ctxt: an XML parser context

Do the SAX2 detection and specific initialization

Definition at line 1105 of file parser.c.

1105  {
1107  if (ctxt == NULL) return;
1108  sax = ctxt->sax;
1109 #ifdef LIBXML_SAX1_ENABLED
1110  if ((sax) && (sax->initialized == XML_SAX2_MAGIC) &&
1111  ((sax->startElementNs != NULL) ||
1112  (sax->endElementNs != NULL) ||
1113  ((sax->startElement == NULL) && (sax->endElement == NULL))))
1114  ctxt->sax2 = 1;
1115 #else
1116  ctxt->sax2 = 1;
1117 #endif /* LIBXML_SAX1_ENABLED */
1118 
1119  ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3);
1120  ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5);
1121  ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
1122  if ((ctxt->str_xml==NULL) || (ctxt->str_xmlns==NULL) ||
1123  (ctxt->str_xml_ns == NULL)) {
1124  xmlErrMemory(ctxt, NULL);
1125  }
1126 }
#define XML_SAX2_MAGIC
Definition: parser.h:673
static int sax
Definition: xmllint.c:199
const xmlChar * str_xmlns
Definition: parser.h:274
const xmlChar * str_xml
Definition: parser.h:273
#define XML_XML_NAMESPACE
Definition: tree.h:140
#define BAD_CAST
Definition: xmlstring.h:35
xmlDictPtr dict
Definition: parser.h:265
const xmlChar * str_xml_ns
Definition: parser.h:275
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:865
struct _xmlSAXHandler * sax
Definition: parser.h:187
#define NULL
Definition: types.h:112

Referenced by xmlParseBalancedChunkMemoryInternal(), xmlParseDocument(), xmlParseExternalEntityPrivate(), xmlParseExternalSubset(), xmlParseExtParsedEnt(), and xmlParseInNodeContext().

◆ xmlDoRead()

static xmlDocPtr xmlDoRead ( xmlParserCtxtPtr  ctxt,
const char URL,
const char encoding,
int  options,
int  reuse 
)
static

xmlDoRead: @ctxt: an XML parser context @URL: the base URL to use for the document @encoding: the document encoding, or NULL @options: a combination of xmlParserOption @reuse: keep the context for reuse

Common front-end for the xmlRead functions

Returns the resulting document tree or NULL

Definition at line 15151 of file parser.c.

15153 {
15154  xmlDocPtr ret;
15155 
15157  if (encoding != NULL) {
15159 
15161  if (hdlr != NULL)
15162  xmlSwitchToEncoding(ctxt, hdlr);
15163  }
15164  if ((URL != NULL) && (ctxt->input != NULL) &&
15165  (ctxt->input->filename == NULL))
15166  ctxt->input->filename = (char *) xmlStrdup((const xmlChar *) URL);
15167  xmlParseDocument(ctxt);
15168  if ((ctxt->wellFormed) || ctxt->recovery)
15169  ret = ctxt->myDoc;
15170  else {
15171  ret = NULL;
15172  if (ctxt->myDoc != NULL) {
15173  xmlFreeDoc(ctxt->myDoc);
15174  }
15175  }
15176  ctxt->myDoc = NULL;
15177  if (!reuse) {
15178  xmlFreeParserCtxt(ctxt);
15179  }
15180 
15181  return (ret);
15182 }
XMLPUBFUN int XMLCALL xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
int xmlParseDocument(xmlParserCtxtPtr ctxt)
Definition: parser.c:10689
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
xmlParserInputPtr input
Definition: parser.h:201
int recovery
Definition: parser.h:263
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding)
Definition: parser.c:14992
int wellFormed
Definition: parser.h:190
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
int ret
xmlDocPtr myDoc
Definition: parser.h:189
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1660
unsigned char xmlChar
Definition: xmlstring.h:28
ed encoding
Definition: write.c:2825
const char * filename
Definition: parser.h:58
#define NULL
Definition: types.h:112
Definition: tree.h:551
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xmlCtxtReadDoc(), xmlCtxtReadFd(), xmlCtxtReadFile(), xmlCtxtReadIO(), xmlCtxtReadMemory(), xmlReadDoc(), xmlReadFd(), xmlReadFile(), xmlReadIO(), and xmlReadMemory().

◆ xmlErrAttributeDup()

static void xmlErrAttributeDup ( xmlParserCtxtPtr  ctxt,
const xmlChar prefix,
const xmlChar localname 
)
static

xmlErrAttributeDup: @ctxt: an XML parser context @prefix: the attribute prefix @localname: the attribute localname

Handle a redefinition of attribute error

Definition at line 353 of file parser.c.

355 {
356  if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
357  (ctxt->instate == XML_PARSER_EOF))
358  return;
359  if (ctxt != NULL)
361 
362  if (prefix == NULL)
363  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
365  (const char *) localname, NULL, NULL, 0, 0,
366  "Attribute %s redefined\n", localname);
367  else
368  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
370  (const char *) prefix, (const char *) localname,
371  NULL, 0, 0, "Attribute %s:%s redefined\n", prefix,
372  localname);
373  if (ctxt != NULL) {
374  ctxt->wellFormed = 0;
375  if (ctxt->recovery == 0)
376  ctxt->disableSAX = 1;
377  }
378 }
xmlParserInputState instate
Definition: parser.h:225
int disableSAX
Definition: parser.h:239
int recovery
Definition: parser.h:263
int wellFormed
Definition: parser.h:190
#define NULL
Definition: types.h:112

Referenced by xmlParseStartTag2().

◆ xmlFatalErr()

static void xmlFatalErr ( xmlParserCtxtPtr  ctxt,
xmlParserErrors  error,
const char info 
)
static

xmlFatalErr: @ctxt: an XML parser context @error: the error number @extra: extra information string

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

Definition at line 389 of file parser.c.

390 {
391  const char *errmsg;
392 
393  if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
394  (ctxt->instate == XML_PARSER_EOF))
395  return;
396  switch (error) {
398  errmsg = "CharRef: invalid hexadecimal value";
399  break;
401  errmsg = "CharRef: invalid decimal value";
402  break;
404  errmsg = "CharRef: invalid value";
405  break;
407  errmsg = "internal error";
408  break;
410  errmsg = "PEReference at end of document";
411  break;
413  errmsg = "PEReference in prolog";
414  break;
416  errmsg = "PEReference in epilog";
417  break;
419  errmsg = "PEReference: no name";
420  break;
422  errmsg = "PEReference: expecting ';'";
423  break;
424  case XML_ERR_ENTITY_LOOP:
425  errmsg = "Detected an entity reference loop";
426  break;
428  errmsg = "EntityValue: \" or ' expected";
429  break;
431  errmsg = "PEReferences forbidden in internal subset";
432  break;
434  errmsg = "EntityValue: \" or ' expected";
435  break;
437  errmsg = "AttValue: \" or ' expected";
438  break;
440  errmsg = "Unescaped '<' not allowed in attributes values";
441  break;
443  errmsg = "SystemLiteral \" or ' expected";
444  break;
446  errmsg = "Unfinished System or Public ID \" or ' expected";
447  break;
449  errmsg = "Sequence ']]>' not allowed in content";
450  break;
452  errmsg = "SYSTEM or PUBLIC, the URI is missing";
453  break;
455  errmsg = "PUBLIC, the Public Identifier is missing";
456  break;
458  errmsg = "Comment must not contain '--' (double-hyphen)";
459  break;
461  errmsg = "xmlParsePI : no target name";
462  break;
464  errmsg = "Invalid PI name";
465  break;
467  errmsg = "NOTATION: Name expected here";
468  break;
470  errmsg = "'>' required to close NOTATION declaration";
471  break;
473  errmsg = "Entity value required";
474  break;
476  errmsg = "Fragment not allowed";
477  break;
479  errmsg = "'(' required to start ATTLIST enumeration";
480  break;
482  errmsg = "NmToken expected in ATTLIST enumeration";
483  break;
485  errmsg = "')' required to finish ATTLIST enumeration";
486  break;
488  errmsg = "MixedContentDecl : '|' or ')*' expected";
489  break;
491  errmsg = "MixedContentDecl : '#PCDATA' expected";
492  break;
494  errmsg = "ContentDecl : Name or '(' expected";
495  break;
497  errmsg = "ContentDecl : ',' '|' or ')' expected";
498  break;
500  errmsg =
501  "PEReference: forbidden within markup decl in internal subset";
502  break;
503  case XML_ERR_GT_REQUIRED:
504  errmsg = "expected '>'";
505  break;
507  errmsg = "XML conditional section '[' expected";
508  break;
510  errmsg = "Content error in the external subset";
511  break;
513  errmsg =
514  "conditional section INCLUDE or IGNORE keyword expected";
515  break;
517  errmsg = "XML conditional section not closed";
518  break;
520  errmsg = "Text declaration '<?xml' required";
521  break;
523  errmsg = "parsing XML declaration: '?>' expected";
524  break;
526  errmsg = "external parsed entities cannot be standalone";
527  break;
529  errmsg = "EntityRef: expecting ';'";
530  break;
532  errmsg = "DOCTYPE improperly terminated";
533  break;
535  errmsg = "EndTag: '</' not found";
536  break;
538  errmsg = "expected '='";
539  break;
541  errmsg = "String not closed expecting \" or '";
542  break;
544  errmsg = "String not started expecting ' or \"";
545  break;
547  errmsg = "Invalid XML encoding name";
548  break;
550  errmsg = "standalone accepts only 'yes' or 'no'";
551  break;
553  errmsg = "Document is empty";
554  break;
556  errmsg = "Extra content at the end of the document";
557  break;
559  errmsg = "chunk is not well balanced";
560  break;
562  errmsg = "extra content at the end of well balanced chunk";
563  break;
565  errmsg = "Malformed declaration expecting version";
566  break;
568  errmsg = "Name too long use XML_PARSE_HUGE option";
569  break;
570 #if 0
571  case:
572  errmsg = "";
573  break;
574 #endif
575  default:
576  errmsg = "Unregistered error message";
577  }
578  if (ctxt != NULL)
579  ctxt->errNo = error;
580  if (info == NULL) {
581  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
582  XML_ERR_FATAL, NULL, 0, info, NULL, NULL, 0, 0, "%s\n",
583  errmsg);
584  } else {
585  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
586  XML_ERR_FATAL, NULL, 0, info, NULL, NULL, 0, 0, "%s: %s\n",
587  errmsg, info);
588  }
589  if (ctxt != NULL) {
590  ctxt->wellFormed = 0;
591  if (ctxt->recovery == 0)
592  ctxt->disableSAX = 1;
593  }
594 }
xmlParserInputState instate
Definition: parser.h:225
int disableSAX
Definition: parser.h:239
int recovery
Definition: parser.h:263
EXPORT int errmsg(char *msg, va_alist)
Definition: comerr.c:192
int wellFormed
Definition: parser.h:190
DWORD error
Definition: parser.c:105
#define NULL
Definition: types.h:112

Referenced by xmlGROW(), xmlLoadEntityContent(), xmlParseAttValueComplex(), xmlParseAttValueInternal(), xmlParseBalancedChunkMemoryInternal(), xmlParseCDSect(), xmlParseCharData(), xmlParseCharDataComplex(), xmlParseCharRef(), xmlParseCommentComplex(), xmlParseConditionalSections(), xmlParseContentInternal(), xmlParseDocTypeDecl(), xmlParseDocument(), xmlParseElementChildrenContentDeclPriv(), xmlParseElementDecl(), xmlParseElementMixedContentDecl(), xmlParseEncName(), xmlParseEncodingDecl(), xmlParseEndTag2(), xmlParseEntityDecl(), xmlParseEntityRef(), xmlParseEntityValue(), xmlParseEnumerationType(), xmlParseExternalEntityPrivate(), xmlParseExternalID(), xmlParseExternalSubset(), xmlParseExtParsedEnt(), xmlParseInNodeContext(), xmlParseInternalSubset(), xmlParseName(), xmlParseNameComplex(), xmlParseNCName(), xmlParseNCNameComplex(), xmlParseNmtoken(), xmlParseNotationDecl(), xmlParseNotationType(), xmlParsePEReference(), xmlParsePI(), xmlParsePITarget(), xmlParsePubidLiteral(), xmlParseReference(), xmlParserEntityCheck(), xmlParserHandlePEReference(), xmlParseSDDecl(), xmlParseStartTag2(), xmlParseStringCharRef(), xmlParseStringEntityRef(), xmlParseStringName(), xmlParseStringPEReference(), xmlParseSystemLiteral(), xmlParseTextDecl(), xmlParseVersionInfo(), xmlParseXMLDecl(), xmlPopInput(), xmlPushInput(), and xmlStringLenDecodeEntities().

◆ xmlGenericErrorDefaultFunc()

void XMLCDECL xmlGenericErrorDefaultFunc ( void ctx,
const char msg,
  ... 
)

Referenced by xmlInitParser().

◆ xmlGetNamespace()

static const xmlChar* xmlGetNamespace ( xmlParserCtxtPtr  ctxt,
const xmlChar prefix 
)
static

Definition at line 8751 of file parser.c.

8751  {
8752  int i;
8753 
8754  if (prefix == ctxt->str_xml) return(ctxt->str_xml_ns);
8755  for (i = ctxt->nsNr - 2;i >= 0;i-=2)
8756  if (ctxt->nsTab[i] == prefix) {
8757  if ((prefix == NULL) && (*ctxt->nsTab[i + 1] == 0))
8758  return(NULL);
8759  return(ctxt->nsTab[i + 1]);
8760  }
8761  return(NULL);
8762 }
const xmlChar * str_xml
Definition: parser.h:273
const xmlChar * str_xml_ns
Definition: parser.h:275
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
const xmlChar ** nsTab
Definition: parser.h:283

Referenced by xmlParseInNodeContext(), and xmlParseStartTag2().

◆ xmlGROW()

static void xmlGROW ( xmlParserCtxtPtr  ctxt)
static

Definition at line 2130 of file parser.c.

2130  {
2131  ptrdiff_t curEnd = ctxt->input->end - ctxt->input->cur;
2132  ptrdiff_t curBase = ctxt->input->cur - ctxt->input->base;
2133 
2134  if (((curEnd > XML_MAX_LOOKUP_LIMIT) ||
2135  (curBase > XML_MAX_LOOKUP_LIMIT)) &&
2136  ((ctxt->input->buf) &&
2138  ((ctxt->options & XML_PARSE_HUGE) == 0)) {
2139  xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup");
2140  xmlHaltParser(ctxt);
2141  return;
2142  }
2144  if ((ctxt->input->cur > ctxt->input->end) ||
2145  (ctxt->input->cur < ctxt->input->base)) {
2146  xmlHaltParser(ctxt);
2147  xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "cur index out of bound");
2148  return;
2149  }
2150  if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0))
2152 }
static void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
Definition: parser.c:389
#define XML_MAX_LOOKUP_LIMIT
const xmlChar * cur
Definition: parser.h:61
const xmlChar * base
Definition: parser.h:60
xmlInputReadCallback readcallback
Definition: xmlIO.h:127
xmlParserInputPtr input
Definition: parser.h:201
int xmlInputReadCallbackNop(void *context, char *buffer, int len)
XMLPUBFUN int XMLCALL xmlParserInputGrow(xmlParserInputPtr in, int len)
#define INPUT_CHUNK
xmlParserInputBufferPtr buf
Definition: parser.h:56
#define NULL
Definition: types.h:112
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
static void xmlHaltParser(xmlParserCtxtPtr ctxt)
Definition: parser.c:12544
const xmlChar * end
Definition: parser.h:62

◆ xmlHaltParser()

static void xmlHaltParser ( xmlParserCtxtPtr  ctxt)
static

xmlHaltParser: @ctxt: an XML parser context

Blocks further parser processing don't override error for internal use

Definition at line 12544 of file parser.c.

12544  {
12545  if (ctxt == NULL)
12546  return;
12547  ctxt->inst