ReactOS  0.4.14-dev-49-gfb4591c
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  _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)
 
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 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 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 xmlChar *prefix, const xmlChar *URI, int line, int nsNr, int tlen)
 
void xmlParseCDSect (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 2023 of file parser.c.

◆ bottom_parser

#define bottom_parser

Definition at line 15580 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:2036
GLdouble s
Definition: gl.h:2039

Definition at line 2039 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 2025 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 2028 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 2030 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 2032 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 2034 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:2034

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

Definition at line 2123 of file parser.c.

◆ CUR

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

Definition at line 2020 of file parser.c.

◆ CUR_CHAR

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

Definition at line 2120 of file parser.c.

◆ CUR_PTR

#define CUR_PTR   ctxt->input->cur

Definition at line 2022 of file parser.c.

◆ CUR_SCHAR

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

Definition at line 2121 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:1211

DICT_FREE: @str: a string

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

Definition at line 14801 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 2073 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
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
unsigned char xmlChar
Definition: xmlstring.h:28

Definition at line 2560 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 2103 of file parser.c.

◆ NEXT1

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

Definition at line 2105 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 2113 of file parser.c.

◆ NXT

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

Definition at line 2021 of file parser.c.

◆ RAW

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

Definition at line 2019 of file parser.c.

◆ SAX2

#define SAX2   1

Definition at line 246 of file parser.c.

◆ SAX_COMPAT_MODE

#define SAX_COMPAT_MODE   BAD_CAST "SAX compatibility mode document"

Definition at line 249 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 2062 of file parser.c.

◆ SKIP

#define SKIP (   val)
Value:
do { \
ctxt->nbChars += (val),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 2043 of file parser.c.

◆ SKIP_BLANKS

#define SKIP_BLANKS   xmlSkipBlankChars(ctxt)

Definition at line 2101 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->nbChars++; \
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 2049 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 247 of file parser.c.

◆ XML_PARSER_BIG_ENTITY

#define XML_PARSER_BIG_ENTITY   1000

Definition at line 105 of file parser.c.

◆ XML_PARSER_BUFFER_SIZE

#define XML_PARSER_BUFFER_SIZE   100

Definition at line 248 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 260 of file parser.c.

◆ XML_PARSER_LOT_ENTITY

#define XML_PARSER_LOT_ENTITY   5000

Definition at line 106 of file parser.c.

◆ XML_PARSER_NON_LINEAR

#define XML_PARSER_NON_LINEAR   10

Definition at line 114 of file parser.c.

Typedef Documentation

◆ xmlDefAttrs

Definition at line 1085 of file parser.c.

◆ xmlDefAttrsPtr

Definition at line 1086 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 2805 of file parser.c.

2806  {
2807  int i, ret;
2808  xmlNodePtr lastChild;
2809 
2810  /*
2811  * Don't spend time trying to differentiate them, the same callback is
2812  * used !
2813  */
2814  if (ctxt->sax->ignorableWhitespace == ctxt->sax->characters)
2815  return(0);
2816 
2817  /*
2818  * Check for xml:space value.
2819  */
2820  if ((ctxt->space == NULL) || (*(ctxt->space) == 1) ||
2821  (*(ctxt->space) == -2))
2822  return(0);
2823 
2824  /*
2825  * Check that the string is made of blanks
2826  */
2827  if (blank_chars == 0) {
2828  for (i = 0;i < len;i++)
2829  if (!(IS_BLANK_CH(str[i]))) return(0);
2830  }
2831 
2832  /*
2833  * Look if the element is mixed content in the DTD if available
2834  */
2835  if (ctxt->node == NULL) return(0);
2836  if (ctxt->myDoc != NULL) {
2837  ret = xmlIsMixedElement(ctxt->myDoc, ctxt->node->name);
2838  if (ret == 0) return(1);
2839  if (ret == 1) return(0);
2840  }
2841 
2842  /*
2843  * Otherwise, heuristic :-\
2844  */
2845  if ((RAW != '<') && (RAW != 0xD)) return(0);
2846  if ((ctxt->node->children == NULL) &&
2847  (RAW == '<') && (NXT(1) == '/')) return(0);
2848 
2849  lastChild = xmlGetLastChild(ctxt->node);
2850  if (lastChild == NULL) {
2851  if ((ctxt->node->type != XML_ELEMENT_NODE) &&
2852  (ctxt->node->content != NULL)) return(0);
2853  } else if (xmlNodeIsText(lastChild))
2854  return(0);
2855  else if ((ctxt->node->children != NULL) &&
2856  (xmlNodeIsText(ctxt->node->children)))
2857  return(0);
2858  return(1);
2859 }
const xmlChar * name
Definition: tree.h:492
#define NXT(val)
Definition: parser.c:2021
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 IS_BLANK_CH(c)
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN xmlNodePtr XMLCALL xmlGetLastChild(const xmlNode *parent)
xmlNodePtr node
Definition: parser.h:205
XMLPUBFUN int XMLCALL xmlNodeIsText(const xmlNode *node)
xmlChar * content
Definition: tree.h:502
Definition: tree.h:489
int ret
xmlDocPtr myDoc
Definition: parser.h:187
GLenum GLsizei len
Definition: glext.h:6722
struct _xmlSAXHandler * sax
Definition: parser.h:185
xmlElementType type
Definition: tree.h:491
XMLPUBFUN int XMLCALL xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name)
Definition: valid.c:3413
struct _xmlNode * children
Definition: tree.h:493
#define RAW
Definition: parser.c:2019
int * space
Definition: parser.h:244

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

1741 {
1743 
1744  if (ctxt == NULL)
1745  return(NULL);
1746  if (ctxt->inputNr <= 0)
1747  return (NULL);
1748  ctxt->inputNr--;
1749  if (ctxt->inputNr > 0)
1750  ctxt->input = ctxt->inputTab[ctxt->inputNr - 1];
1751  else
1752  ctxt->input = NULL;
1753  ret = ctxt->inputTab[ctxt->inputNr];
1754  ctxt->inputTab[ctxt->inputNr] = NULL;
1755  return (ret);
1756 }
xmlParserInputPtr * inputTab
Definition: parser.h:202
xmlParserInputPtr input
Definition: parser.h:199
smooth NULL
Definition: ftsmooth.c:416
int ret

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

1710 {
1711  if ((ctxt == NULL) || (value == NULL))
1712  return(-1);
1713  if (ctxt->inputNr >= ctxt->inputMax) {
1714  ctxt->inputMax *= 2;
1715  ctxt->inputTab =
1717  ctxt->inputMax *
1718  sizeof(ctxt->inputTab[0]));
1719  if (ctxt->inputTab == NULL) {
1720  xmlErrMemory(ctxt, NULL);
1722  ctxt->inputMax /= 2;
1723  value = NULL;
1724  return (-1);
1725  }
1726  }
1727  ctxt->inputTab[ctxt->inputNr] = value;
1728  ctxt->input = value;
1729  return (ctxt->inputNr++);
1730 }
xmlParserInputPtr * inputTab
Definition: parser.h:202
xmlParserInputPtr input
Definition: parser.h:199
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlFreeInputStream(xmlParserInputPtr input)
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
int inputMax
Definition: parser.h:201
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
GLsizei const GLfloat * value
Definition: glext.h:6069

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

568 {
569  if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
570  (ctxt->instate == XML_PARSER_EOF))
571  return;
572  if (ctxt != NULL)
573  ctxt->errNo = error;
574  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
575  XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg);
576  if (ctxt != NULL) {
577  ctxt->wellFormed = 0;
578  if (ctxt->recovery == 0)
579  ctxt->disableSAX = 1;
580  }
581 }
smooth NULL
Definition: ftsmooth.c:416
DWORD error
Definition: parser.c:105
#define msg(x)
Definition: auth_time.c:54

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

1937 {
1938  const xmlChar *ret;
1939 
1940  if ((ctxt == NULL) || (ctxt->nameNr <= 0))
1941  return (NULL);
1942  ctxt->nameNr--;
1943  if (ctxt->nameNr > 0)
1944  ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
1945  else
1946  ctxt->name = NULL;
1947  ret = ctxt->nameTab[ctxt->nameNr];
1948  ctxt->nameTab[ctxt->nameNr] = NULL;
1949  return (ret);
1950 }
const xmlChar * name
Definition: parser.h:229
smooth NULL
Definition: ftsmooth.c:416
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
const xmlChar ** nameTab
Definition: parser.h:232

Referenced by xmlParseElement().

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

1906 {
1907  if (ctxt == NULL) return (-1);
1908 
1909  if (ctxt->nameNr >= ctxt->nameMax) {
1910  const xmlChar * *tmp;
1911  tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab,
1912  ctxt->nameMax * 2 *
1913  sizeof(ctxt->nameTab[0]));
1914  if (tmp == NULL) {
1915  goto mem_error;
1916  }
1917  ctxt->nameTab = tmp;
1918  ctxt->nameMax *= 2;
1919  }
1920  ctxt->nameTab[ctxt->nameNr] = value;
1921  ctxt->name = value;
1922  return (ctxt->nameNr++);
1923 mem_error:
1924  xmlErrMemory(ctxt, NULL);
1925  return (-1);
1926 }
const xmlChar * name
Definition: parser.h:229
smooth NULL
Definition: ftsmooth.c:416
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
const xmlChar ** nameTab
Definition: parser.h:232

Referenced by xmlParseElement().

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

1806 {
1807  xmlNodePtr ret;
1808 
1809  if (ctxt == NULL) return(NULL);
1810  if (ctxt->nodeNr <= 0)
1811  return (NULL);
1812  ctxt->nodeNr--;
1813  if (ctxt->nodeNr > 0)
1814  ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1];
1815  else
1816  ctxt->node = NULL;
1817  ret = ctxt->nodeTab[ctxt->nodeNr];
1818  ctxt->nodeTab[ctxt->nodeNr] = NULL;
1819  return (ret);
1820 }
xmlNodePtr * nodeTab
Definition: parser.h:208
smooth NULL
Definition: ftsmooth.c:416
xmlNodePtr node
Definition: parser.h:205
Definition: tree.h:489
int ret

Referenced by xmlParseElement(), 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 1767 of file parser.c.

1768 {
1769  if (ctxt == NULL) return(0);
1770  if (ctxt->nodeNr >= ctxt->nodeMax) {
1771  xmlNodePtr *tmp;
1772 
1773  tmp = (xmlNodePtr *) xmlRealloc(ctxt->nodeTab,
1774  ctxt->nodeMax * 2 *
1775  sizeof(ctxt->nodeTab[0]));
1776  if (tmp == NULL) {
1777  xmlErrMemory(ctxt, NULL);
1778  return (-1);
1779  }
1780  ctxt->nodeTab = tmp;
1781  ctxt->nodeMax *= 2;
1782  }
1783  if ((((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) &&
1784  ((ctxt->options & XML_PARSE_HUGE) == 0)) {
1785  xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR,
1786  "Excessive depth in document: %d use XML_PARSE_HUGE option\n",
1788  xmlHaltParser(ctxt);
1789  return(-1);
1790  }
1791  ctxt->nodeTab[ctxt->nodeNr] = value;
1792  ctxt->node = value;
1793  return (ctxt->nodeNr++);
1794 }
xmlNodePtr * nodeTab
Definition: parser.h:208
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
xmlNodePtr node
Definition: parser.h:205
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
unsigned int xmlParserMaxDepth
Definition: parser.c:242
Definition: tree.h:489
GLsizei const GLfloat * value
Definition: glext.h:6069
static void xmlHaltParser(xmlParserCtxtPtr ctxt)
Definition: parser.c:12449

Referenced by xmlParseBalancedChunkMemoryInternal(), xmlParseCtxtExternalEntity(), 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 1645 of file parser.c.

1646 {
1647  int i;
1648 
1649  if (ctxt->nsTab == NULL) return(0);
1650  if (ctxt->nsNr < nr) {
1651  xmlGenericError(xmlGenericErrorContext, "Pbm popping %d NS\n", nr);
1652  nr = ctxt->nsNr;
1653  }
1654  if (ctxt->nsNr <= 0)
1655  return (0);
1656 
1657  for (i = 0;i < nr;i++) {
1658  ctxt->nsNr--;
1659  ctxt->nsTab[ctxt->nsNr] = NULL;
1660  }
1661  return(nr);
1662 }
ULONG nr
Definition: thread.c:7
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
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
smooth NULL
Definition: ftsmooth.c:416
const xmlChar ** nsTab
Definition: parser.h:281
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlParseElement(), 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 1595 of file parser.c.

1596 {
1597  if (ctxt->options & XML_PARSE_NSCLEAN) {
1598  int i;
1599  for (i = ctxt->nsNr - 2;i >= 0;i -= 2) {
1600  if (ctxt->nsTab[i] == prefix) {
1601  /* in scope */
1602  if (ctxt->nsTab[i + 1] == URL)
1603  return(-2);
1604  /* out of scope keep it */
1605  break;
1606  }
1607  }
1608  }
1609  if ((ctxt->nsMax == 0) || (ctxt->nsTab == NULL)) {
1610  ctxt->nsMax = 10;
1611  ctxt->nsNr = 0;
1612  ctxt->nsTab = (const xmlChar **)
1613  xmlMalloc(ctxt->nsMax * sizeof(xmlChar *));
1614  if (ctxt->nsTab == NULL) {
1615  xmlErrMemory(ctxt, NULL);
1616  ctxt->nsMax = 0;
1617  return (-1);
1618  }
1619  } else if (ctxt->nsNr >= ctxt->nsMax) {
1620  const xmlChar ** tmp;
1621  ctxt->nsMax *= 2;
1622  tmp = (const xmlChar **) xmlRealloc((char *) ctxt->nsTab,
1623  ctxt->nsMax * sizeof(ctxt->nsTab[0]));
1624  if (tmp == NULL) {
1625  xmlErrMemory(ctxt, NULL);
1626  ctxt->nsMax /= 2;
1627  return (-1);
1628  }
1629  ctxt->nsTab = tmp;
1630  }
1631  ctxt->nsTab[ctxt->nsNr++] = prefix;
1632  ctxt->nsTab[ctxt->nsNr++] = URL;
1633  return (ctxt->nsNr);
1634 }
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
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
const xmlChar ** nsTab
Definition: parser.h:281

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

◆ spacePop()

static int spacePop ( xmlParserCtxtPtr  ctxt)
static

Definition at line 1971 of file parser.c.

1971  {
1972  int ret;
1973  if (ctxt->spaceNr <= 0) return(0);
1974  ctxt->spaceNr--;
1975  if (ctxt->spaceNr > 0)
1976  ctxt->space = &ctxt->spaceTab[ctxt->spaceNr - 1];
1977  else
1978  ctxt->space = &ctxt->spaceTab[0];
1979  ret = ctxt->spaceTab[ctxt->spaceNr];
1980  ctxt->spaceTab[ctxt->spaceNr] = -1;
1981  return(ret);
1982 }
int * spaceTab
Definition: parser.h:247
int ret
int * space
Definition: parser.h:244

Referenced by xmlParseElement(), and xmlParseEndTag2().

◆ spacePush()

static int spacePush ( xmlParserCtxtPtr  ctxt,
int  val 
)
static

Definition at line 1952 of file parser.c.

1952  {
1953  if (ctxt->spaceNr >= ctxt->spaceMax) {
1954  int *tmp;
1955 
1956  ctxt->spaceMax *= 2;
1957  tmp = (int *) xmlRealloc(ctxt->spaceTab,
1958  ctxt->spaceMax * sizeof(ctxt->spaceTab[0]));
1959  if (tmp == NULL) {
1960  xmlErrMemory(ctxt, NULL);
1961  ctxt->spaceMax /=2;
1962  return(-1);
1963  }
1964  ctxt->spaceTab = tmp;
1965  }
1966  ctxt->spaceTab[ctxt->spaceNr] = val;
1967  ctxt->space = &ctxt->spaceTab[ctxt->spaceNr];
1968  return(ctxt->spaceNr++);
1969 }
int * spaceTab
Definition: parser.h:247
int spaceMax
Definition: parser.h:246
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
GLuint GLfloat * val
Definition: glext.h:7180
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
int * space
Definition: parser.h:244

Referenced by xmlParseElement().

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

1209  {
1211  int len;
1212  const xmlChar *name;
1213  const xmlChar *prefix;
1214 
1215  /*
1216  * Allows to detect attribute redefinitions
1217  */
1218  if (ctxt->attsSpecial != NULL) {
1219  if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL)
1220  return;
1221  }
1222 
1223  if (ctxt->attsDefault == NULL) {
1224  ctxt->attsDefault = xmlHashCreateDict(10, ctxt->dict);
1225  if (ctxt->attsDefault == NULL)
1226  goto mem_error;
1227  }
1228 
1229  /*
1230  * split the element name into prefix:localname , the string found
1231  * are within the DTD and then not associated to namespace names.
1232  */
1233  name = xmlSplitQName3(fullname, &len);
1234  if (name == NULL) {
1235  name = xmlDictLookup(ctxt->dict, fullname, -1);
1236  prefix = NULL;
1237  } else {
1238  name = xmlDictLookup(ctxt->dict, name, -1);
1239  prefix = xmlDictLookup(ctxt->dict, fullname, len);
1240  }
1241 
1242  /*
1243  * make sure there is some storage
1244  */
1245  defaults = xmlHashLookup2(ctxt->attsDefault, name, prefix);
1246  if (defaults == NULL) {
1248  (4 * 5) * sizeof(const xmlChar *));
1249  if (defaults == NULL)
1250  goto mem_error;
1251  defaults->nbAttrs = 0;
1252  defaults->maxAttrs = 4;
1253  if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix,
1254  defaults, NULL) < 0) {
1255  xmlFree(defaults);
1256  goto mem_error;
1257  }
1258  } else if (defaults->nbAttrs >= defaults->maxAttrs) {
1260 
1262  (2 * defaults->maxAttrs * 5) * sizeof(const xmlChar *));
1263  if (temp == NULL)
1264  goto mem_error;
1265  defaults = temp;
1266  defaults->maxAttrs *= 2;
1267  if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix,
1268  defaults, NULL) < 0) {
1269  xmlFree(defaults);
1270  goto mem_error;
1271  }
1272  }
1273 
1274  /*
1275  * Split the element name into prefix:localname , the string found
1276  * are within the DTD and hen not associated to namespace names.
1277  */
1278  name = xmlSplitQName3(fullattr, &len);
1279  if (name == NULL) {
1280  name = xmlDictLookup(ctxt->dict, fullattr, -1);
1281  prefix = NULL;
1282  } else {
1283  name = xmlDictLookup(ctxt->dict, name, -1);
1284  prefix = xmlDictLookup(ctxt->dict, fullattr, len);
1285  }
1286 
1287  defaults->values[5 * defaults->nbAttrs] = name;
1288  defaults->values[5 * defaults->nbAttrs + 1] = prefix;
1289  /* intern the string and precompute the end */
1290  len = xmlStrlen(value);
1291  value = xmlDictLookup(ctxt->dict, value, len);
1292  defaults->values[5 * defaults->nbAttrs + 2] = value;
1293  defaults->values[5 * defaults->nbAttrs + 3] = value + len;
1294  if (ctxt->external)
1295  defaults->values[5 * defaults->nbAttrs + 4] = BAD_CAST "external";
1296  else
1297  defaults->values[5 * defaults->nbAttrs + 4] = NULL;
1298  defaults->nbAttrs++;
1299 
1300  return;
1301 
1302 mem_error:
1303  xmlErrMemory(ctxt, NULL);
1304  return;
1305 }
XMLPUBFUN const xmlChar *XMLCALL xmlSplitQName3(const xmlChar *name, int *len)
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:422
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
int external
Definition: parser.h:217
static const ASMPROP_RES defaults[ASM_NAME_MAX_PARAMS]
Definition: asmname.c:82
xmlHashTablePtr attsDefault
Definition: parser.h:284
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
xmlDictPtr dict
Definition: parser.h:263
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:858
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:443
static calc_node_t temp
Definition: rpn_ieee.c:38
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:208
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
xmlHashTablePtr attsSpecial
Definition: parser.h:285
Definition: name.c:36
xmlDefAttrs * xmlDefAttrsPtr
Definition: parser.c:1086
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 1317 of file parser.c.

1321 {
1322  if (ctxt->attsSpecial == NULL) {
1323  ctxt->attsSpecial = xmlHashCreateDict(10, ctxt->dict);
1324  if (ctxt->attsSpecial == NULL)
1325  goto mem_error;
1326  }
1327 
1328  if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL)
1329  return;
1330 
1331  xmlHashAddEntry2(ctxt->attsSpecial, fullname, fullattr,
1332  (void *) (ptrdiff_t) type);
1333  return;
1334 
1335 mem_error:
1336  xmlErrMemory(ctxt, NULL);
1337  return;
1338 }
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:404
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
smooth NULL
Definition: ftsmooth.c:416
xmlDictPtr dict
Definition: parser.h:263
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:208
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
xmlHashTablePtr attsSpecial
Definition: parser.h:285

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

1117 {
1118  if ((src == NULL) || (dst == NULL))
1119  return(NULL);
1120 
1121  while (*src == 0x20) src++;
1122  while (*src != 0) {
1123  if (*src == 0x20) {
1124  while (*src == 0x20) src++;
1125  if (*src != 0)
1126  *dst++ = 0x20;
1127  } else {
1128  *dst++ = *src++;
1129  }
1130  }
1131  *dst = 0;
1132  if (dst == src)
1133  return(NULL);
1134  return(dst);
1135 }
smooth NULL
Definition: ftsmooth.c:416
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

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

1150 {
1151  int i;
1152  int remove_head = 0;
1153  int need_realloc = 0;
1154  const xmlChar *cur;
1155 
1156  if ((ctxt == NULL) || (src == NULL) || (len == NULL))
1157  return(NULL);
1158  i = *len;
1159  if (i <= 0)
1160  return(NULL);
1161 
1162  cur = src;
1163  while (*cur == 0x20) {
1164  cur++;
1165  remove_head++;
1166  }
1167  while (*cur != 0) {
1168  if (*cur == 0x20) {
1169  cur++;
1170  if ((*cur == 0x20) || (*cur == 0)) {
1171  need_realloc = 1;
1172  break;
1173  }
1174  } else
1175  cur++;
1176  }
1177  if (need_realloc) {
1178  xmlChar *ret;
1179 
1180  ret = xmlStrndup(src + remove_head, i - remove_head + 1);
1181  if (ret == NULL) {
1182  xmlErrMemory(ctxt, NULL);
1183  return(NULL);
1184  }
1186  *len = (int) strlen((const char *)ret);
1187  return(ret);
1188  } else if (remove_head) {
1189  *len -= remove_head;
1190  memmove(src, src + remove_head, 1 + *len);
1191  return(src);
1192  }
1193  return(NULL);
1194 }
#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
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
smooth NULL
Definition: ftsmooth.c:416
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
static xmlChar * xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst)
Definition: parser.c:1116
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
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 sucessors 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 1438 of file parser.c.

1439 {
1440  const xmlChar *cur = lang, *nxt;
1441 
1442  if (cur == NULL)
1443  return (0);
1444  if (((cur[0] == 'i') && (cur[1] == '-')) ||
1445  ((cur[0] == 'I') && (cur[1] == '-')) ||
1446  ((cur[0] == 'x') && (cur[1] == '-')) ||
1447  ((cur[0] == 'X') && (cur[1] == '-'))) {
1448  /*
1449  * Still allow IANA code and user code which were coming
1450  * from the previous version of the XML-1.0 specification
1451  * it's deprecated but we should not fail
1452  */
1453  cur += 2;
1454  while (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
1455  ((cur[0] >= 'a') && (cur[0] <= 'z')))
1456  cur++;
1457  return(cur[0] == 0);
1458  }
1459  nxt = cur;
1460  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1461  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1462  nxt++;
1463  if (nxt - cur >= 4) {
1464  /*
1465  * Reserved
1466  */
1467  if ((nxt - cur > 8) || (nxt[0] != 0))
1468  return(0);
1469  return(1);
1470  }
1471  if (nxt - cur < 2)
1472  return(0);
1473  /* we got an ISO 639 code */
1474  if (nxt[0] == 0)
1475  return(1);
1476  if (nxt[0] != '-')
1477  return(0);
1478 
1479  nxt++;
1480  cur = nxt;
1481  /* now we can have extlang or script or region or variant */
1482  if ((nxt[0] >= '0') && (nxt[0] <= '9'))
1483  goto region_m49;
1484 
1485  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1486  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1487  nxt++;
1488  if (nxt - cur == 4)
1489  goto script;
1490  if (nxt - cur == 2)
1491  goto region;
1492  if ((nxt - cur >= 5) && (nxt - cur <= 8))
1493  goto variant;
1494  if (nxt - cur != 3)
1495  return(0);
1496  /* we parsed an extlang */
1497  if (nxt[0] == 0)
1498  return(1);
1499  if (nxt[0] != '-')
1500  return(0);
1501 
1502  nxt++;
1503  cur = nxt;
1504  /* now we can have script or region or variant */
1505  if ((nxt[0] >= '0') && (nxt[0] <= '9'))
1506  goto region_m49;
1507 
1508  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1509  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1510  nxt++;
1511  if (nxt - cur == 2)
1512  goto region;
1513  if ((nxt - cur >= 5) && (nxt - cur <= 8))
1514  goto variant;
1515  if (nxt - cur != 4)
1516  return(0);
1517  /* we parsed a script */
1518 script:
1519  if (nxt[0] == 0)
1520  return(1);
1521  if (nxt[0] != '-')
1522  return(0);
1523 
1524  nxt++;
1525  cur = nxt;
1526  /* now we can have region or variant */
1527  if ((nxt[0] >= '0') && (nxt[0] <= '9'))
1528  goto region_m49;
1529 
1530  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1531  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1532  nxt++;
1533 
1534  if ((nxt - cur >= 5) && (nxt - cur <= 8))
1535  goto variant;
1536  if (nxt - cur != 2)
1537  return(0);
1538  /* we parsed a region */
1539 region:
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 just have a variant */
1548  while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
1549  ((nxt[0] >= 'a') && (nxt[0] <= 'z')))
1550  nxt++;
1551 
1552  if ((nxt - cur < 5) || (nxt - cur > 8))
1553  return(0);
1554 
1555  /* we parsed a variant */
1556 variant:
1557  if (nxt[0] == 0)
1558  return(1);
1559  if (nxt[0] != '-')
1560  return(0);
1561  /* extensions and private use subtags not checked */
1562  return (1);
1563 
1564 region_m49:
1565  if (((nxt[1] >= '0') && (nxt[1] <= '9')) &&
1566  ((nxt[2] >= '0') && (nxt[2] <= '9'))) {
1567  nxt += 3;
1568  goto region;
1569  }
1570  return(0);
1571 }
smooth NULL
Definition: ftsmooth.c:416
script
Definition: msipriv.h:374
static const WCHAR lang[]
Definition: wbemdisp.c:287
unsigned char xmlChar
Definition: xmlstring.h:28

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

1366 {
1367  if (ctxt->attsSpecial == NULL)
1368  return;
1369 
1371 
1372  if (xmlHashSize(ctxt->attsSpecial) == 0) {
1373  xmlHashFree(ctxt->attsSpecial, NULL);
1374  ctxt->attsSpecial = NULL;
1375  }
1376  return;
1377 }
XMLPUBFUN int XMLCALL xmlHashSize(xmlHashTablePtr table)
Definition: hash.c:1032
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data)
Definition: hash.c:873
xmlHashTablePtr attsSpecial
Definition: parser.h:285
static void xmlCleanSpecialAttrCallback(void *payload, void *data, const xmlChar *fullname, const xmlChar *fullattr, const xmlChar *unused ATTRIBUTE_UNUSED)
Definition: parser.c:1346

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

1348  {
1350 
1351  if (((ptrdiff_t) payload) == XML_ATTRIBUTE_CDATA) {
1352  xmlHashRemoveEntry2(ctxt->attsSpecial, fullname, fullattr, NULL);
1353  }
1354 }
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f)
Definition: hash.c:1069
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
xmlHashTablePtr attsSpecial
Definition: parser.h:285
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 14764 of file parser.c.

14764  {
14765  if (!xmlParserInitialized)
14766  return;
14767 
14769 #ifdef LIBXML_CATALOG_ENABLED
14770  xmlCatalogCleanup();
14771 #endif
14772  xmlDictCleanup();
14774 #ifdef LIBXML_OUTPUT_ENABLED
14775  xmlCleanupOutputCallbacks();
14776 #endif
14777 #ifdef LIBXML_SCHEMAS_ENABLED
14778  xmlSchemaCleanupTypes();
14779  xmlRelaxNGCleanupTypes();
14780 #endif
14783  xmlCleanupThreads(); /* must be last if called not from the main thread */
14784  xmlCleanupMemory();
14786 }
XMLPUBFUN void XMLCALL xmlCleanupGlobals(void)
Definition: globals.c:58
XMLPUBFUN void XMLCALL xmlCleanupInputCallbacks(void)
XMLPUBFUN void XMLCALL xmlCleanupThreads(void)
Definition: threads.c:908
XMLPUBFUN void XMLCALL xmlCleanupCharEncodingHandlers(void)
Definition: encoding.c:1455
XMLPUBFUN void XMLCALL xmlCleanupMemory(void)
Definition: xmlmemory.c:1008
XMLPUBFUN void XMLCALL xmlResetLastError(void)
XMLPUBFUN void XMLCALL xmlDictCleanup(void)
Definition: dict.c:221
static int xmlParserInitialized
Definition: parser.c:14695

Referenced by DllMain(), and main().

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

14572  {
14573  int len;
14574 
14575  if (cur == NULL)
14576  return(NULL);
14577  len = xmlStrlen(cur);
14578  return(xmlCreateMemoryParserCtxt((const char *)cur, len));
14579 }
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:422
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size)
Definition: parser.c:14369

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

14058  {
14060 
14061 }
static xmlParserCtxtPtr xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID, const xmlChar *base, xmlParserCtxtPtr pctx)
Definition: parser.c:13988
smooth NULL
Definition: ftsmooth.c:416
#define ID
Definition: ruserpass.c:36

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

13989  {
13990  xmlParserCtxtPtr ctxt;
13991  xmlParserInputPtr inputStream;
13992  char *directory = NULL;
13993  xmlChar *uri;
13994 
13995  ctxt = xmlNewParserCtxt();
13996  if (ctxt == NULL) {
13997  return(NULL);
13998  }
13999 
14000  if (pctx != NULL) {
14001  ctxt->options = pctx->options;
14002  ctxt->_private = pctx->_private;
14003  /*
14004  * this is a subparser of pctx, so the input_id should be
14005  * incremented to distinguish from main entity
14006  */
14007  ctxt->input_id = pctx->input_id + 1;
14008  }
14009 
14010  uri = xmlBuildURI(URL, base);
14011 
14012  if (uri == NULL) {
14013  inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt);
14014  if (inputStream == NULL) {
14015  xmlFreeParserCtxt(ctxt);
14016  return(NULL);
14017  }
14018 
14019  inputPush(ctxt, inputStream);
14020 
14021  if ((ctxt->directory == NULL) && (directory == NULL))
14022  directory = xmlParserGetDirectory((char *)URL);
14023  if ((ctxt->directory == NULL) && (directory != NULL))
14024  ctxt->directory = directory;
14025  } else {
14026  inputStream = xmlLoadExternalEntity((char *)uri, (char *)ID, ctxt);
14027  if (inputStream == NULL) {
14028  xmlFree(uri);
14029  xmlFreeParserCtxt(ctxt);
14030  return(NULL);
14031  }
14032 
14033  inputPush(ctxt, inputStream);
14034 
14035  if ((ctxt->directory == NULL) && (directory == NULL))
14036  directory = xmlParserGetDirectory((char *)uri);
14037  if ((ctxt->directory == NULL) && (directory != NULL))
14038  ctxt->directory = directory;
14039  xmlFree(uri);
14040  }
14041  return(ctxt);
14042 }
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
const char * uri
Definition: sec_mgr.c:1594
XMLPUBFUN char *XMLCALL xmlParserGetDirectory(const char *filename)
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
int input_id
Definition: parser.h:312
XMLPUBFUN xmlChar *XMLCALL xmlBuildURI(const xmlChar *URI, const xmlChar *base)
Definition: uri.c:1882
smooth NULL
Definition: ftsmooth.c:416
void * _private
Definition: parser.h:256
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)
char * directory
Definition: parser.h:226
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)

Referenced by xmlCreateEntityParserCtxt(), xmlParseCtxtExternalEntity(), 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 14123 of file parser.c.

14124 {
14125  return(xmlCreateURLParserCtxt(filename, 0));
14126 }
const char * filename
Definition: ioapi.h:135
xmlParserCtxtPtr xmlCreateURLParserCtxt(const char *filename, int options)
Definition: parser.c:14081

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

12507  {
12508  xmlParserCtxtPtr ctxt;
12509  xmlParserInputPtr inputStream;
12511 
12512  if (ioread == NULL) return(NULL);
12513 
12514  buf = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, enc);
12515  if (buf == NULL) {
12516  if (ioclose != NULL)
12517  ioclose(ioctx);
12518  return (NULL);
12519  }
12520 
12521  ctxt = xmlNewParserCtxt();
12522  if (ctxt == NULL) {
12524  return(NULL);
12525  }
12526  if (sax != NULL) {
12527 #ifdef LIBXML_SAX1_ENABLED
12528  if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
12529 #endif /* LIBXML_SAX1_ENABLED */
12530  xmlFree(ctxt->sax);
12531  ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
12532  if (ctxt->sax == NULL) {
12533  xmlErrMemory(ctxt, NULL);
12534  xmlFreeParserCtxt(ctxt);
12535  return(NULL);
12536  }
12537  memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
12538  if (sax->initialized == XML_SAX2_MAGIC)
12539  memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
12540  else
12541  memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
12542  if (user_data != NULL)
12543  ctxt->userData = user_data;
12544  }
12545 
12546  inputStream = xmlNewIOInputStream(ctxt, buf, enc);
12547  if (inputStream == NULL) {
12548  xmlFreeParserCtxt(ctxt);
12549  return(NULL);
12550  }
12551  inputPush(ctxt, inputStream);
12552 
12553  return(ctxt);
12554 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define XML_SAX2_MAGIC
Definition: parser.h:671
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
static int sax
Definition: xmllint.c:198
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
smooth NULL
Definition: ftsmooth.c:416
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:185
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:186

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

14369  {
14370  xmlParserCtxtPtr ctxt;
14373 
14374  if (buffer == NULL)
14375  return(NULL);
14376  if (size <= 0)
14377  return(NULL);
14378 
14379  ctxt = xmlNewParserCtxt();
14380  if (ctxt == NULL)
14381  return(NULL);
14382 
14383  /* TODO: xmlParserInputBufferCreateStatic, requires some serious changes */
14385  if (buf == NULL) {
14386  xmlFreeParserCtxt(ctxt);
14387  return(NULL);
14388  }
14389 
14390  input = xmlNewInputStream(ctxt);
14391  if (input == NULL) {
14393  xmlFreeParserCtxt(ctxt);
14394  return(NULL);
14395  }
14396 
14397  input->filename = NULL;
14398  input->buf = buf;
14399  xmlBufResetInput(input->buf->buffer, input);
14400 
14401  inputPush(ctxt, input);
14402  return(ctxt);
14403 }
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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:1283
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc)
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum GLenum input
Definition: glext.h:9031
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 14081 of file parser.c.

14082 {
14083  xmlParserCtxtPtr ctxt;
14084  xmlParserInputPtr inputStream;
14085  char *directory = NULL;
14086 
14087  ctxt = xmlNewParserCtxt();
14088  if (ctxt == NULL) {
14089  xmlErrMemory(NULL, "cannot allocate parser context");
14090  return(NULL);
14091  }
14092 
14093  if (options)
14095  ctxt->linenumbers = 1;
14096 
14097  inputStream = xmlLoadExternalEntity(filename, NULL, ctxt);
14098  if (inputStream == NULL) {
14099  xmlFreeParserCtxt(ctxt);
14100  return(NULL);
14101  }
14102 
14103  inputPush(ctxt, inputStream);
14104  if ((ctxt->directory == NULL) && (directory == NULL))
14106  if ((ctxt->directory == NULL) && (directory != NULL))
14107  ctxt->directory = directory;
14108 
14109  return(ctxt);
14110 }
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
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:259
smooth NULL
Definition: ftsmooth.c:416
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding)
Definition: parser.c:15021
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBFUN xmlParserInputPtr XMLCALL xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
char * directory
Definition: parser.h:226
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)

Referenced by xmlCreateFileParserCtxt(), and xmlReadFile().

◆ xmlCtxtGrowAttrs()

static int xmlCtxtGrowAttrs ( xmlParserCtxtPtr  ctxt,
int  nr 
)
static

Definition at line 1666 of file parser.c.

1666  {
1667  const xmlChar **atts;
1668  int *attallocs;
1669  int maxatts;
1670 
1671  if (ctxt->atts == NULL) {
1672  maxatts = 55; /* allow for 10 attrs by default */
1673  atts = (const xmlChar **)
1674  xmlMalloc(maxatts * sizeof(xmlChar *));
1675  if (atts == NULL) goto mem_error;
1676  ctxt->atts = atts;
1677  attallocs = (int *) xmlMalloc((maxatts / 5) * sizeof(int));
1678  if (attallocs == NULL) goto mem_error;
1679  ctxt->attallocs = attallocs;
1680  ctxt->maxatts = maxatts;
1681  } else if (nr + 5 > ctxt->maxatts) {
1682  maxatts = (nr + 5) * 2;
1683  atts = (const xmlChar **) xmlRealloc((void *) ctxt->atts,
1684  maxatts * sizeof(const xmlChar *));
1685  if (atts == NULL) goto mem_error;
1686  ctxt->atts = atts;
1687  attallocs = (int *) xmlRealloc((void *) ctxt->attallocs,
1688  (maxatts / 5) * sizeof(int));
1689  if (attallocs == NULL) goto mem_error;
1690  ctxt->attallocs = attallocs;
1691  ctxt->maxatts = maxatts;
1692  }
1693  return(ctxt->maxatts);
1694 mem_error:
1695  xmlErrMemory(ctxt, NULL);
1696  return(-1);
1697 }
int * attallocs
Definition: parser.h:282
ULONG nr
Definition: thread.c:7
smooth NULL
Definition: ftsmooth.c:416
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:264
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
_In_ uint16_t _Out_ ULONG * atts
Definition: btrfs_drv.h:1065
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 15389 of file parser.c.

15391 {
15393 
15394  if (cur == NULL)
15395  return (NULL);
15396  if (ctxt == NULL)
15397  return (NULL);
15398  xmlInitParser();
15399 
15400  xmlCtxtReset(ctxt);
15401 
15402  stream = xmlNewStringInputStream(ctxt, cur);
15403  if (stream == NULL) {
15404  return (NULL);
15405  }
15406  inputPush(ctxt, stream);
15407  return (xmlDoRead(ctxt, URL, encoding, options, 1));
15408 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15180
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14813
void xmlInitParser(void)
Definition: parser.c:14706
smooth NULL
Definition: ftsmooth.c:416
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
ed encoding
Definition: write.c:2839

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

15506 {
15509 
15510  if (fd < 0)
15511  return (NULL);
15512  if (ctxt == NULL)
15513  return (NULL);
15514  xmlInitParser();
15515 
15516  xmlCtxtReset(ctxt);
15517 
15518 
15520  if (input == NULL)
15521  return (NULL);
15522  input->closecallback = NULL;
15524  if (stream == NULL) {
15526  return (NULL);
15527  }
15528  inputPush(ctxt, stream);
15529  return (xmlDoRead(ctxt, URL, encoding, options, 1));
15530 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15180
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
static int fd
Definition: io.c:51
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14813
void xmlInitParser(void)
Definition: parser.c:14706
smooth NULL
Definition: ftsmooth.c:416
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
ed encoding
Definition: write.c:2839
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc)
GLenum GLenum GLenum input
Definition: glext.h:9031

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

15425 {
15427 
15428  if (filename == NULL)
15429  return (NULL);
15430  if (ctxt == NULL)
15431  return (NULL);
15432  xmlInitParser();
15433 
15434  xmlCtxtReset(ctxt);
15435 
15437  if (stream == NULL) {
15438  return (NULL);
15439  }
15440  inputPush(ctxt, stream);
15441  return (xmlDoRead(ctxt, NULL, encoding, options, 1));
15442 }
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15180
const char * filename
Definition: ioapi.h:135
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14813
void xmlInitParser(void)
Definition: parser.c:14706
smooth NULL
Definition: ftsmooth.c:416
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:2839

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

15552 {
15555 
15556  if (ioread == NULL)
15557  return (NULL);
15558  if (ctxt == NULL)
15559  return (NULL);
15560  xmlInitParser();
15561 
15562  xmlCtxtReset(ctxt);
15563 
15564  input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
15566  if (input == NULL) {
15567  if (ioclose != NULL)
15568  ioclose(ioctx);
15569  return (NULL);
15570  }
15572  if (stream == NULL) {
15574  return (NULL);
15575  }
15576  inputPush(ctxt, stream);
15577  return (xmlDoRead(ctxt, URL, encoding, options, 1));
15578 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15180
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14813
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
void xmlInitParser(void)
Definition: parser.c:14706
smooth NULL
Definition: ftsmooth.c:416
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
ed encoding
Definition: write.c:2839
GLenum GLenum GLenum input
Definition: glext.h:9031

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

15461 {
15464 
15465  if (ctxt == NULL)
15466  return (NULL);
15467  if (buffer == NULL)
15468  return (NULL);
15469  xmlInitParser();
15470 
15471  xmlCtxtReset(ctxt);
15472 
15474  if (input == NULL) {
15475  return(NULL);
15476  }
15477 
15479  if (stream == NULL) {
15481  return(NULL);
15482  }
15483 
15484  inputPush(ctxt, stream);
15485  return (xmlDoRead(ctxt, URL, encoding, options, 1));
15486 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
Definition: parser.c:15180
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
GLuint buffer
Definition: glext.h:5915
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14813
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc)
void xmlInitParser(void)
Definition: parser.c:14706
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
ed encoding
Definition: write.c:2839
GLenum GLenum GLenum input
Definition: glext.h:9031

Referenced by parseAndPrintFile().

◆ xmlCtxtReset()

void xmlCtxtReset ( xmlParserCtxtPtr  ctxt)

xmlCtxtReset: @ctxt: an XML parser context

Reset a parser context

Definition at line 14813 of file parser.c.

14814 {
14816  xmlDictPtr dict;
14817 
14818  if (ctxt == NULL)
14819  return;
14820 
14821  dict = ctxt->dict;
14822 
14823  while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
14825  }
14826  ctxt->inputNr = 0;
14827  ctxt->input = NULL;
14828 
14829  ctxt->spaceNr = 0;
14830  if (ctxt->spaceTab != NULL) {
14831  ctxt->spaceTab[0] = -1;
14832  ctxt->space = &ctxt->spaceTab[0];
14833  } else {
14834  ctxt->space = NULL;
14835  }
14836 
14837 
14838  ctxt->nodeNr = 0;
14839  ctxt->node = NULL;
14840 
14841  ctxt->nameNr = 0;
14842  ctxt->name = NULL;
14843 
14844  DICT_FREE(ctxt->version);
14845  ctxt->version = NULL;
14846  DICT_FREE(ctxt->encoding);
14847  ctxt->encoding = NULL;
14848  DICT_FREE(ctxt->directory);
14849  ctxt->directory = NULL;
14850  DICT_FREE(ctxt->extSubURI);
14851  ctxt->extSubURI = NULL;
14852  DICT_FREE(ctxt->extSubSystem);
14853  ctxt->extSubSystem = NULL;
14854  if (ctxt->myDoc != NULL)
14855  xmlFreeDoc(ctxt->myDoc);
14856  ctxt->myDoc = NULL;
14857 
14858  ctxt->standalone = -1;
14859  ctxt->hasExternalSubset = 0;
14860  ctxt->hasPErefs = 0;
14861  ctxt->html = 0;
14862  ctxt->external = 0;
14863  ctxt->instate = XML_PARSER_START;
14864  ctxt->token = 0;
14865 
14866  ctxt->wellFormed = 1;
14867  ctxt->nsWellFormed = 1;
14868  ctxt->disableSAX = 0;
14869  ctxt->valid = 1;
14870 #if 0
14871  ctxt->vctxt.userData = ctxt;
14874 #endif
14875  ctxt->record_info = 0;
14876  ctxt->nbChars = 0;
14877  ctxt->checkIndex = 0;
14878  ctxt->inSubset = 0;
14879  ctxt->errNo = XML_ERR_OK;
14880  ctxt->depth = 0;
14882  ctxt->catalogs = NULL;
14883  ctxt->nbentities = 0;
14884  ctxt->sizeentities = 0;
14885  ctxt->sizeentcopy = 0;
14886  xmlInitNodeInfoSeq(&ctxt->node_seq);
14887 
14888  if (ctxt->attsDefault != NULL) {
14890  ctxt->attsDefault = NULL;
14891  }
14892  if (ctxt->attsSpecial != NULL) {
14893  xmlHashFree(ctxt->attsSpecial, NULL);
14894  ctxt->attsSpecial = NULL;
14895  }
14896 
14897 #ifdef LIBXML_CATALOG_ENABLED
14898  if (ctxt->catalogs != NULL)
14899  xmlCatalogFreeLocal(ctxt->catalogs);
14900 #endif
14901  if (ctxt->lastError.code != XML_ERR_OK)
14902  xmlResetError(&ctxt->lastError);
14903 }
xmlParserInputState instate
Definition: parser.h:223
unsigned long sizeentities
Definition: parser.h:304
int * spaceTab
Definition: parser.h:247
xmlChar * extSubURI
Definition: parser.h:240
long checkIndex
Definition: parser.h:235
int nsWellFormed
Definition: parser.h:286
xmlValidityErrorFunc error
Definition: valid.h:84
int external
Definition: parser.h:217
long nbChars
Definition: parser.h:234
const xmlChar * name
Definition: parser.h:229
xmlParserInputPtr input
Definition: parser.h:199
int disableSAX
Definition: parser.h:237
xmlError lastError
Definition: parser.h:301
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
int standalone
Definition: parser.h:192
xmlHashTablePtr attsDefault
Definition: parser.h:284
smooth NULL
Definition: ftsmooth.c:416
xmlChar * extSubSystem
Definition: parser.h:241
XMLPUBFUN void XMLCALL xmlFreeInputStream(xmlParserInputPtr input)
xmlDictPtr dict
Definition: parser.h:263
#define DICT_FREE(str)
Definition: parser.c:14801
XMLPUBFUN void XMLCALL xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
int wellFormed
Definition: parser.h:188
xmlNodePtr node
Definition: parser.h:205
int record_info
Definition: parser.h:210
int hasPErefs
Definition: parser.h:216
xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1740
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
xmlDocPtr myDoc
Definition: parser.h:187
const xmlChar * encoding
Definition: parser.h:191
const xmlChar * version
Definition: parser.h:190
void * catalogs
Definition: parser.h:260
int hasExternalSubset
Definition: parser.h:215
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:313
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
GLenum GLenum GLenum input
Definition: glext.h:9031
int inSubset
Definition: parser.h:238
xmlHashTablePtr attsSpecial
Definition: parser.h:285
char * directory
Definition: parser.h:226
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:221
int * space
Definition: parser.h:244
xmlValidityWarningFunc warning
Definition: valid.h:85
xmlParserNodeInfoSeq node_seq
Definition: parser.h:211
XMLPUBFUN void XMLCALL xmlHashDefaultDeallocator(void *entry, const xmlChar *name)
unsigned long nbentities
Definition: parser.h:303

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

14920 {
14921  xmlParserInputPtr inputStream;
14924 
14925  if (ctxt == NULL)
14926  return(1);
14927 
14928  if ((encoding == NULL) && (chunk != NULL) && (size >= 4))
14929  enc = xmlDetectCharEncoding((const xmlChar *) chunk, size);
14930 
14932  if (buf == NULL)
14933  return(1);
14934 
14935  if (ctxt == NULL) {
14937  return(1);
14938  }
14939 
14940  xmlCtxtReset(ctxt);
14941 
14942  if (ctxt->pushTab == NULL) {
14943  ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 *
14944  sizeof(xmlChar *));
14945  if (ctxt->pushTab == NULL) {
14946  xmlErrMemory(ctxt, NULL);
14948  return(1);
14949  }
14950  }
14951 
14952  if (filename == NULL) {
14953  ctxt->directory = NULL;
14954  } else {
14956  }
14957 
14958  inputStream = xmlNewInputStream(ctxt);
14959  if (inputStream == NULL) {
14961  return(1);
14962  }
14963 
14964  if (filename == NULL)
14965  inputStream->filename = NULL;
14966  else
14967  inputStream->filename = (char *)
14968  xmlCanonicPath((const xmlChar *) filename);
14969  inputStream->buf = buf;
14970  xmlBufResetInput(buf->buffer, inputStream);
14971 
14972  inputPush(ctxt, inputStream);
14973 
14974  if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
14975  (ctxt->input->buf != NULL)) {
14976  size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input);
14977  size_t cur = ctxt->input->cur - ctxt->input->base;
14978 
14980 
14981  xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur);
14982 #ifdef DEBUG_PUSH
14983  xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
14984 #endif
14985  }
14986 
14987  if (encoding != NULL) {
14989 
14990  if (ctxt->encoding != NULL)
14991  xmlFree((xmlChar *) ctxt->encoding);
14992  ctxt->encoding = xmlStrdup((const xmlChar *) encoding);
14993 
14995  if (hdlr != NULL) {
14996  xmlSwitchToEncoding(ctxt, hdlr);
14997  } else {
14998  xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
14999  "Unsupported encoding %s\n", BAD_CAST encoding);
15000  }
15001  } else if (enc != XML_CHAR_ENCODING_NONE) {
15002  xmlSwitchEncoding(ctxt, enc);
15003  }
15004 
15005  return(0);
15006 }
XMLPUBFUN int XMLCALL xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, size_t base, size_t cur)
Definition: buf.c:1333
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1709
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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:1283
const char * filename
Definition: ioapi.h:135
const xmlChar * base
Definition: parser.h:60
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
Definition: parser.c:14813
xmlParserInputPtr input
Definition: parser.h:199
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlChar *XMLCALL xmlCanonicPath(const xmlChar *path)
Definition: uri.c:2370
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlAllocParserInputBuffer(xmlCharEncoding enc)
#define BAD_CAST
Definition: xmlstring.h:35
void ** pushTab
Definition: parser.h:283
GLsizeiptr size
Definition: glext.h:5919
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
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:932
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input)
Definition: buf.c:1302
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1641
const xmlChar * encoding
Definition: parser.h:191
unsigned char xmlChar
Definition: xmlstring.h:28
ed encoding
Definition: write.c:2839
xmlParserInputBufferPtr buf
Definition: parser.h:56
const char * filename
Definition: parser.h:58
XMLPUBFUN int XMLCALL xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
char * directory
Definition: parser.h:226
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 15162 of file parser.c.

15163 {
15164  return(xmlCtxtUseOptionsInternal(ctxt, options, NULL));
15165 }
smooth NULL
Definition: ftsmooth.c:416
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding)
Definition: parser.c:15021

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

15022 {
15023  if (ctxt == NULL)
15024  return(-1);
15025  if (encoding != NULL) {
15026  if (ctxt->encoding != NULL)
15027  xmlFree((xmlChar *) ctxt->encoding);
15028  ctxt->encoding = xmlStrdup((const xmlChar *) encoding);
15029  }
15030  if (options & XML_PARSE_RECOVER) {
15031  ctxt->recovery = 1;
15033  ctxt->options |= XML_PARSE_RECOVER;
15034  } else
15035  ctxt->recovery = 0;
15036  if (options & XML_PARSE_DTDLOAD) {
15037  ctxt->loadsubset = XML_DETECT_IDS;
15039  ctxt->options |= XML_PARSE_DTDLOAD;
15040  } else
15041  ctxt->loadsubset = 0;
15042  if (options & XML_PARSE_DTDATTR) {
15043  ctxt->loadsubset |= XML_COMPLETE_ATTRS;
15045  ctxt->options |= XML_PARSE_DTDATTR;
15046  }
15047  if (options & XML_PARSE_NOENT) {
15048  ctxt->replaceEntities = 1;
15049  /* ctxt->loadsubset |= XML_DETECT_IDS; */
15051  ctxt->options |= XML_PARSE_NOENT;
15052  } else
15053  ctxt->replaceEntities = 0;
15054  if (options & XML_PARSE_PEDANTIC) {
15055  ctxt->pedantic = 1;
15057  ctxt->options |= XML_PARSE_PEDANTIC;
15058  } else
15059  ctxt->pedantic = 0;
15060  if (options & XML_PARSE_NOBLANKS) {
15061  ctxt->keepBlanks = 0;
15062  ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
15064  ctxt->options |= XML_PARSE_NOBLANKS;
15065  } else
15066  ctxt->keepBlanks = 1;
15067  if (options & XML_PARSE_DTDVALID) {
15068  ctxt->validate = 1;
15070  ctxt->vctxt.warning = NULL;
15071  if (options & XML_PARSE_NOERROR)
15072  ctxt->vctxt.error = NULL;
15074  ctxt->options |= XML_PARSE_DTDVALID;
15075  } else
15076  ctxt->validate = 0;
15077  if (options & XML_PARSE_NOWARNING) {
15078  ctxt->sax->warning = NULL;
15080  }
15081  if (options & XML_PARSE_NOERROR) {
15082  ctxt->sax->error = NULL;
15083  ctxt->sax->fatalError = NULL;
15085  }
15086 #ifdef LIBXML_SAX1_ENABLED
15087  if (options & XML_PARSE_SAX1) {
15088  ctxt->sax->startElement = xmlSAX2StartElement;
15089  ctxt->sax->endElement = xmlSAX2EndElement;
15090  ctxt->sax->startElementNs = NULL;
15091  ctxt->sax->endElementNs = NULL;
15092  ctxt->sax->initialized = 1;
15094  ctxt->options |= XML_PARSE_SAX1;
15095  }
15096 #endif /* LIBXML_SAX1_ENABLED */
15097  if (options & XML_PARSE_NODICT) {
15098  ctxt->dictNames = 0;
15100  ctxt->options |= XML_PARSE_NODICT;
15101  } else {
15102  ctxt->dictNames = 1;
15103  }
15104  if (options & XML_PARSE_NOCDATA) {
15105  ctxt->sax->cdataBlock = NULL;
15107  ctxt->options |= XML_PARSE_NOCDATA;
15108  }
15109  if (options & XML_PARSE_NSCLEAN) {
15110  ctxt->options |= XML_PARSE_NSCLEAN;
15112  }
15113  if (options & XML_PARSE_NONET) {
15114  ctxt->options |= XML_PARSE_NONET;
15116  }
15117  if (options & XML_PARSE_COMPACT) {
15118  ctxt->options |= XML_PARSE_COMPACT;
15120  }
15121  if (options & XML_PARSE_OLD10) {
15122  ctxt->options |= XML_PARSE_OLD10;
15124  }
15125  if (options & XML_PARSE_NOBASEFIX) {
15126  ctxt->options |= XML_PARSE_NOBASEFIX;
15128  }
15129  if (options & XML_PARSE_HUGE) {
15130  ctxt->options |= XML_PARSE_HUGE;
15132  if (ctxt->dict != NULL)
15133  xmlDictSetLimit(ctxt->dict, 0);
15134  }
15135  if (options & XML_PARSE_OLDSAX) {
15136  ctxt->options |= XML_PARSE_OLDSAX;
15138  }
15139  if (options & XML_PARSE_IGNORE_ENC) {
15140  ctxt->options |= XML_PARSE_IGNORE_ENC;
15142  }
15143  if (options & XML_PARSE_BIG_LINES) {
15144  ctxt->options |= XML_PARSE_BIG_LINES;
15146  }
15147  ctxt->linenumbers = 1;
15148  return (options);
15149 }
#define XML_DETECT_IDS
Definition: parser.h:139
int pedantic
Definition: parser.h:255
XMLPUBFUN size_t XMLCALL xmlDictSetLimit(xmlDictPtr dict, size_t limit)
Definition: dict.c:1256
xmlValidityErrorFunc error
Definition: valid.h:84
int recovery
Definition: parser.h:261
int linenumbers
Definition: parser.h:259
int replaceEntities
Definition: parser.h:189
smooth NULL
Definition: ftsmooth.c:416
xmlDictPtr dict
Definition: parser.h:263
int validate
Definition: parser.h:220
XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace(void *ctx, const xmlChar *ch, int len)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
const xmlChar * encoding
Definition: parser.h:191
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:185
int loadsubset
Definition: parser.h:258
int dictNames
Definition: parser.h:292
ed encoding
Definition: write.c:2839
#define XML_COMPLETE_ATTRS
Definition: parser.h:148
int keepBlanks
Definition: parser.h:236
xmlValidCtxt vctxt
Definition: parser.h:221
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 intialization

Definition at line 1066 of file parser.c.

1066  {
1067  if (ctxt == NULL) return;
1068 #ifdef LIBXML_SAX1_ENABLED
1069  if ((ctxt->sax) && (ctxt->sax->initialized == XML_SAX2_MAGIC) &&
1070  ((ctxt->sax->startElementNs != NULL) ||
1071  (ctxt->sax->endElementNs != NULL))) ctxt->sax2 = 1;
1072 #else
1073  ctxt->sax2 = 1;
1074 #endif /* LIBXML_SAX1_ENABLED */
1075 
1076  ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3);
1077  ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5);
1078  ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
1079  if ((ctxt->str_xml==NULL) || (ctxt->str_xmlns==NULL) ||
1080  (ctxt->str_xml_ns == NULL)) {
1081  xmlErrMemory(ctxt, NULL);
1082  }
1083 }
#define XML_SAX2_MAGIC
Definition: parser.h:671
const xmlChar * str_xmlns
Definition: parser.h:272
const xmlChar * str_xml
Definition: parser.h:271
smooth NULL
Definition: ftsmooth.c:416
#define XML_XML_NAMESPACE
Definition: tree.h:140
#define BAD_CAST
Definition: xmlstring.h:35
xmlDictPtr dict
Definition: parser.h:263
const xmlChar * str_xml_ns
Definition: parser.h:273
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
struct _xmlSAXHandler * sax
Definition: parser.h:185

Referenced by xmlParseBalancedChunkMemoryInternal(), xmlParseCtxtExternalEntity(), 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 15180 of file parser.c.

15182 {
15183  xmlDocPtr ret;
15184 
15186  if (encoding != NULL) {
15188 
15190  if (hdlr != NULL)
15191  xmlSwitchToEncoding(ctxt, hdlr);
15192  }
15193  if ((URL != NULL) && (ctxt->input != NULL) &&
15194  (ctxt->input->filename == NULL))
15195  ctxt->input->filename = (char *) xmlStrdup((const xmlChar *) URL);
15196  xmlParseDocument(ctxt);
15197  if ((ctxt->wellFormed) || ctxt->recovery)
15198  ret = ctxt->myDoc;
15199  else {
15200  ret = NULL;
15201  if (ctxt->myDoc != NULL) {
15202  xmlFreeDoc(ctxt->myDoc);
15203  }
15204  }
15205  ctxt->myDoc = NULL;
15206  if (!reuse) {
15207  xmlFreeParserCtxt(ctxt);
15208  }
15209 
15210  return (ret);
15211 }
XMLPUBFUN int XMLCALL xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
int xmlParseDocument(xmlParserCtxtPtr ctxt)
Definition: parser.c:10579
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
xmlParserInputPtr input
Definition: parser.h:199
int recovery
Definition: parser.h:261
smooth NULL
Definition: ftsmooth.c:416
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding)
Definition: parser.c:15021
int wellFormed
Definition: parser.h:188
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
int ret
xmlDocPtr myDoc
Definition: parser.h:187
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1641
unsigned char xmlChar
Definition: xmlstring.h:28
ed encoding
Definition: write.c:2839
const char * filename
Definition: parser.h:58
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 314 of file parser.c.

316 {
317  if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
318  (ctxt->instate == XML_PARSER_EOF))
319  return;
320  if (ctxt != NULL)
322 
323  if (prefix == NULL)
324  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
326  (const char *) localname, NULL, NULL, 0, 0,
327  "Attribute %s redefined\n", localname);
328  else
329  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
331  (const char *) prefix, (const char *) localname,
332  NULL, 0, 0, "Attribute %s:%s redefined\n", prefix,
333  localname);
334  if (ctxt != NULL) {
335  ctxt->wellFormed = 0;
336  if (ctxt->recovery == 0)
337  ctxt->disableSAX = 1;
338  }
339 }
xmlParserInputState instate
Definition: parser.h:223
int disableSAX
Definition: parser.h:237
int recovery
Definition: parser.h:261
smooth NULL
Definition: ftsmooth.c:416
int wellFormed
Definition: parser.h:188

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

351 {
352  const char *errmsg;
353 
354  if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
355  (ctxt->instate == XML_PARSER_EOF))
356  return;
357  switch (error) {
359  errmsg = "CharRef: invalid hexadecimal value";
360  break;
362  errmsg = "CharRef: invalid decimal value";
363  break;
365  errmsg = "CharRef: invalid value";
366  break;
368  errmsg = "internal error";
369  break;
371  errmsg = "PEReference at end of document";
372  break;
374  errmsg = "PEReference in prolog";
375  break;
377  errmsg = "PEReference in epilog";
378  break;
380  errmsg = "PEReference: no name";
381  break;
383  errmsg = "PEReference: expecting ';'";
384  break;
385  case XML_ERR_ENTITY_LOOP:
386  errmsg = "Detected an entity reference loop";
387  break;
389  errmsg = "EntityValue: \" or ' expected";
390  break;
392  errmsg = "PEReferences forbidden in internal subset";
393  break;
395  errmsg = "EntityValue: \" or ' expected";
396  break;
398  errmsg = "AttValue: \" or ' expected";
399  break;
401  errmsg = "Unescaped '<' not allowed in attributes values";
402  break;
404  errmsg = "SystemLiteral \" or ' expected";
405  break;
407  errmsg = "Unfinished System or Public ID \" or ' expected";
408  break;
410  errmsg = "Sequence ']]>' not allowed in content";
411  break;
413  errmsg = "SYSTEM or PUBLIC, the URI is missing";
414  break;
416  errmsg = "PUBLIC, the Public Identifier is missing";
417  break;
419  errmsg = "Comment must not contain '--' (double-hyphen)";
420  break;
422  errmsg = "xmlParsePI : no target name";
423  break;
425  errmsg = "Invalid PI name";
426  break;
428  errmsg = "NOTATION: Name expected here";
429  break;
431  errmsg = "'>' required to close NOTATION declaration";
432  break;
434  errmsg = "Entity value required";
435  break;
437  errmsg = "Fragment not allowed";
438  break;
440  errmsg = "'(' required to start ATTLIST enumeration";
441  break;
443  errmsg = "NmToken expected in ATTLIST enumeration";
444  break;
446  errmsg = "')' required to finish ATTLIST enumeration";
447  break;
449  errmsg = "MixedContentDecl : '|' or ')*' expected";
450  break;
452  errmsg = "MixedContentDecl : '#PCDATA' expected";
453  break;
455  errmsg = "ContentDecl : Name or '(' expected";
456  break;
458  errmsg = "ContentDecl : ',' '|' or ')' expected";
459  break;
461  errmsg =
462  "PEReference: forbidden within markup decl in internal subset";
463  break;
464  case XML_ERR_GT_REQUIRED:
465  errmsg = "expected '>'";
466  break;
468  errmsg = "XML conditional section '[' expected";
469  break;
471  errmsg = "Content error in the external subset";
472  break;
474  errmsg =
475  "conditional section INCLUDE or IGNORE keyword expected";
476  break;
478  errmsg = "XML conditional section not closed";
479  break;
481  errmsg = "Text declaration '<?xml' required";
482  break;
484  errmsg = "parsing XML declaration: '?>' expected";
485  break;
487  errmsg = "external parsed entities cannot be standalone";
488  break;
490  errmsg = "EntityRef: expecting ';'";
491  break;
493  errmsg = "DOCTYPE improperly terminated";
494  break;
496  errmsg = "EndTag: '</' not found";
497  break;
499  errmsg = "expected '='";
500  break;
502  errmsg = "String not closed expecting \" or '";
503  break;
505  errmsg = "String not started expecting ' or \"";
506  break;
508  errmsg = "Invalid XML encoding name";
509  break;
511  errmsg = "standalone accepts only 'yes' or 'no'";
512  break;
514  errmsg = "Document is empty";
515  break;
517  errmsg = "Extra content at the end of the document";
518  break;
520  errmsg = "chunk is not well balanced";
521  break;
523  errmsg = "extra content at the end of well balanced chunk";
524  break;
526  errmsg = "Malformed declaration expecting version";
527  break;
529  errmsg = "Name too long use XML_PARSE_HUGE option";
530  break;
531 #if 0
532  case:
533  errmsg = "";
534  break;
535 #endif
536  default:
537  errmsg = "Unregistered error message";
538  }
539  if (ctxt != NULL)
540  ctxt->errNo = error;
541  if (info == NULL) {
542  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
543  XML_ERR_FATAL, NULL, 0, info, NULL, NULL, 0, 0, "%s\n",
544  errmsg);
545  } else {
546  __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
547  XML_ERR_FATAL, NULL, 0, info, NULL, NULL, 0, 0, "%s: %s\n",
548  errmsg, info);
549  }
550  if (ctxt != NULL) {
551  ctxt->wellFormed = 0;
552  if (ctxt->recovery == 0)
553  ctxt->disableSAX = 1;
554  }
555 }
xmlParserInputState instate
Definition: parser.h:223
int disableSAX
Definition: parser.h:237
int recovery
Definition: parser.h:261
smooth NULL
Definition: ftsmooth.c:416
EXPORT int errmsg(char *msg, va_alist)
Definition: comerr.c:192
int wellFormed
Definition: parser.h:188
DWORD error
Definition: parser.c:105

Referenced by xmlGROW(), xmlLoadEntityContent(), xmlParseAttValueComplex(), xmlParseAttValueInternal(), xmlParseBalancedChunkMemoryInternal(), xmlParseCDSect(), xmlParseCharData(), xmlParseCharDataComplex(), xmlParseCharRef(), xmlParseCommentComplex(), xmlParseConditionalSections(), xmlParseContent(), xmlParseCtxtExternalEntity(), 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 8663 of file parser.c.

8663  {
8664  int i;
8665 
8666  if (prefix == ctxt->str_xml) return(ctxt->str_xml_ns);
8667  for (i = ctxt->nsNr - 2;i >= 0;i-=2)
8668  if (ctxt->nsTab[i] == prefix) {
8669  if ((prefix == NULL) && (*ctxt->nsTab[i + 1] == 0))
8670  return(NULL);
8671  return(ctxt->nsTab[i + 1]);
8672  }
8673  return(NULL);
8674 }
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
const xmlChar * str_xml
Definition: parser.h:271
smooth NULL
Definition: ftsmooth.c:416
const xmlChar * str_xml_ns
Definition: parser.h:273
const xmlChar ** nsTab
Definition: parser.h:281

Referenced by xmlParseInNodeContext(), and xmlParseStartTag2().

◆ xmlGROW()

static void xmlGROW ( xmlParserCtxtPtr  ctxt)
static

Definition at line 2077 of file parser.c.

2077  {
2078  unsigned long curEnd = ctxt->input->end - ctxt->input->cur;
2079  unsigned long curBase = ctxt->input->cur - ctxt->input->base;
2080 
2081  if (((curEnd > (unsigned long) XML_MAX_LOOKUP_LIMIT) ||
2082  (curBase > (unsigned long) XML_MAX_LOOKUP_LIMIT)) &&
2083  ((ctxt->input->buf) &&
2085  ((ctxt->options & XML_PARSE_HUGE) == 0)) {
2086  xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup");
2087  xmlHaltParser(ctxt);
2088  return;
2089  }
2091  if ((ctxt->input->cur > ctxt->input->end) ||
2092  (ctxt->input->cur < ctxt->input->base)) {
2093  xmlHaltParser(ctxt);
2094  xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "cur index out of bound");
2095  return;
2096  }
2097  if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0))
2099 }
static void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
Definition: parser.c:350
#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:199
smooth NULL
Definition: ftsmooth.c:416
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
static void xmlHaltParser(xmlParserCtxtPtr ctxt)
Definition: parser.c:12449
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 12449 of file parser.c.

12449  {
12450  if (ctxt == NULL)
12451  return;
12452  ctxt->instate = XML_PARSER_EOF;
12453  ctxt->disableSAX = 1;
12454  while (ctxt->inputNr > 1)
12456  if (ctxt->input != NULL) {
12457  /*
12458  * in case there was a specific allocation deallocate before
12459  * overriding base
12460  */
12461  if (ctxt->input->free != NULL) {
12462  ctxt->input->free((xmlChar *) ctxt->input->base);
12463  ctxt->input->free = NULL;
12464  }
12465  if (ctxt->input->buf != NULL) {
12467  ctxt->input->buf = NULL;
12468  }
12469  ctxt->input->cur = BAD_CAST"";
12470  ctxt->input->length = 0;
12471  ctxt->input->base = ctxt->input->cur;
12472  ctxt->input->end = ctxt->input->cur;
12473  }
12474 }
xmlParserInputState instate
Definition: parser.h:223
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
const xmlChar * cur
Definition: parser.h:61
xmlParserInputDeallocate free
Definition: parser.h:72
const xmlChar * base
Definition: parser.h:60
xmlParserInputPtr input
Definition: parser.h:199
int disableSAX
Definition: parser.h:237
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlFreeInputStream(xmlParserInputPtr input)
#define BAD_CAST
Definition: xmlstring.h:35
xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt)
Definition: parser.c:1740
unsigned char xmlChar
Definition: xmlstring.h:28
xmlParserInputBufferPtr buf
Definition: parser.h:56
const xmlChar * end
Definition: parser.h:62

Referenced by nodePush(), xmlGROW(), xmlParseConditionalSections(), xmlParseContent(), xmlParseElement(), xmlParseEntityDecl(), xmlParseExternalSubset(), and xmlStopParser().

◆ xmlHasFeature()

int xmlHasFeature ( xmlFeature  feature)

xmlHasFeature: @feature: the feature to be examined

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

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

Definition at line 846 of file parser.c.

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