parserInternals

Name

parserInternals -- 

Synopsis



#define     XML_MAX_NAMELEN
#define     INPUT_CHUNK
#define     IS_CHAR                         (c)
#define     IS_BLANK                        (c)
#define     IS_BASECHAR                     (c)
#define     IS_DIGIT                        (c)
#define     IS_COMBINING                    (c)
#define     IS_EXTENDER                     (c)
#define     IS_IDEOGRAPHIC                  (c)
#define     IS_LETTER                       (c)
#define     IS_PUBIDCHAR                    (c)
#define     SKIP_EOL                        (p)
#define     MOVETO_ENDTAG                   (p)
#define     MOVETO_STARTTAG                 (p)
int         xmlIsBaseChar                   (int c);
int         xmlIsBlank                      (int c);
int         xmlIsPubidChar                  (int c);
int         xmlIsLetter                     (int c);
int         xmlIsDigit                      (int c);
int         xmlIsIdeographic                (int c);
int         xmlIsExtender                   (int c);
int         xmlIsCombining                  (int c);
int         xmlIsChar                       (int c);
xmlParserCtxtPtr xmlCreateFileParserCtxt    (const char *filename);
xmlParserCtxtPtr xmlCreateMemoryParserCtxt  (const char *buffer,
                                             int size);
xmlParserCtxtPtr xmlNewParserCtxt           (void);
xmlParserCtxtPtr xmlCreateEntityParserCtxt  (const xmlChar *URL,
                                             const xmlChar *ID,
                                             const xmlChar *base);
int         xmlSwitchEncoding               (xmlParserCtxtPtr ctxt,
                                             xmlCharEncoding enc);
int         xmlSwitchToEncoding             (xmlParserCtxtPtr ctxt,
                                             xmlCharEncodingHandlerPtr handler);
void        xmlHandleEntity                 (xmlParserCtxtPtr ctxt,
                                             xmlEntityPtr entity);
xmlParserInputPtr xmlNewStringInputStream   (xmlParserCtxtPtr ctxt,
                                             const xmlChar *buffer);
xmlParserInputPtr xmlNewEntityInputStream   (xmlParserCtxtPtr ctxt,
                                             xmlEntityPtr entity);
void        xmlPushInput                    (xmlParserCtxtPtr ctxt,
                                             xmlParserInputPtr input);
xmlChar     xmlPopInput                     (xmlParserCtxtPtr ctxt);
void        xmlFreeInputStream              (xmlParserInputPtr input);
xmlParserInputPtr xmlNewInputFromFile       (xmlParserCtxtPtr ctxt,
                                             const char *filename);
xmlParserInputPtr xmlNewInputStream         (xmlParserCtxtPtr ctxt);
xmlChar*    xmlSplitQName                   (xmlParserCtxtPtr ctxt,
                                             const xmlChar *name,
                                             xmlChar **prefix);
xmlChar*    xmlNamespaceParseNCName         (xmlParserCtxtPtr ctxt);
xmlChar*    xmlNamespaceParseQName          (xmlParserCtxtPtr ctxt,
                                             xmlChar **prefix);
xmlChar*    xmlNamespaceParseNSDef          (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseQuotedString            (xmlParserCtxtPtr ctxt);
void        xmlParseNamespace               (xmlParserCtxtPtr ctxt);
xmlChar*    xmlScanName                     (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseName                    (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseNmtoken                 (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseEntityValue             (xmlParserCtxtPtr ctxt,
                                             xmlChar **orig);
xmlChar*    xmlParseAttValue                (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseSystemLiteral           (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParsePubidLiteral            (xmlParserCtxtPtr ctxt);
void        xmlParseCharData                (xmlParserCtxtPtr ctxt,
                                             int cdata);
xmlChar*    xmlParseExternalID              (xmlParserCtxtPtr ctxt,
                                             xmlChar **publicID,
                                             int strict);
void        xmlParseComment                 (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParsePITarget                (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,
                                             xmlParserInputPtr inputchk);
xmlElementContentPtr xmlParseElementChildrenContentD
                                            (xmlParserCtxtPtr ctxt);
xmlElementContentPtr xmlParseElementChildrenContentDecl
                                            (xmlParserCtxtPtr ctxt,
                                             xmlParserInputPtr inputchk);
int         xmlParseElementContentDecl      (xmlParserCtxtPtr ctxt,
                                             xmlChar *name,
                                             xmlElementContentPtr *result);
int         xmlParseElementDecl             (xmlParserCtxtPtr ctxt);
void        xmlParseMarkupDecl              (xmlParserCtxtPtr ctxt);
int         xmlParseCharRef                 (xmlParserCtxtPtr ctxt);
xmlEntityPtr xmlParseEntityRef              (xmlParserCtxtPtr ctxt);
void        xmlParseReference               (xmlParserCtxtPtr ctxt);
void        xmlParsePEReference             (xmlParserCtxtPtr ctxt);
void        xmlParseDocTypeDecl             (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseAttribute               (xmlParserCtxtPtr ctxt,
                                             xmlChar **value);
xmlChar*    xmlParseStartTag                (xmlParserCtxtPtr ctxt);
void        xmlParseEndTag                  (xmlParserCtxtPtr ctxt);
void        xmlParseCDSect                  (xmlParserCtxtPtr ctxt);
void        xmlParseContent                 (xmlParserCtxtPtr ctxt);
void        xmlParseElement                 (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseVersionNum              (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseVersionInfo             (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseEncName                 (xmlParserCtxtPtr ctxt);
xmlChar*    xmlParseEncodingDecl            (xmlParserCtxtPtr ctxt);
int         xmlParseSDDecl                  (xmlParserCtxtPtr ctxt);
void        xmlParseXMLDecl                 (xmlParserCtxtPtr ctxt);
void        xmlParseTextDecl                (xmlParserCtxtPtr ctxt);
void        xmlParseMisc                    (xmlParserCtxtPtr ctxt);
void        xmlParseExternalSubset          (xmlParserCtxtPtr ctxt,
                                             const xmlChar *ExternalID,
                                             const xmlChar *SystemID);
#define     XML_SUBSTITUTE_NONE
#define     XML_SUBSTITUTE_REF
#define     XML_SUBSTITUTE_PEREF
#define     XML_SUBSTITUTE_BOTH
xmlChar*    xmlDecodeEntities               (xmlParserCtxtPtr ctxt,
                                             int len,
                                             int what,
                                             xmlChar end,
                                             xmlChar end2,
                                             xmlChar end3);
xmlChar*    xmlStringDecodeEntities         (xmlParserCtxtPtr ctxt,
                                             const xmlChar *str,
                                             int what,
                                             xmlChar end,
                                             xmlChar end2,
                                             xmlChar end3);
int         nodePush                        (xmlParserCtxtPtr ctxt,
                                             xmlNodePtr value);
xmlNodePtr  nodePop                         (xmlParserCtxtPtr ctxt);
int         inputPush                       (xmlParserCtxtPtr ctxt,
                                             xmlParserInputPtr value);
xmlParserInputPtr inputPop                  (xmlParserCtxtPtr ctxt);
xmlChar*    namePop                         (xmlParserCtxtPtr ctxt);
int         namePush                        (xmlParserCtxtPtr ctxt,
                                             xmlChar *value);
int         xmlSkipBlankChars               (xmlParserCtxtPtr ctxt);
int         xmlStringCurrentChar            (xmlParserCtxtPtr ctxt,
                                             const xmlChar *cur,
                                             int *len);
void        xmlParserHandlePEReference      (xmlParserCtxtPtr ctxt);
void        xmlParserHandleReference        (xmlParserCtxtPtr ctxt);
int         xmlCheckLanguageID              (const xmlChar *lang);
int         xmlCurrentChar                  (xmlParserCtxtPtr ctxt,
                                             int *len);
int         xmlCopyCharMultiByte            (xmlChar *out,
                                             int val);
int         xmlCopyChar                     (int len,
                                             xmlChar *out,
                                             int val);
void        xmlNextChar                     (xmlParserCtxtPtr ctxt);
void        xmlParserInputShrink            (xmlParserInputPtr in);
void        htmlInitAutoClose               (void);
htmlParserCtxtPtr htmlCreateFileParserCtxt  (const char *filename,
                                             const char *encoding);
void        (*xmlEntityReferenceFunc)       (xmlEntityPtr ent,
                                             xmlNodePtr firstNode,
                                             xmlNodePtr lastNode);
void        xmlSetEntityReferenceFunc       (xmlEntityReferenceFunc func);

Description

Details

XML_MAX_NAMELEN

#define XML_MAX_NAMELEN 100

Identifiers can be longer, but this will be more costly at runtime.


INPUT_CHUNK

#define INPUT_CHUNK	250

The parser tries to always have that amount of input ready. One of the point is providing context when reporting errors.


IS_CHAR()

#define     IS_CHAR(c)

Macro to check the following production in the XML spec:

[2] Char ::= x9 | xA | xD | [x20-xD7FF] | [xE000-xFFFD] | [x10000-x10FFFF] any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.


IS_BLANK()

#define     IS_BLANK(c)

Macro to check the following production in the XML spec:

[3] S ::= (x20 | x9 | xD | xA)+


IS_BASECHAR()

#define IS_BASECHAR(c) xmlIsBaseChar(c)

Macro to check the following production in the XML spec:

[85] BaseChar ::= ... long list see REC ...


IS_DIGIT()

#define IS_DIGIT(c) xmlIsDigit(c)

Macro to check the following production in the XML spec:

[88] Digit ::= ... long list see REC ...


IS_COMBINING()

#define IS_COMBINING(c) xmlIsCombining(c)

Macro to check the following production in the XML spec:

[87] CombiningChar ::= ... long list see REC ...


IS_EXTENDER()

#define IS_EXTENDER(c) xmlIsExtender(c)

Macro to check the following production in the XML spec:

[89] Extender ::= x00B7 | x02D0 | x02D1 | x0387 | x0640 | x0E46 | x0EC6 | x3005 | [x3031-x3035] | [x309D-x309E] | [x30FC-x30FE]


IS_IDEOGRAPHIC()

#define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c)

Macro to check the following production in the XML spec:

[86] Ideographic ::= [x4E00-x9FA5] | x3007 | [x3021-x3029]


IS_LETTER()

#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))

Macro to check the following production in the XML spec:

[84] Letter ::= BaseChar | Ideographic


IS_PUBIDCHAR()

#define IS_PUBIDCHAR(c)	xmlIsPubidChar(c)

Macro to check the following production in the XML spec:

[13] PubidChar ::= x20 | xD | xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]


SKIP_EOL()

#define     SKIP_EOL(p)

Skips the end of line chars.


MOVETO_ENDTAG()

#define     MOVETO_ENDTAG(p)

Skips to the next '>' char.


MOVETO_STARTTAG()

#define     MOVETO_STARTTAG(p)

Skips to the next '<' char.


xmlIsBaseChar ()

int         xmlIsBaseChar                   (int c);

Check whether the character is allowed by the production [85] BaseChar ::= ... long list see REC ...

VI is your friend ! :1,$ s/\[x\([0-9A-Z]*\)-x\([0-9A-Z]*\)\]/ (((c) >= 0x\1) \&\& ((c) <= 0x\2)) ||/ and :1,$ s/x\([0-9A-Z]*\)/ ((c) == 0x\1) ||/


xmlIsBlank ()

int         xmlIsBlank                      (int c);

Check whether the character is allowed by the production [3] S ::= (x20 | x9 | xD | xA)+ Also available as a macro IS_BLANK()


xmlIsPubidChar ()

int         xmlIsPubidChar                  (int c);

Check whether the character is allowed by the production [13] PubidChar ::= x20 | xD | xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]


xmlIsLetter ()

int         xmlIsLetter                     (int c);

Check whether the character is allowed by the production [84] Letter ::= BaseChar | Ideographic


xmlIsDigit ()

int         xmlIsDigit                      (int c);

Check whether the character is allowed by the production [88] Digit ::= ... long list see REC ...


xmlIsIdeographic ()

int         xmlIsIdeographic                (int c);

Check whether the character is allowed by the production [86] Ideographic ::= [x4E00-x9FA5] | x3007 | [x3021-x3029]


xmlIsExtender ()

int         xmlIsExtender                   (int c);

Check whether the character is allowed by the production [89] Extender ::= x00B7 | x02D0 | x02D1 | x0387 | x0640 | x0E46 | x0EC6 | x3005 | [x3031-x3035] | [x309D-x309E] | [x30FC-x30FE]


xmlIsCombining ()

int         xmlIsCombining                  (int c);

Check whether the character is allowed by the production [87] CombiningChar ::= ... long list see REC ...


xmlIsChar ()

int         xmlIsChar                       (int c);

Check whether the character is allowed by the production [2] Char ::= x9 | xA | xD | [x20-xD7FF] | [xE000-xFFFD] | [x10000-x10FFFF] any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. Also available as a macro IS_CHAR()


xmlCreateFileParserCtxt ()

xmlParserCtxtPtr xmlCreateFileParserCtxt    (const char *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.


xmlCreateMemoryParserCtxt ()

xmlParserCtxtPtr xmlCreateMemoryParserCtxt  (const char *buffer,
                                             int size);

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


xmlNewParserCtxt ()

xmlParserCtxtPtr xmlNewParserCtxt           (void);

Allocate and initialize a new parser context.


xmlCreateEntityParserCtxt ()

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

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


xmlSwitchEncoding ()

int         xmlSwitchEncoding               (xmlParserCtxtPtr ctxt,
                                             xmlCharEncoding enc);

change the input functions when discovering the character encoding of a given entity.


xmlSwitchToEncoding ()

int         xmlSwitchToEncoding             (xmlParserCtxtPtr ctxt,
                                             xmlCharEncodingHandlerPtr handler);

change the input functions when discovering the character encoding of a given entity.


xmlHandleEntity ()

void        xmlHandleEntity                 (xmlParserCtxtPtr ctxt,
                                             xmlEntityPtr entity);

Default handling of defined entities, when should we define a new input stream ? When do we just handle that as a set of chars ?

OBSOLETE: to be removed at some point.


xmlNewStringInputStream ()

xmlParserInputPtr xmlNewStringInputStream   (xmlParserCtxtPtr ctxt,
                                             const xmlChar *buffer);

Create a new input stream based on a memory buffer.


xmlNewEntityInputStream ()

xmlParserInputPtr xmlNewEntityInputStream   (xmlParserCtxtPtr ctxt,
                                             xmlEntityPtr entity);

Create a new input stream based on an xmlEntityPtr


xmlPushInput ()

void        xmlPushInput                    (xmlParserCtxtPtr ctxt,
                                             xmlParserInputPtr input);

xmlPushInput: switch to a new input stream which is stacked on top of the previous one(s).


xmlPopInput ()

xmlChar     xmlPopInput                     (xmlParserCtxtPtr ctxt);

xmlPopInput: the current input pointed by ctxt->input came to an end pop it and return the next char.


xmlFreeInputStream ()

void        xmlFreeInputStream              (xmlParserInputPtr input);

Free up an input stream.


xmlNewInputFromFile ()

xmlParserInputPtr xmlNewInputFromFile       (xmlParserCtxtPtr ctxt,
                                             const char *filename);

Create a new input stream based on a file.


xmlNewInputStream ()

xmlParserInputPtr xmlNewInputStream         (xmlParserCtxtPtr ctxt);

Create a new input stream structure


xmlSplitQName ()

xmlChar*    xmlSplitQName                   (xmlParserCtxtPtr ctxt,
                                             const xmlChar *name,
                                             xmlChar **prefix);

parse an UTF8 encoded XML qualified name string

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

[NS 6] Prefix ::= NCName

[NS 7] LocalPart ::= NCName


xmlNamespaceParseNCName ()

xmlChar*    xmlNamespaceParseNCName         (xmlParserCtxtPtr ctxt);

parse an XML namespace name.

TODO: this seems not in use anymore, the namespace handling is done on top of the SAX interfaces, i.e. not on raw input.

[NS 3] NCName ::= (Letter | '_') (NCNameChar)*

[NS 4] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender


xmlNamespaceParseQName ()

xmlChar*    xmlNamespaceParseQName          (xmlParserCtxtPtr ctxt,
                                             xmlChar **prefix);

TODO: this seems not in use anymore, the namespace handling is done on top of the SAX interfaces, i.e. not on raw input.

parse an XML qualified name

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

[NS 6] Prefix ::= NCName

[NS 7] LocalPart ::= NCName


xmlNamespaceParseNSDef ()

xmlChar*    xmlNamespaceParseNSDef          (xmlParserCtxtPtr ctxt);

parse a namespace prefix declaration

TODO: this seems not in use anymore, the namespace handling is done on top of the SAX interfaces, i.e. not on raw input.

[NS 1] NSDef ::= PrefixDef Eq SystemLiteral

[NS 2] PrefixDef ::= 'xmlns' (':' NCName)?


xmlParseQuotedString ()

xmlChar*    xmlParseQuotedString            (xmlParserCtxtPtr ctxt);

Parse and return a string between quotes or doublequotes

TODO: Deprecated, to be removed at next drop of binary compatibility


xmlParseNamespace ()

void        xmlParseNamespace               (xmlParserCtxtPtr ctxt);

xmlParseNamespace: parse specific PI '<?namespace ...' constructs.

This is what the older xml-name Working Draft specified, a bunch of other stuff may still rely on it, so support is still here as if it was declared on the root of the Tree:-(

TODO: remove from library

To be removed at next drop of binary compatibility


xmlScanName ()

xmlChar*    xmlScanName                     (xmlParserCtxtPtr ctxt);

Trickery: parse an XML name but without consuming the input flow Needed for rollback cases. Used only when parsing entities references.

TODO: seems deprecated now, only used in the default part of xmlParserHandleReference

[4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender

[5] Name ::= (Letter | '_' | ':') (NameChar)*

[6] Names ::= Name (S Name)*


xmlParseName ()

xmlChar*    xmlParseName                    (xmlParserCtxtPtr ctxt);

parse an XML name.

[4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender

[5] Name ::= (Letter | '_' | ':') (NameChar)*

[6] Names ::= Name (S Name)*


xmlParseNmtoken ()

xmlChar*    xmlParseNmtoken                 (xmlParserCtxtPtr ctxt);

parse an XML Nmtoken.

[7] Nmtoken ::= (NameChar)+

[8] Nmtokens ::= Nmtoken (S Nmtoken)*


xmlParseEntityValue ()

xmlChar*    xmlParseEntityValue             (xmlParserCtxtPtr ctxt,
                                             xmlChar **orig);

parse a value for ENTITY declarations

[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'"


xmlParseAttValue ()

xmlChar*    xmlParseAttValue                (xmlParserCtxtPtr ctxt);

parse a value for an attribute Note: the parser won't do substitution of entities here, this will be handled later in xmlStringGetNodeList

[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"

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


xmlParseSystemLiteral ()

xmlChar*    xmlParseSystemLiteral           (xmlParserCtxtPtr ctxt);

parse an XML Literal

[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")


xmlParsePubidLiteral ()

xmlChar*    xmlParsePubidLiteral            (xmlParserCtxtPtr ctxt);

parse an XML public literal

[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"


xmlParseCharData ()

void        xmlParseCharData                (xmlParserCtxtPtr ctxt,
                                             int cdata);

parse a CharData section. if we are within a CDATA section ']]>' marks an end of section.

The right angle bracket (>) may be represented using the string "&gt;", and must, for compatibility, be escaped using "&gt;" or a character reference when it appears in the string "]]>" in content, when that string is not marking the end of a CDATA section.

[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)


xmlParseExternalID ()

xmlChar*    xmlParseExternalID              (xmlParserCtxtPtr ctxt,
                                             xmlChar **publicID,
                                             int strict);

Parse an External ID or a Public ID

NOTE: Productions [75] and [83] interact badly since [75] can generate 'PUBLIC' S PubidLiteral S SystemLiteral

[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral

[83] PublicID ::= 'PUBLIC' S PubidLiteral


xmlParseComment ()

void        xmlParseComment                 (xmlParserCtxtPtr ctxt);

Skip an XML (SGML) comment <!-- .... --> The spec says that "For compatibility, the string "--" (double-hyphen) must not occur within comments. "

[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'


xmlParsePITarget ()

xmlChar*    xmlParsePITarget                (xmlParserCtxtPtr ctxt);

parse the name of a PI

[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))


xmlParsePI ()

void        xmlParsePI                      (xmlParserCtxtPtr ctxt);

parse an XML Processing Instruction.

[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'

The processing is transfered to SAX once parsed.


xmlParseNotationDecl ()

void        xmlParseNotationDecl            (xmlParserCtxtPtr ctxt);

parse a notation declaration

[82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'

Hence there is actually 3 choices: 'PUBLIC' S PubidLiteral 'PUBLIC' S PubidLiteral S SystemLiteral and 'SYSTEM' S SystemLiteral

See the NOTE on xmlParseExternalID().


xmlParseEntityDecl ()

void        xmlParseEntityDecl              (xmlParserCtxtPtr ctxt);

parse <!ENTITY declarations

[70] EntityDecl ::= GEDecl | PEDecl

[71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'

[72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'

[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)

[74] PEDef ::= EntityValue | ExternalID

[76] NDataDecl ::= S 'NDATA' S Name

[ VC: Notation Declared ] The Name must match the declared name of a notation.


xmlParseDefaultDecl ()

int         xmlParseDefaultDecl             (xmlParserCtxtPtr ctxt,
                                             xmlChar **value);

Parse an attribute default declaration

[60] DefaultDecl ::= 'REQUIRED' | 'IMPLIED' | (('FIXED' S)? AttValue)

[ VC: Required Attribute ] if the default declaration is the keyword REQUIRED, then the attribute must be specified for all elements of the type in the attribute-list declaration.

[ VC: Attribute Default Legal ] The declared default value must meet the lexical constraints of the declared attribute type c.f. xmlValidateAttributeDecl()

[ VC: Fixed Attribute Default ] if an attribute has a default value declared with the FIXED keyword, instances of that attribute must match the default value.

[ WFC: No < in Attribute Values ] handled in xmlParseAttValue()


xmlParseNotationType ()

xmlEnumerationPtr xmlParseNotationType      (xmlParserCtxtPtr ctxt);

parse an Notation attribute type.

Note: the leading 'NOTATION' S part has already being parsed...

[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'

[ VC: Notation Attributes ] Values of this type must match one of the notation names included in the declaration; all notation names in the declaration must be declared.


xmlParseEnumerationType ()

xmlEnumerationPtr xmlParseEnumerationType   (xmlParserCtxtPtr ctxt);

parse an Enumeration attribute type.

[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'

[ VC: Enumeration ] Values of this type must match one of the Nmtoken tokens in the declaration


xmlParseEnumeratedType ()

int         xmlParseEnumeratedType          (xmlParserCtxtPtr ctxt,
                                             xmlEnumerationPtr *tree);

parse an Enumerated attribute type.

[57] EnumeratedType ::= NotationType | Enumeration

[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'


xmlParseAttributeType ()

int         xmlParseAttributeType           (xmlParserCtxtPtr ctxt,
                                             xmlEnumerationPtr *tree);

parse the Attribute list def for an element

[54] AttType ::= StringType | TokenizedType | EnumeratedType

[55] StringType ::= 'CDATA'

[56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'

Validity constraints for attribute values syntax are checked in xmlValidateAttributeValue()

[ VC: ID ] Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them.

[ VC: One ID per Element Type ] No element type may have more than one ID attribute specified.

[ VC: ID Attribute Default ] An ID attribute must have a declared default of IMPLIED or REQUIRED.

[ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each IDREF Name must match the value of an ID attribute on some element in the XML document; i.e. IDREF values must match the value of some ID attribute.

[ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Entity Name must match the name of an unparsed entity declared in the DTD.

[ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.


xmlParseAttributeListDecl ()

void        xmlParseAttributeListDecl       (xmlParserCtxtPtr ctxt);

: parse the Attribute list def for an element

[52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'

[53] AttDef ::= S Name S AttType S DefaultDecl


xmlParseElementMixedContentDecl ()

xmlElementContentPtr xmlParseElementMixedContentDecl
                                            (xmlParserCtxtPtr ctxt,
                                             xmlParserInputPtr inputchk);

parse the declaration for a Mixed Element content The leading '(' and spaces have been skipped in xmlParseElementContentDecl

[51] Mixed ::= '(' S? 'PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? 'PCDATA' S? ')'

[ VC: Proper Group/PE Nesting ] applies to [51] too (see [49])

[ VC: No Duplicate Types ] The same name must not appear more than once in a single mixed-content declaration.


xmlParseElementChildrenContentD ()

xmlElementContentPtr xmlParseElementChildrenContentD
                                            (xmlParserCtxtPtr ctxt);

VMS version of xmlParseElementChildrenContentDecl()


xmlParseElementChildrenContentDecl ()

xmlElementContentPtr xmlParseElementChildrenContentDecl
                                            (xmlParserCtxtPtr ctxt,
                                             xmlParserInputPtr inputchk);

parse the declaration for a Mixed Element content The leading '(' and spaces have been skipped in xmlParseElementContentDecl

[47] children ::= (choice | seq) ('?' | '*' | '+')?

[48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?

[49] choice ::= '(' S? cp ( S? '|' S? cp )* S? ')'

[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'

[ VC: Proper Group/PE Nesting ] applies to [49] and [50] TODO Parameter-entity replacement text must be properly nested with parenthesized groups. That is to say, if either of the opening or closing parentheses in a choice, seq, or Mixed construct is contained in the replacement text for a parameter entity, both must be contained in the same replacement text. For interoperability, if a parameter-entity reference appears in a choice, seq, or Mixed construct, its replacement text should not be empty, and neither the first nor last non-blank character of the replacement text should be a connector (| or ,).


xmlParseElementContentDecl ()

int         xmlParseElementContentDecl      (xmlParserCtxtPtr ctxt,
                                             xmlChar *name,
                                             xmlElementContentPtr *result);

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


xmlParseElementDecl ()

int         xmlParseElementDecl             (xmlParserCtxtPtr ctxt);

parse an Element declaration.

[45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'

[ VC: Unique Element Type Declaration ] No element type may be declared more than once


xmlParseMarkupDecl ()

void        xmlParseMarkupDecl              (xmlParserCtxtPtr ctxt);

parse Markup declarations

[29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment

[ VC: Proper Declaration/PE Nesting ] Parameter-entity replacement text must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration (markupdecl above) is contained in the replacement text for a parameter-entity reference, both must be contained in the same replacement text.

[ WFC: PEs in Internal Subset ] In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.)


xmlParseCharRef ()

int         xmlParseCharRef                 (xmlParserCtxtPtr ctxt);

parse Reference declarations

[66] CharRef ::= '&#' [0-9]+ ';' | '&x' [0-9a-fA-F]+ ';'

[ WFC: Legal Character ] Characters referred to using character references must match the production for Char.


xmlParseEntityRef ()

xmlEntityPtr xmlParseEntityRef              (xmlParserCtxtPtr ctxt);

parse ENTITY references declarations

[68] EntityRef ::= '&' Name ';'

[ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", the Name given in the entity reference must match that in an entity declaration, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. The declaration of a parameter entity must precede any reference to it. Similarly, the declaration of a general entity must precede any reference to it which appears in a default value in an attribute-list declaration. Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone='yes'.

[ WFC: Parsed Entity ] An entity reference must not contain the name of an unparsed entity


xmlParseReference ()

void        xmlParseReference               (xmlParserCtxtPtr ctxt);

parse and handle entity references in content, depending on the SAX interface, this may end-up in a call to character() if this is a CharRef, a predefined entity, if there is no reference() callback. or if the parser was asked to switch to that mode.

[67] Reference ::= EntityRef | CharRef


xmlParsePEReference ()

void        xmlParsePEReference             (xmlParserCtxtPtr ctxt);

parse PEReference declarations The entity content is handled directly by pushing it's content as a new input stream.

[69] PEReference ::= '%' Name ';'

[ WFC: No Recursion ] A parsed entity must not contain a recursive reference to itself, either directly or indirectly.

[ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", ... ... The declaration of a parameter entity must precede any reference to it...

[ VC: Entity Declared ] In a document with an external subset or external parameter entities with "standalone='no'", ... ... The declaration of a parameter entity must precede any reference to it...

[ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.


xmlParseDocTypeDecl ()

void        xmlParseDocTypeDecl             (xmlParserCtxtPtr ctxt);

parse a DOCTYPE declaration

[28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | PEReference | S)* ']' S?)? '>'

[ VC: Root Element Type ] The Name in the document type declaration must match the element type of the root element.


xmlParseAttribute ()

xmlChar*    xmlParseAttribute               (xmlParserCtxtPtr ctxt,
                                             xmlChar **value);

parse an attribute

[41] Attribute ::= Name Eq AttValue

[ WFC: No External Entity References ] Attribute values cannot contain direct or indirect entity references to external entities.

[ WFC: No < in Attribute Values ] The replacement text of any entity referred to directly or indirectly in an attribute value (other than "&lt;") must not contain a <.

[ VC: Attribute Value Type ] The attribute must have been declared; the value must be of the type declared for it.

[25] Eq ::= S? '=' S?

With namespace:

[NS 11] Attribute ::= QName Eq AttValue

Also the case QName == xmlns:??? is handled independently as a namespace definition.


xmlParseStartTag ()

xmlChar*    xmlParseStartTag                (xmlParserCtxtPtr ctxt);

parse a start of tag either for rule element or EmptyElement. In both case we don't parse the tag closing chars.

[40] STag ::= '<' Name (S Attribute)* S? '>'

[ WFC: Unique Att Spec ] No attribute name may appear more than once in the same start-tag or empty-element tag.

[44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'

[ WFC: Unique Att Spec ] No attribute name may appear more than once in the same start-tag or empty-element tag.

With namespace:

[NS 8] STag ::= '<' QName (S Attribute)* S? '>'

[NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>'


xmlParseEndTag ()

void        xmlParseEndTag                  (xmlParserCtxtPtr ctxt);

parse an end of tag

[42] ETag ::= '</' Name S? '>'

With namespace

[NS 9] ETag ::= '</' QName S? '>'


xmlParseCDSect ()

void        xmlParseCDSect                  (xmlParserCtxtPtr ctxt);

Parse escaped pure raw content.

[18] CDSect ::= CDStart CData CDEnd

[19] CDStart ::= '<![CDATA['

[20] Data ::= (Char* - (Char* ']]>' Char*))

[21] CDEnd ::= ']]>'


xmlParseContent ()

void        xmlParseContent                 (xmlParserCtxtPtr ctxt);

Parse a content:

[43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*


xmlParseElement ()

void        xmlParseElement                 (xmlParserCtxtPtr ctxt);

parse an XML element, this is highly recursive

[39] element ::= EmptyElemTag | STag content ETag

[ WFC: Element Type Match ] The Name in an element's end-tag must match the element type in the start-tag.

[ VC: Element Valid ] An element is valid if there is a declaration matching elementdecl where the Name matches the element type and one of the following holds: - The declaration matches EMPTY and the element has no content. - The declaration matches children and the sequence of child elements belongs to the language generated by the regular expression in the content model, with optional white space (characters matching the nonterminal S) between each pair of child elements. - The declaration matches Mixed and the content consists of character data and child elements whose types match names in the content model. - The declaration matches ANY, and the types of any child elements have been declared.


xmlParseVersionNum ()

xmlChar*    xmlParseVersionNum              (xmlParserCtxtPtr ctxt);

parse the XML version value.

[26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+


xmlParseVersionInfo ()

xmlChar*    xmlParseVersionInfo             (xmlParserCtxtPtr ctxt);

parse the XML version.

[24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")

[25] Eq ::= S? '=' S?


xmlParseEncName ()

xmlChar*    xmlParseEncName                 (xmlParserCtxtPtr ctxt);

parse the XML encoding name

[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*


xmlParseEncodingDecl ()

xmlChar*    xmlParseEncodingDecl            (xmlParserCtxtPtr ctxt);

parse the XML encoding declaration

[80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'")

this setups the conversion filters.


xmlParseSDDecl ()

int         xmlParseSDDecl                  (xmlParserCtxtPtr ctxt);

parse the XML standalone declaration

[32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no')'"'))

[ VC: Standalone Document Declaration ] TODO The standalone document declaration must have the value "no" if any external markup declarations contain declarations of: - attributes with default values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or - entities (other than amp, lt, gt, apos, quot), if references to those entities appear in the document, or - attributes with values subject to normalization, where the attribute appears in the document with a value which will change as a result of normalization, or - element types with element content, if white space occurs directly within any instance of those types.


xmlParseXMLDecl ()

void        xmlParseXMLDecl                 (xmlParserCtxtPtr ctxt);

parse an XML declaration header

[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'


xmlParseTextDecl ()

void        xmlParseTextDecl                (xmlParserCtxtPtr ctxt);

parse an XML declaration header for external entities

[77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'

Question: Seems that EncodingDecl is mandatory ? Is that a typo ?


xmlParseMisc ()

void        xmlParseMisc                    (xmlParserCtxtPtr ctxt);

parse an XML Misc* optional field.

[27] Misc ::= Comment | PI | S


xmlParseExternalSubset ()

void        xmlParseExternalSubset          (xmlParserCtxtPtr ctxt,
                                             const xmlChar *ExternalID,
                                             const xmlChar *SystemID);

parse Markup declarations from an external subset

[30] extSubset ::= textDecl? extSubsetDecl

[31] extSubsetDecl ::= (markupdecl | conditionalSect | PEReference | S) *


XML_SUBSTITUTE_NONE

#define XML_SUBSTITUTE_NONE	0

If no entities need to be substituted.


XML_SUBSTITUTE_REF

#define XML_SUBSTITUTE_REF	1

Whether general entities need to be substituted.


XML_SUBSTITUTE_PEREF

#define XML_SUBSTITUTE_PEREF	2

Whether parameter entities need to be substituted.


XML_SUBSTITUTE_BOTH

#define XML_SUBSTITUTE_BOTH 	3

Both general and parameter entities need to be substituted.


xmlDecodeEntities ()

xmlChar*    xmlDecodeEntities               (xmlParserCtxtPtr ctxt,
                                             int len,
                                             int what,
                                             xmlChar end,
                                             xmlChar end2,
                                             xmlChar end3);

This function is deprecated, we now always process entities content through xmlStringDecodeEntities

TODO: remove it in next major release.

[67] Reference ::= EntityRef | CharRef

[69] PEReference ::= '%' Name ';'


xmlStringDecodeEntities ()

xmlChar*    xmlStringDecodeEntities         (xmlParserCtxtPtr ctxt,
                                             const xmlChar *str,
                                             int what,
                                             xmlChar end,
                                             xmlChar end2,
                                             xmlChar end3);

Takes a entity string content and process to do the adequate substitutions.

[67] Reference ::= EntityRef | CharRef

[69] PEReference ::= '%' Name ';'


nodePush ()

int         nodePush                        (xmlParserCtxtPtr ctxt,
                                             xmlNodePtr value);

Pushes a new element node on top of the node stack


nodePop ()

xmlNodePtr  nodePop                         (xmlParserCtxtPtr ctxt);

Pops the top element node from the node stack


inputPush ()

int         inputPush                       (xmlParserCtxtPtr ctxt,
                                             xmlParserInputPtr value);

Pushes a new parser input on top of the input stack


inputPop ()

xmlParserInputPtr inputPop                  (xmlParserCtxtPtr ctxt);

Pops the top parser input from the input stack


namePop ()

xmlChar*    namePop                         (xmlParserCtxtPtr ctxt);

Pops the top element name from the name stack


namePush ()

int         namePush                        (xmlParserCtxtPtr ctxt,
                                             xmlChar *value);

Pushes a new element name on top of the name stack


xmlSkipBlankChars ()

int         xmlSkipBlankChars               (xmlParserCtxtPtr ctxt);

skip all blanks character found at that point in the input streams. It pops up finished entities in the process if allowable at that point.


xmlStringCurrentChar ()

int         xmlStringCurrentChar            (xmlParserCtxtPtr ctxt,
                                             const xmlChar *cur,
                                             int *len);

The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer.


xmlParserHandlePEReference ()

void        xmlParserHandlePEReference      (xmlParserCtxtPtr ctxt);

[69] PEReference ::= '%' Name ';'

[ WFC: No Recursion ] A parsed entity must not contain a recursive reference to itself, either directly or indirectly.

[ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", ... ... The declaration of a parameter entity must precede any reference to it...

[ VC: Entity Declared ] In a document with an external subset or external parameter entities with "standalone='no'", ... ... The declaration of a parameter entity must precede any reference to it...

[ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.

A PEReference may have been detected in the current input stream the handling is done accordingly to http://www.w3.org/TR/REC-xmlentproc i.e. - Included in literal in entity values - Included as Parameter Entity reference within DTDs


xmlParserHandleReference ()

void        xmlParserHandleReference        (xmlParserCtxtPtr ctxt);

TODO: Remove, now deprecated ... the test is done directly in the content parsing routines.

[67] Reference ::= EntityRef | CharRef

[68] EntityRef ::= '&' Name ';'

[ WFC: Entity Declared ] the Name given in the entity reference must match that in an entity declaration, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot.

[ WFC: Parsed Entity ] An entity reference must not contain the name of an unparsed entity

[66] CharRef ::= '&#' [0-9]+ ';' | '&x' [0-9a-fA-F]+ ';'

A PEReference may have been detected in the current input stream the handling is done accordingly to http://www.w3.org/TR/REC-xmlentproc


xmlCheckLanguageID ()

int         xmlCheckLanguageID              (const xmlChar *lang);

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])+


xmlCurrentChar ()

int         xmlCurrentChar                  (xmlParserCtxtPtr ctxt,
                                             int *len);

The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer. Implement the end of line normalization: 2.11 End-of-Line Handling Wherever an external parsed entity or the literal entity value of an internal parsed entity contains either the literal two-character sequence "xDxA" or a standalone literal xD, an XML processor must pass to the application the single character xA. This behavior can conveniently be produced by normalizing all line breaks to xA on input, before parsing.)


xmlCopyCharMultiByte ()

int         xmlCopyCharMultiByte            (xmlChar *out,
                                             int val);

append the char value in the array


xmlCopyChar ()

int         xmlCopyChar                     (int len,
                                             xmlChar *out,
                                             int val);

append the char value in the array


xmlNextChar ()

void        xmlNextChar                     (xmlParserCtxtPtr ctxt);

Skip to the next char input char.


xmlParserInputShrink ()

void        xmlParserInputShrink            (xmlParserInputPtr in);

This function removes used input for the parser.


htmlInitAutoClose ()

void        htmlInitAutoClose               (void);

Initialize the htmlStartCloseIndex for fast lookup of closing tags names. This is not reentrant. Call xmlInitParser() once before processing in case of use in multithreaded programs.


htmlCreateFileParserCtxt ()

htmlParserCtxtPtr htmlCreateFileParserCtxt  (const char *filename,
                                             const char *encoding);

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


xmlEntityReferenceFunc ()

void        (*xmlEntityReferenceFunc)       (xmlEntityPtr ent,
                                             xmlNodePtr firstNode,
                                             xmlNodePtr lastNode);

Callback function used when one needs to be able to track back the provenance of a chunk of nodes inherited from an entity replacement.


xmlSetEntityReferenceFunc ()

void        xmlSetEntityReferenceFunc       (xmlEntityReferenceFunc func);

Set the function to call call back when a xml reference has been made