1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-12 09:17:37 +03:00

Removal of threading problems, update documentation, added SAX tests, Daniel

This commit is contained in:
Daniel Veillard 1999-04-21 20:12:07 +00:00
parent 517752b985
commit 5099ae89ef
19 changed files with 4311 additions and 769 deletions

View File

@ -1,3 +1,12 @@
Wed Apr 21 22:07:35 CEST 1999
* parser.[ch] tree.[ch] entities.[ch] valid.[ch] : removed the main
reentrancy problem at printing. One is left in entities.c, to
remove ASAP
* testSAX.c : added a test example showing the use of the SAX
interface if one doesn't want to build the DOM tree.
* html/gnome-xml-*.html html/index.sgml: regenerated the documentation
Mon Apr 5 14:14:40 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* parser.[ch] tree.[ch] SAX.c, parserInternals.h valid.[ch]:

11
TODO
View File

@ -6,18 +6,9 @@
asbtraction of an input stream. A large part of the context is still
located on the stack, moving to a state machine and putting everyting
in the parsing context should provide an adequate solution.
- DOM support, instead of using a proprietary in memory
format for the document representation, the parser should
call a DOM API to actually build the resulting document.
Then the parser becomes independent of the in-memory
representation of the document. Even better using RPC's
the parser can actually build the document in another
program.
- Support for Comments (bad, should be in ASAP, they are parsed
but not stored), should be configurable.
- Improve the support of entities on save (+SAX).
Done:
- Improve the support for SAX
- C++ support : John Ehresman <jehresma@dsg.harvard.edu>
- Updated code to follow more recent specs, added compatibility flag
- Better error handling, use a dedicated, overridable error

View File

@ -65,7 +65,7 @@ WIDTH="100%"></DIV
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN2972"
NAME="AEN3432"
></A
><H2
>Name</H2
@ -73,7 +73,7 @@ NAME="AEN2972"
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN2975"
NAME="AEN3435"
></A
><H2
>Synopsis</H2
@ -252,6 +252,10 @@ void <A
HREF="gnome-xml-entities.html#XMLDUMPENTITIESTABLE"
>xmlDumpEntitiesTable</A
> (<A
HREF="gnome-xml-tree.html#XMLBUFFERPTR"
>xmlBufferPtr</A
> buf,
<A
HREF="gnome-xml-entities.html#XMLENTITIESTABLEPTR"
>xmlEntitiesTablePtr</A
> table);
@ -276,7 +280,7 @@ HREF="gnome-xml-entities.html#XMLENTITYPTR"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3027"
NAME="AEN3488"
></A
><H2
>Description</H2
@ -286,14 +290,14 @@ NAME="AEN3027"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3030"
NAME="AEN3491"
></A
><H2
>Details</H2
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3032"
NAME="AEN3493"
></A
><H3
><A
@ -319,7 +323,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3037"
NAME="AEN3498"
></A
><H3
><A
@ -345,7 +349,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3042"
NAME="AEN3503"
></A
><H3
><A
@ -371,7 +375,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3047"
NAME="AEN3508"
></A
><H3
><A
@ -397,7 +401,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3052"
NAME="AEN3513"
></A
><H3
><A
@ -423,7 +427,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3057"
NAME="AEN3518"
></A
><H3
><A
@ -449,7 +453,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3062"
NAME="AEN3523"
></A
><H3
><A
@ -475,7 +479,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3067"
NAME="AEN3528"
></A
><H3
><A
@ -501,7 +505,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3072"
NAME="AEN3533"
></A
><H3
><A
@ -527,7 +531,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3077"
NAME="AEN3538"
></A
><H3
><A
@ -692,7 +696,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3117"
NAME="AEN3578"
></A
><H3
><A
@ -857,7 +861,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3157"
NAME="AEN3618"
></A
><H3
><A
@ -938,7 +942,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3178"
NAME="AEN3639"
></A
><H3
><A
@ -1042,7 +1046,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3204"
NAME="AEN3665"
></A
><H3
><A
@ -1145,7 +1149,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3230"
NAME="AEN3691"
></A
><H3
><A
@ -1254,7 +1258,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3258"
NAME="AEN3719"
></A
><H3
><A
@ -1315,7 +1319,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3274"
NAME="AEN3735"
></A
><H3
><A
@ -1396,7 +1400,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3295"
NAME="AEN3756"
></A
><H3
><A
@ -1459,7 +1463,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3311"
NAME="AEN3772"
></A
><H3
><A
@ -1476,6 +1480,10 @@ CELLPADDING="6"
><PRE
CLASS="PROGRAMLISTING"
>void xmlDumpEntitiesTable (<A
HREF="gnome-xml-tree.html#XMLBUFFERPTR"
>xmlBufferPtr</A
> buf,
<A
HREF="gnome-xml-entities.html#XMLENTITIESTABLEPTR"
>xmlEntitiesTablePtr</A
> table);</PRE
@ -1485,9 +1493,6 @@ HREF="gnome-xml-entities.html#XMLENTITIESTABLEPTR"
><P
>This will dump the content of the entity table as an XML DTD definition</P
><P
>NOTE: TODO an extra parameter allowing a reentant implementation will
be added.</P
><P
></P
><DIV
CLASS="INFORMALTABLE"
@ -1508,6 +1513,23 @@ VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>buf</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> An XML buffer.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>table</I
></TT
>&nbsp;:</TD
@ -1525,7 +1547,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3328"
NAME="AEN3793"
></A
><H3
><A

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ WIDTH="100%"></DIV
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN3359"
NAME="AEN3824"
></A
><H2
>Name</H2
@ -73,7 +73,7 @@ NAME="AEN3359"
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN3362"
NAME="AEN3827"
></A
><H2
>Synopsis</H2
@ -122,15 +122,15 @@ HREF="gnome-xml-valid.html#XMLADDNOTATIONDECL"
HREF="gnome-xml-tree.html#XMLDTDPTR"
>xmlDtdPtr</A
> dtd,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *name,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *PublicID,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *SystemID);
@ -155,6 +155,10 @@ void <A
HREF="gnome-xml-valid.html#XMLDUMPNOTATIONTABLE"
>xmlDumpNotationTable</A
> (<A
HREF="gnome-xml-tree.html#XMLBUFFERPTR"
>xmlBufferPtr</A
> buf,
<A
HREF="gnome-xml-valid.html#XMLNOTATIONTABLEPTR"
>xmlNotationTablePtr</A
> table);
@ -196,7 +200,7 @@ HREF="gnome-xml-valid.html#XMLADDELEMENTDECL"
HREF="gnome-xml-tree.html#XMLDTDPTR"
>xmlDtdPtr</A
> dtd,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *name,
@ -226,6 +230,10 @@ void <A
HREF="gnome-xml-valid.html#XMLDUMPELEMENTTABLE"
>xmlDumpElementTable</A
> (<A
HREF="gnome-xml-tree.html#XMLBUFFERPTR"
>xmlBufferPtr</A
> buf,
<A
HREF="gnome-xml-valid.html#XMLELEMENTTABLEPTR"
>xmlElementTablePtr</A
> table);
@ -266,17 +274,17 @@ HREF="gnome-xml-valid.html#XMLADDATTRIBUTEDECL"
HREF="gnome-xml-tree.html#XMLDTDPTR"
>xmlDtdPtr</A
> dtd,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *elem,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *name,
int type,
int def,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *defaultValue,
@ -305,6 +313,10 @@ void <A
HREF="gnome-xml-valid.html#XMLDUMPATTRIBUTETABLE"
>xmlDumpAttributeTable</A
> (<A
HREF="gnome-xml-tree.html#XMLBUFFERPTR"
>xmlBufferPtr</A
> buf,
<A
HREF="gnome-xml-valid.html#XMLATTRIBUTETABLEPTR"
>xmlAttributeTablePtr</A
> table);</PRE
@ -315,7 +327,7 @@ HREF="gnome-xml-valid.html#XMLATTRIBUTETABLEPTR"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3426"
NAME="AEN3894"
></A
><H2
>Description</H2
@ -325,14 +337,14 @@ NAME="AEN3426"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3429"
NAME="AEN3897"
></A
><H2
>Details</H2
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3431"
NAME="AEN3899"
></A
><H3
><A
@ -358,7 +370,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3436"
NAME="AEN3904"
></A
><H3
><A
@ -384,7 +396,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3441"
NAME="AEN3909"
></A
><H3
><A
@ -410,7 +422,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3446"
NAME="AEN3914"
></A
><H3
><A
@ -436,7 +448,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3451"
NAME="AEN3919"
></A
><H3
><A
@ -462,7 +474,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3456"
NAME="AEN3924"
></A
><H3
><A
@ -488,7 +500,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3461"
NAME="AEN3929"
></A
><H3
><A
@ -511,15 +523,15 @@ HREF="gnome-xml-tree.html#XMLNOTATIONPTR"
HREF="gnome-xml-tree.html#XMLDTDPTR"
>xmlDtdPtr</A
> dtd,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *name,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *PublicID,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *SystemID);</PRE
@ -632,7 +644,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3497"
NAME="AEN3965"
></A
><H3
><A
@ -713,7 +725,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3518"
NAME="AEN3986"
></A
><H3
><A
@ -776,7 +788,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3534"
NAME="AEN4002"
></A
><H3
><A
@ -793,6 +805,10 @@ CELLPADDING="6"
><PRE
CLASS="PROGRAMLISTING"
>void xmlDumpNotationTable (<A
HREF="gnome-xml-tree.html#XMLBUFFERPTR"
>xmlBufferPtr</A
> buf,
<A
HREF="gnome-xml-valid.html#XMLNOTATIONTABLEPTR"
>xmlNotationTablePtr</A
> table);</PRE
@ -825,6 +841,23 @@ VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>buf</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>table</I
></TT
>&nbsp;:</TD
@ -842,7 +875,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3551"
NAME="AEN4024"
></A
><H3
><A
@ -941,7 +974,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3576"
NAME="AEN4049"
></A
><H3
><A
@ -1022,7 +1055,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3597"
NAME="AEN4070"
></A
><H3
><A
@ -1085,7 +1118,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3613"
NAME="AEN4086"
></A
><H3
><A
@ -1108,7 +1141,7 @@ HREF="gnome-xml-tree.html#XMLELEMENTPTR"
HREF="gnome-xml-tree.html#XMLDTDPTR"
>xmlDtdPtr</A
> dtd,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *name,
@ -1226,7 +1259,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3648"
NAME="AEN4121"
></A
><H3
><A
@ -1307,7 +1340,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3669"
NAME="AEN4142"
></A
><H3
><A
@ -1370,7 +1403,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3685"
NAME="AEN4158"
></A
><H3
><A
@ -1387,6 +1420,10 @@ CELLPADDING="6"
><PRE
CLASS="PROGRAMLISTING"
>void xmlDumpElementTable (<A
HREF="gnome-xml-tree.html#XMLBUFFERPTR"
>xmlBufferPtr</A
> buf,
<A
HREF="gnome-xml-valid.html#XMLELEMENTTABLEPTR"
>xmlElementTablePtr</A
> table);</PRE
@ -1419,6 +1456,23 @@ VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>buf</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>table</I
></TT
>&nbsp;:</TD
@ -1436,7 +1490,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3702"
NAME="AEN4180"
></A
><H3
><A
@ -1518,7 +1572,7 @@ of error.</TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3723"
NAME="AEN4201"
></A
><H3
><A
@ -1581,7 +1635,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3739"
NAME="AEN4217"
></A
><H3
><A
@ -1663,7 +1717,7 @@ of error.</TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3760"
NAME="AEN4238"
></A
><H3
><A
@ -1686,17 +1740,17 @@ HREF="gnome-xml-tree.html#XMLATTRIBUTEPTR"
HREF="gnome-xml-tree.html#XMLDTDPTR"
>xmlDtdPtr</A
> dtd,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *elem,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *name,
int type,
int def,
<A
const <A
HREF="gnome-xml-tree.html#CHAR"
>CHAR</A
> *defaultValue,
@ -1864,7 +1918,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3809"
NAME="AEN4287"
></A
><H3
><A
@ -1945,7 +1999,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3830"
NAME="AEN4308"
></A
><H3
><A
@ -2008,7 +2062,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN3846"
NAME="AEN4324"
></A
><H3
><A
@ -2025,6 +2079,10 @@ CELLPADDING="6"
><PRE
CLASS="PROGRAMLISTING"
>void xmlDumpAttributeTable (<A
HREF="gnome-xml-tree.html#XMLBUFFERPTR"
>xmlBufferPtr</A
> buf,
<A
HREF="gnome-xml-valid.html#XMLATTRIBUTETABLEPTR"
>xmlAttributeTablePtr</A
> table);</PRE
@ -2057,6 +2115,23 @@ VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>buf</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>table</I
></TT
>&nbsp;:</TD

View File

@ -10,7 +10,12 @@
<ANCHOR id ="XMLSAXLOCATOR" href="gnome-xml/gnome-xml-parser.html#XMLSAXLOCATOR">
<ANCHOR id ="XMLSAXLOCATORPTR" href="gnome-xml/gnome-xml-parser.html#XMLSAXLOCATORPTR">
<ANCHOR id ="RESOLVEENTITYSAXFUNC" href="gnome-xml/gnome-xml-parser.html#RESOLVEENTITYSAXFUNC">
<ANCHOR id ="INTERNALSUBSETSAXFUNC" href="gnome-xml/gnome-xml-parser.html#INTERNALSUBSETSAXFUNC">
<ANCHOR id ="GETENTITYSAXFUNC" href="gnome-xml/gnome-xml-parser.html#GETENTITYSAXFUNC">
<ANCHOR id ="ENTITYDECLSAXFUNC" href="gnome-xml/gnome-xml-parser.html#ENTITYDECLSAXFUNC">
<ANCHOR id ="NOTATIONDECLSAXFUNC" href="gnome-xml/gnome-xml-parser.html#NOTATIONDECLSAXFUNC">
<ANCHOR id ="ATTRIBUTEDECLSAXFUNC" href="gnome-xml/gnome-xml-parser.html#ATTRIBUTEDECLSAXFUNC">
<ANCHOR id ="ELEMENTDECLSAXFUNC" href="gnome-xml/gnome-xml-parser.html#ELEMENTDECLSAXFUNC">
<ANCHOR id ="UNPARSEDENTITYDECLSAXFUNC" href="gnome-xml/gnome-xml-parser.html#UNPARSEDENTITYDECLSAXFUNC">
<ANCHOR id ="SETDOCUMENTLOCATORSAXFUNC" href="gnome-xml/gnome-xml-parser.html#SETDOCUMENTLOCATORSAXFUNC">
<ANCHOR id ="STARTDOCUMENTSAXFUNC" href="gnome-xml/gnome-xml-parser.html#STARTDOCUMENTSAXFUNC">
@ -18,12 +23,17 @@
<ANCHOR id ="STARTELEMENTSAXFUNC" href="gnome-xml/gnome-xml-parser.html#STARTELEMENTSAXFUNC">
<ANCHOR id ="ENDELEMENTSAXFUNC" href="gnome-xml/gnome-xml-parser.html#ENDELEMENTSAXFUNC">
<ANCHOR id ="ATTRIBUTESAXFUNC" href="gnome-xml/gnome-xml-parser.html#ATTRIBUTESAXFUNC">
<ANCHOR id ="REFERENCESAXFUNC" href="gnome-xml/gnome-xml-parser.html#REFERENCESAXFUNC">
<ANCHOR id ="CHARACTERSSAXFUNC" href="gnome-xml/gnome-xml-parser.html#CHARACTERSSAXFUNC">
<ANCHOR id ="IGNORABLEWHITESPACESAXFUNC" href="gnome-xml/gnome-xml-parser.html#IGNORABLEWHITESPACESAXFUNC">
<ANCHOR id ="PROCESSINGINSTRUCTIONSAXFUNC" href="gnome-xml/gnome-xml-parser.html#PROCESSINGINSTRUCTIONSAXFUNC">
<ANCHOR id ="COMMENTSAXFUNC" href="gnome-xml/gnome-xml-parser.html#COMMENTSAXFUNC">
<ANCHOR id ="WARNINGSAXFUNC" href="gnome-xml/gnome-xml-parser.html#WARNINGSAXFUNC">
<ANCHOR id ="ERRORSAXFUNC" href="gnome-xml/gnome-xml-parser.html#ERRORSAXFUNC">
<ANCHOR id ="FATALERRORSAXFUNC" href="gnome-xml/gnome-xml-parser.html#FATALERRORSAXFUNC">
<ANCHOR id ="ISSTANDALONESAXFUNC" href="gnome-xml/gnome-xml-parser.html#ISSTANDALONESAXFUNC">
<ANCHOR id ="HASINTERNALSUBSETSAXFUNC" href="gnome-xml/gnome-xml-parser.html#HASINTERNALSUBSETSAXFUNC">
<ANCHOR id ="HASEXTERNALSUBSETSAXFUNC" href="gnome-xml/gnome-xml-parser.html#HASEXTERNALSUBSETSAXFUNC">
<ANCHOR id ="XMLSAXHANDLERPTR" href="gnome-xml/gnome-xml-parser.html#XMLSAXHANDLERPTR">
<ANCHOR id ="XMLSTRDUP" href="gnome-xml/gnome-xml-parser.html#XMLSTRDUP">
<ANCHOR id ="XMLSTRNDUP" href="gnome-xml/gnome-xml-parser.html#XMLSTRNDUP">
@ -73,6 +83,14 @@
<ANCHOR id ="XMLNODEPTR" href="gnome-xml/gnome-xml-tree.html#XMLNODEPTR">
<ANCHOR id ="XMLDOC" href="gnome-xml/gnome-xml-tree.html#XMLDOC">
<ANCHOR id ="XMLDOCPTR" href="gnome-xml/gnome-xml-tree.html#XMLDOCPTR">
<ANCHOR id ="XMLBUFFER" href="gnome-xml/gnome-xml-tree.html#XMLBUFFER">
<ANCHOR id ="XMLBUFFERPTR" href="gnome-xml/gnome-xml-tree.html#XMLBUFFERPTR">
<ANCHOR id ="XMLBUFFERCREATE" href="gnome-xml/gnome-xml-tree.html#XMLBUFFERCREATE">
<ANCHOR id ="XMLBUFFERFREE" href="gnome-xml/gnome-xml-tree.html#XMLBUFFERFREE">
<ANCHOR id ="XMLBUFFERDUMP" href="gnome-xml/gnome-xml-tree.html#XMLBUFFERDUMP">
<ANCHOR id ="XMLBUFFERADD" href="gnome-xml/gnome-xml-tree.html#XMLBUFFERADD">
<ANCHOR id ="XMLBUFFERCAT" href="gnome-xml/gnome-xml-tree.html#XMLBUFFERCAT">
<ANCHOR id ="XMLBUFFERCCAT" href="gnome-xml/gnome-xml-tree.html#XMLBUFFERCCAT">
<ANCHOR id ="XMLCREATEINTSUBSET" href="gnome-xml/gnome-xml-tree.html#XMLCREATEINTSUBSET">
<ANCHOR id ="XMLNEWDTD" href="gnome-xml/gnome-xml-tree.html#XMLNEWDTD">
<ANCHOR id ="XMLFREEDTD" href="gnome-xml/gnome-xml-tree.html#XMLFREEDTD">
@ -183,6 +201,18 @@
<ANCHOR id ="XMLPARSERERROR" href="gnome-xml/gnome-xml-xml-error.html#XMLPARSERERROR">
<ANCHOR id ="XMLPARSERWARNING" href="gnome-xml/gnome-xml-xml-error.html#XMLPARSERWARNING">
<ANCHOR id ="GNOME-XML-PARSERINTERNALS" href="gnome-xml/gnome-xml-parserinternals.html">
<ANCHOR id ="IS-CHAR" href="gnome-xml/gnome-xml-parserinternals.html#IS-CHAR">
<ANCHOR id ="IS-BLANK" href="gnome-xml/gnome-xml-parserinternals.html#IS-BLANK">
<ANCHOR id ="IS-BASECHAR" href="gnome-xml/gnome-xml-parserinternals.html#IS-BASECHAR">
<ANCHOR id ="IS-DIGIT" href="gnome-xml/gnome-xml-parserinternals.html#IS-DIGIT">
<ANCHOR id ="IS-COMBINING" href="gnome-xml/gnome-xml-parserinternals.html#IS-COMBINING">
<ANCHOR id ="IS-EXTENDER" href="gnome-xml/gnome-xml-parserinternals.html#IS-EXTENDER">
<ANCHOR id ="IS-IDEOGRAPHIC" href="gnome-xml/gnome-xml-parserinternals.html#IS-IDEOGRAPHIC">
<ANCHOR id ="IS-LETTER" href="gnome-xml/gnome-xml-parserinternals.html#IS-LETTER">
<ANCHOR id ="IS-PUBIDCHAR" href="gnome-xml/gnome-xml-parserinternals.html#IS-PUBIDCHAR">
<ANCHOR id ="SKIP-EOL" href="gnome-xml/gnome-xml-parserinternals.html#SKIP-EOL">
<ANCHOR id ="MOVETO-ENDTAG" href="gnome-xml/gnome-xml-parserinternals.html#MOVETO-ENDTAG">
<ANCHOR id ="MOVETO-STARTTAG" href="gnome-xml/gnome-xml-parserinternals.html#MOVETO-STARTTAG">
<ANCHOR id ="XMLCREATEDOCPARSERCTXT" href="gnome-xml/gnome-xml-parserinternals.html#XMLCREATEDOCPARSERCTXT">
<ANCHOR id ="XMLCREATEFILEPARSERCTXT" href="gnome-xml/gnome-xml-parserinternals.html#XMLCREATEFILEPARSERCTXT">
<ANCHOR id ="XMLCREATEMEMORYPARSERCTXT" href="gnome-xml/gnome-xml-parserinternals.html#XMLCREATEMEMORYPARSERCTXT">
@ -192,6 +222,7 @@
<ANCHOR id ="XMLPUSHINPUT" href="gnome-xml/gnome-xml-parserinternals.html#XMLPUSHINPUT">
<ANCHOR id ="XMLPOPINPUT" href="gnome-xml/gnome-xml-parserinternals.html#XMLPOPINPUT">
<ANCHOR id ="XMLFREEINPUTSTREAM" href="gnome-xml/gnome-xml-parserinternals.html#XMLFREEINPUTSTREAM">
<ANCHOR id ="XMLSPLITQNAME" href="gnome-xml/gnome-xml-parserinternals.html#XMLSPLITQNAME">
<ANCHOR id ="XMLNAMESPACEPARSENCNAME" href="gnome-xml/gnome-xml-parserinternals.html#XMLNAMESPACEPARSENCNAME">
<ANCHOR id ="XMLNAMESPACEPARSEQNAME" href="gnome-xml/gnome-xml-parserinternals.html#XMLNAMESPACEPARSEQNAME">
<ANCHOR id ="XMLNAMESPACEPARSENSDEF" href="gnome-xml/gnome-xml-parserinternals.html#XMLNAMESPACEPARSENSDEF">

View File

@ -523,15 +523,13 @@ xmlCopyEntitiesTable(xmlEntitiesTablePtr table) {
/**
* xmlDumpEntitiesTable:
* @buf: An XML buffer.
* @table: An entity table
*
* This will dump the content of the entity table as an XML DTD definition
*
* NOTE: TODO an extra parameter allowing a reentant implementation will
* be added.
*/
void
xmlDumpEntitiesTable(xmlEntitiesTablePtr table) {
xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) {
int i;
xmlEntityPtr cur;
@ -541,70 +539,70 @@ xmlDumpEntitiesTable(xmlEntitiesTablePtr table) {
cur = &table->table[i];
switch (cur->type) {
case XML_INTERNAL_GENERAL_ENTITY:
xmlBufferWriteChar("<!ENTITY ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(" \"");
xmlBufferWriteCHAR(cur->content);
xmlBufferWriteChar("\">\n");
xmlBufferWriteChar(buf, "<!ENTITY ");
xmlBufferWriteCHAR(buf, cur->name);
xmlBufferWriteChar(buf, " \"");
xmlBufferWriteCHAR(buf, cur->content);
xmlBufferWriteChar(buf, "\">\n");
break;
case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
xmlBufferWriteChar("<!ENTITY ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(buf, "<!ENTITY ");
xmlBufferWriteCHAR(buf, cur->name);
if (cur->ExternalID != NULL) {
xmlBufferWriteChar(" PUBLIC \"");
xmlBufferWriteCHAR(cur->ExternalID);
xmlBufferWriteChar("\" \"");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " PUBLIC \"");
xmlBufferWriteCHAR(buf, cur->ExternalID);
xmlBufferWriteChar(buf, "\" \"");
xmlBufferWriteCHAR(buf, cur->SystemID);
xmlBufferWriteChar(buf, "\"");
} else {
xmlBufferWriteChar(" SYSTEM \"");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " SYSTEM \"");
xmlBufferWriteCHAR(buf, cur->SystemID);
xmlBufferWriteChar(buf, "\"");
}
xmlBufferWriteChar(">\n");
xmlBufferWriteChar(buf, ">\n");
break;
case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:
xmlBufferWriteChar("<!ENTITY ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(buf, "<!ENTITY ");
xmlBufferWriteCHAR(buf, cur->name);
if (cur->ExternalID != NULL) {
xmlBufferWriteChar(" PUBLIC \"");
xmlBufferWriteCHAR(cur->ExternalID);
xmlBufferWriteChar("\" \"");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " PUBLIC \"");
xmlBufferWriteCHAR(buf, cur->ExternalID);
xmlBufferWriteChar(buf, "\" \"");
xmlBufferWriteCHAR(buf, cur->SystemID);
xmlBufferWriteChar(buf, "\"");
} else {
xmlBufferWriteChar(" SYSTEM \"");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " SYSTEM \"");
xmlBufferWriteCHAR(buf, cur->SystemID);
xmlBufferWriteChar(buf, "\"");
}
if (cur->content != NULL) { /* Should be true ! */
xmlBufferWriteChar(" NDATA ");
xmlBufferWriteCHAR(cur->content);
xmlBufferWriteChar(buf, " NDATA ");
xmlBufferWriteCHAR(buf, cur->content);
}
xmlBufferWriteChar(">\n");
xmlBufferWriteChar(buf, ">\n");
break;
case XML_INTERNAL_PARAMETER_ENTITY:
xmlBufferWriteChar("<!ENTITY % ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(" \"");
xmlBufferWriteCHAR(cur->content);
xmlBufferWriteChar("\">\n");
xmlBufferWriteChar(buf, "<!ENTITY % ");
xmlBufferWriteCHAR(buf, cur->name);
xmlBufferWriteChar(buf, " \"");
xmlBufferWriteCHAR(buf, cur->content);
xmlBufferWriteChar(buf, "\">\n");
break;
case XML_EXTERNAL_PARAMETER_ENTITY:
xmlBufferWriteChar("<!ENTITY % ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(buf, "<!ENTITY % ");
xmlBufferWriteCHAR(buf, cur->name);
if (cur->ExternalID != NULL) {
xmlBufferWriteChar(" PUBLIC \"");
xmlBufferWriteCHAR(cur->ExternalID);
xmlBufferWriteChar("\" \"");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " PUBLIC \"");
xmlBufferWriteCHAR(buf, cur->ExternalID);
xmlBufferWriteChar(buf, "\" \"");
xmlBufferWriteCHAR(buf, cur->SystemID);
xmlBufferWriteChar(buf, "\"");
} else {
xmlBufferWriteChar(" SYSTEM \"");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " SYSTEM \"");
xmlBufferWriteCHAR(buf, cur->SystemID);
xmlBufferWriteChar(buf, "\"");
}
xmlBufferWriteChar(">\n");
xmlBufferWriteChar(buf, ">\n");
break;
default:
fprintf(stderr,

View File

@ -69,7 +69,7 @@ CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input);
xmlEntitiesTablePtr xmlCreateEntitiesTable(void);
xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table);
void xmlFreeEntitiesTable(xmlEntitiesTablePtr table);
void xmlDumpEntitiesTable(xmlEntitiesTablePtr table);
void xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table);
xmlParserInputPtr xmlNewEntityInputStream(xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table);

View File

@ -69,7 +69,7 @@ CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input);
xmlEntitiesTablePtr xmlCreateEntitiesTable(void);
xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table);
void xmlFreeEntitiesTable(xmlEntitiesTablePtr table);
void xmlDumpEntitiesTable(xmlEntitiesTablePtr table);
void xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table);
xmlParserInputPtr xmlNewEntityInputStream(xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table);

View File

@ -240,6 +240,18 @@ typedef struct xmlDoc {
typedef _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
/*
* A buffer structure
*/
typedef struct xmlBuffer {
CHAR *content; /* The buffer content UTF8 */
unsigned int use; /* The buffer size used */
unsigned int size; /* The buffer size */
} _xmlBuffer;
typedef _xmlBuffer xmlBuffer;
typedef xmlBuffer *xmlBufferPtr;
/*
* Variables.
*/
@ -247,6 +259,17 @@ extern xmlNsPtr baseDTD;
extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
/*
* Handling Buffers.
*/
xmlBufferPtr xmlBufferCreate(void);
void xmlBufferFree(xmlBufferPtr buf);
int xmlBufferDump(FILE *file, xmlBufferPtr buf);
void xmlBufferAdd(xmlBufferPtr buf, const CHAR *str, int len);
void xmlBufferCat(xmlBufferPtr buf, const CHAR *str);
void xmlBufferCCat(xmlBufferPtr buf, const char *str);
/*
* Creating/freeing new structures
*/
@ -337,8 +360,8 @@ CHAR *xmlNodeGetContent(xmlNodePtr cur);
/*
* Internal, don't use
*/
void xmlBufferWriteCHAR(const CHAR *string);
void xmlBufferWriteChar(const char *string);
void xmlBufferWriteCHAR(xmlBufferPtr buf, const CHAR *string);
void xmlBufferWriteChar(xmlBufferPtr buf, const char *string);
/*
* Saving

View File

@ -58,7 +58,7 @@ xmlNotationPtr xmlAddNotationDecl(xmlDtdPtr dtd, const CHAR *name,
const CHAR *PublicID, const CHAR *SystemID);
xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
void xmlFreeNotationTable(xmlNotationTablePtr table);
void xmlDumpNotationTable(xmlNotationTablePtr table);
void xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table);
/* Element Content */
xmlElementContentPtr xmlNewElementContent(CHAR *name, int type);
@ -70,7 +70,7 @@ xmlElementPtr xmlAddElementDecl(xmlDtdPtr dtd, const CHAR *name, int type,
xmlElementContentPtr content);
xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table);
void xmlFreeElementTable(xmlElementTablePtr table);
void xmlDumpElementTable(xmlElementTablePtr table);
void xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table);
/* Enumeration */
xmlEnumerationPtr xmlCreateEnumeration(CHAR *name);
@ -83,6 +83,6 @@ xmlAttributePtr xmlAddAttributeDecl(xmlDtdPtr dtd, const CHAR *elem,
const CHAR *defaultValue, xmlEnumerationPtr tree);
xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table);
void xmlFreeAttributeTable(xmlAttributeTablePtr table);
void xmlDumpAttributeTable(xmlAttributeTablePtr table);
void xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table);
#endif /* __XML_VALID_H__ */

View File

@ -4337,7 +4337,7 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
if (ctxt->nodeTab != NULL) free(ctxt->nodeTab);
if (ctxt->inputTab != NULL) free(ctxt->inputTab);
if (ctxt->version != NULL) free(ctxt->version);
if (ctxt->version != NULL) free((char *) ctxt->version);
free(ctxt);
}

599
testSAX.c Normal file
View File

@ -0,0 +1,599 @@
/*
* tester.c : a small tester program for parsing using the SAX API.
*
* See Copyright for the status of this software.
*
* Daniel.Veillard@w3.org
*/
#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#else
#include <config.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "parser.h"
#include "tree.h"
#include "debugXML.h"
static int debug = 0;
static int copy = 0;
static int recovery = 0;
xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* internalSubset */
NULL, /* isStandalone */
NULL, /* hasInternalSubset */
NULL, /* hasExternalSubset */
NULL, /* resolveEntity */
NULL, /* getEntity */
NULL, /* entityDecl */
NULL, /* notationDecl */
NULL, /* attributeDecl */
NULL, /* elementDecl */
NULL, /* unparsedEntityDecl */
NULL, /* setDocumentLocator */
NULL, /* startDocument */
NULL, /* endDocument */
NULL, /* startElement */
NULL, /* endElement */
NULL, /* reference */
NULL, /* characters */
NULL, /* ignorableWhitespace */
NULL, /* processingInstruction */
NULL, /* comment */
NULL, /* xmlParserWarning */
NULL, /* xmlParserError */
NULL, /* xmlParserError */
};
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
/*
* Note: there is a couple of errors introduced on purpose.
*/
static CHAR buffer[] =
"<?xml version=\"1.0\"?>\n\
<?xml:namespace ns = \"http://www.ietf.org/standards/dav/\" prefix = \"D\"?>\n\
<?xml:namespace ns = \"http://www.w3.com/standards/z39.50/\" prefix = \"Z\"?>\n\
<D:propertyupdate>\n\
<D:set a=\"'toto'\" b>\n\
<D:prop>\n\
<Z:authors>\n\
<Z:Author>Jim Whitehead</Z:Author>\n\
<Z:Author>Roy Fielding</Z:Author>\n\
</Z:authors>\n\
</D:prop>\n\
</D:set>\n\
<D:remove>\n\
<D:prop><Z:Copyright-Owner/></D:prop>\n\
</D:remove>\n\
</D:propertyupdate>\n\
\n\
";
/************************************************************************
* *
* Debug Handlers *
* *
************************************************************************/
/**
* isStandaloneDebug:
* @ctxt: An XML parser context
*
* Is this document tagged standalone ?
*
* Returns 1 if true
*/
int
isStandaloneDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.isStandalone()\n");
return(0);
}
/**
* hasInternalSubsetDebug:
* @ctxt: An XML parser context
*
* Does this document has an internal subset
*
* Returns 1 if true
*/
int
hasInternalSubsetDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.hasInternalSubset()\n");
return(0);
}
/**
* hasExternalSubsetDebug:
* @ctxt: An XML parser context
*
* Does this document has an external subset
*
* Returns 1 if true
*/
int
hasExternalSubsetDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.hasExternalSubset()\n");
return(0);
}
/**
* hasInternalSubsetDebug:
* @ctxt: An XML parser context
*
* Does this document has an internal subset
*/
void
internalSubsetDebug(xmlParserCtxtPtr ctxt, const CHAR *name,
const CHAR *ExternalID, const CHAR *SystemID)
{
fprintf(stderr, "SAX.internalSubset(%s, %s, %s)\n",
name, ExternalID, SystemID);
}
/**
* resolveEntityDebug:
* @ctxt: An XML parser context
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
*
* Special entity resolver, better left to the parser, it has
* more context than the application layer.
* The default behaviour is to NOT resolve the entities, in that case
* the ENTITY_REF nodes are built in the structure (and the parameter
* values).
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
xmlParserInputPtr
resolveEntityDebug(xmlParserCtxtPtr ctxt, const CHAR *publicId, const CHAR *systemId)
{
fprintf(stderr, "SAX.resolveEntity(%s, %s)\n",
(char *)publicId, (char *)systemId);
return(NULL);
}
/**
* getEntityDebug:
* @ctxt: An XML parser context
* @name: The entity name
*
* Get an entity by name
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
xmlEntityPtr
getEntityDebug(xmlParserCtxtPtr ctxt, const CHAR *name)
{
fprintf(stderr, "SAX.getEntity(%s)\n", name);
return(NULL);
}
/**
* entityDeclDebug:
* @ctxt: An XML parser context
* @name: the entity name
* @type: the entity type
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
* @content: the entity value (without processing).
*
* An entity definition has been parsed
*/
void
entityDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
const CHAR *publicId, const CHAR *systemId, CHAR *content)
{
fprintf(stderr, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
name, type, publicId, systemId, content);
}
/**
* attributeDeclDebug:
* @ctxt: An XML parser context
* @name: the attribute name
* @type: the attribute type
*
* An attribute definition has been parsed
*/
void
attributeDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *elem, const CHAR *name,
int type, int def, const CHAR *defaultValue,
xmlEnumerationPtr tree)
{
fprintf(stderr, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
elem, name, type, def, defaultValue);
}
/**
* elementDeclDebug:
* @ctxt: An XML parser context
* @name: the element name
* @type: the element type
* @content: the element value (without processing).
*
* An element definition has been parsed
*/
void
elementDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
xmlElementContentPtr content)
{
fprintf(stderr, "SAX.elementDecl(%s, %d, ...)\n",
name, type);
}
/**
* notationDeclDebug:
* @ctxt: An XML parser context
* @name: The name of the notation
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
*
* What to do when a notation declaration has been parsed.
* TODO Not handled currently.
*/
void
notationDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name,
const CHAR *publicId, const CHAR *systemId)
{
fprintf(stderr, "SAX.notationDecl(%s, %s, %s)\n",
(char *) name, (char *) publicId, (char *) systemId);
}
/**
* unparsedEntityDeclDebug:
* @ctxt: An XML parser context
* @name: The name of the entity
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
* @notationName: the name of the notation
*
* What to do when an unparsed entity declaration is parsed
* TODO Create an Entity node.
*/
void
unparsedEntityDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name,
const CHAR *publicId, const CHAR *systemId,
const CHAR *notationName)
{
fprintf(stderr, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
(char *) name, (char *) publicId, (char *) systemId,
(char *) notationName);
}
/**
* setDocumentLocatorDebug:
* @ctxt: An XML parser context
* @loc: A SAX Locator
*
* Receive the document locator at startup, actually xmlDefaultSAXLocator
* Everything is available on the context, so this is useless in our case.
*/
void
setDocumentLocatorDebug(xmlParserCtxtPtr ctxt, xmlSAXLocatorPtr loc)
{
fprintf(stderr, "SAX.setDocumentLocator()\n");
}
/**
* startDocumentDebug:
* @ctxt: An XML parser context
*
* called when the document start being processed.
*/
void
startDocumentDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.startDocument()\n");
}
/**
* endDocumentDebug:
* @ctxt: An XML parser context
*
* called when the document end has been detected.
*/
void
endDocumentDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.endDocument()\n");
}
/**
* startElementDebug:
* @ctxt: An XML parser context
* @name: The element name
*
* called when an opening tag has been processed.
* TODO We currently have a small pblm with the arguments ...
*/
void
startElementDebug(xmlParserCtxtPtr ctxt, const CHAR *name, const CHAR **atts)
{
int i;
fprintf(stderr, "SAX.startElement(%s", (char *) name);
if (atts != NULL) {
for (i = 0;(atts[i] != NULL);i++) {
fprintf(stderr, ", %s='", atts[i++]);
fprintf(stderr, "%s'", atts[i]);
}
}
fprintf(stderr, ")\n");
}
/**
* endElementDebug:
* @ctxt: An XML parser context
* @name: The element name
*
* called when the end of an element has been detected.
*/
void
endElementDebug(xmlParserCtxtPtr ctxt, const CHAR *name)
{
fprintf(stderr, "SAX.endElement(%s)\n", (char *) name);
}
/**
* charactersDebug:
* @ctxt: An XML parser context
* @ch: a CHAR string
* @len: the number of CHAR
*
* receiving some chars from the parser.
* Question: how much at a time ???
*/
void
charactersDebug(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
{
fprintf(stderr, "SAX.characters(%.30s, %d)\n", (char *) ch, len);
}
/**
* referenceDebug:
* @ctxt: An XML parser context
* @name: The entity name
*
* called when an entity reference is detected.
*/
void
referenceDebug(xmlParserCtxtPtr ctxt, const CHAR *name)
{
fprintf(stderr, "SAX.reference(%s)\n", name);
}
/**
* ignorableWhitespaceDebug:
* @ctxt: An XML parser context
* @ch: a CHAR string
* @start: the first char in the string
* @len: the number of CHAR
*
* receiving some ignorable whitespaces from the parser.
* Question: how much at a time ???
*/
void
ignorableWhitespaceDebug(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
{
fprintf(stderr, "SAX.ignorableWhitespace(%.30s, %d)\n",
(char *) ch, len);
}
/**
* processingInstructionDebug:
* @ctxt: An XML parser context
* @target: the target name
* @data: the PI data's
* @len: the number of CHAR
*
* A processing instruction has been parsed.
*/
void
processingInstructionDebug(xmlParserCtxtPtr ctxt, const CHAR *target,
const CHAR *data)
{
fprintf(stderr, "SAX.processingInstruction(%s, %s)\n",
(char *) target, (char *) data);
}
/**
* commentDebug:
* @ctxt: An XML parser context
* @value: the comment content
*
* A comment has been parsed.
*/
void
commentDebug(xmlParserCtxtPtr ctxt, const CHAR *value)
{
fprintf(stderr, "SAX.comment(%s)\n", value);
}
/**
* warningDebug:
* @ctxt: An XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format a warning messages, gives file, line, position and
* extra parameters.
*/
void
warningDebug(xmlParserCtxtPtr ctxt, const char *msg, ...)
{
va_list args;
va_start(args, msg);
fprintf(stderr, "SAX.warning: ");
vfprintf(stderr, msg, args);
va_end(args);
}
/**
* errorDebug:
* @ctxt: An XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format a error messages, gives file, line, position and
* extra parameters.
*/
void
errorDebug(xmlParserCtxtPtr ctxt, const char *msg, ...)
{
va_list args;
va_start(args, msg);
fprintf(stderr, "SAX.error: ");
vfprintf(stderr, msg, args);
va_end(args);
}
/**
* fatalErrorDebug:
* @ctxt: An XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format a fatalError messages, gives file, line, position and
* extra parameters.
*/
void
fatalErrorDebug(xmlParserCtxtPtr ctxt, const char *msg, ...)
{
va_list args;
va_start(args, msg);
fprintf(stderr, "SAX.fatalError: ");
vfprintf(stderr, msg, args);
va_end(args);
}
xmlSAXHandler debugSAXHandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
hasExternalSubsetDebug,
resolveEntityDebug,
getEntityDebug,
entityDeclDebug,
notationDeclDebug,
attributeDeclDebug,
elementDeclDebug,
unparsedEntityDeclDebug,
setDocumentLocatorDebug,
startDocumentDebug,
endDocumentDebug,
startElementDebug,
endElementDebug,
referenceDebug,
charactersDebug,
ignorableWhitespaceDebug,
processingInstructionDebug,
commentDebug,
warningDebug,
errorDebug,
fatalErrorDebug,
};
xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;
/************************************************************************
* *
* Debug *
* *
************************************************************************/
void parseAndPrintFile(char *filename) {
xmlDocPtr doc;
/*
* Empty callbacks for checking
*/
doc = xmlSAXParseFile(emptySAXHandler, filename, 0);
if (doc != NULL) {
fprintf(stderr, "xmlSAXParseFile returned non-NULL\n");
xmlDocDump(stdout, doc);
}
/*
* Debug callback
*/
doc = xmlSAXParseFile(debugSAXHandler, filename, 0);
if (doc != NULL) {
fprintf(stderr, "xmlSAXParseFile returned non-NULL\n");
xmlDocDump(stdout, doc);
}
}
void parseAndPrintBuffer(CHAR *buf) {
xmlDocPtr doc;
/*
* Empty callbacks for checking
*/
doc = xmlSAXParseDoc(emptySAXHandler, buf, 0);
if (doc != NULL) {
fprintf(stderr, "xmlSAXParseDoc returned non-NULL\n");
xmlDocDump(stdout, doc);
}
/*
* Debug callback
*/
doc = xmlSAXParseDoc(debugSAXHandler, buf, 0);
if (doc != NULL) {
fprintf(stderr, "xmlSAXParseDoc returned non-NULL\n");
xmlDocDump(stdout, doc);
}
}
int main(int argc, char **argv) {
int i;
int files = 0;
for (i = 1; i < argc ; i++) {
if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
debug++;
else if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy")))
copy++;
else if ((!strcmp(argv[i], "-recover")) ||
(!strcmp(argv[i], "--recover")))
recovery++;
}
for (i = 1; i < argc ; i++) {
if (argv[i][0] != '-') {
parseAndPrintFile(argv[i]);
files ++;
}
}
if (files == 0) {
printf("\nFirst test for the parser, with errors\n");
parseAndPrintBuffer(buffer);
}
return(0);
}

467
tree.c
View File

@ -1707,6 +1707,7 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) {
* of the values carried by this node child's (TEXT and ENTITY_REF).
* Entity references are substitued.
* Returns a new CHAR * or NULL if no content is available.
* It's up to the caller to free the memory.
*/
CHAR *
xmlNodeGetContent(xmlNodePtr cur) {
@ -2106,80 +2107,203 @@ xmlTextConcat(xmlNodePtr node, const CHAR *content, int len) {
* *
************************************************************************/
static CHAR *buffer = NULL;
static int buffer_index = 0;
static int buffer_size = 0;
#define BASE_BUFFER_SIZE 4000
/**
* xmlBufferCreate:
*
* routine to create an XML buffer.
* returns the new structure.
*/
xmlBufferPtr
xmlBufferCreate(void) {
xmlBufferPtr ret;
ret = (xmlBufferPtr) malloc(sizeof(xmlBuffer));
if (ret == NULL) {
fprintf(stderr, "xmlBufferCreate : out of memory!\n");
return(NULL);
}
ret->use = 0;
ret->size = BASE_BUFFER_SIZE;
ret->content = (CHAR *) malloc(ret->size * sizeof(CHAR));
if (ret->content == NULL) {
fprintf(stderr, "xmlBufferCreate : out of memory!\n");
free(ret);
return(NULL);
}
ret->content[0] = 0;
return(ret);
}
/**
* xmlBufferFree:
* @buf: the buffer to free
*
* Frees an XML buffer.
*/
void
xmlBufferFree(xmlBufferPtr buf) {
if (buf == NULL) {
fprintf(stderr, "xmlBufferFree: buf == NULL\n");
return;
}
if (buf->content == NULL) {
fprintf(stderr, "xmlBufferFree: buf->content == NULL\n");
} else {
memset(buf->content, -1, BASE_BUFFER_SIZE);
free(buf->content);
}
memset(buf, -1, sizeof(xmlBuffer));
free(buf);
}
/**
* xmlBufferDump:
* @file: the file output
* @buf: the buffer to dump
*
* Dumps an XML buffer to a FILE *.
* Returns the number of CHAR written
*/
int
xmlBufferDump(FILE *file, xmlBufferPtr buf) {
int ret;
if (buf == NULL) {
fprintf(stderr, "xmlBufferDump: buf == NULL\n");
return(0);
}
if (buf->content == NULL) {
fprintf(stderr, "xmlBufferDump: buf->content == NULL\n");
return(0);
}
if (file == NULL) file = stdout;
ret = fwrite(buf->content, sizeof(CHAR), buf->use, file);
return(ret);
}
/**
* xmlBufferAdd:
* @buf: the buffer to dump
* @str: the CHAR string
* @len: the number of CHAR to add
*
* Add a string range to an XML buffer.
*/
void
xmlBufferAdd(xmlBufferPtr buf, const CHAR *str, int len) {
const CHAR *cur;
if (str == NULL) {
fprintf(stderr, "xmlBufferAdd: str == NULL\n");
return;
}
for (cur = str;(len > 0) && (*cur != 0);cur++, len--) {
if (buf->use + 10 >= buf->size) {
CHAR *rebuf;
buf->size *= 2;
rebuf = (CHAR *) realloc(buf->content, buf->size * sizeof(CHAR));
if (rebuf == NULL) {
fprintf(stderr, "xmlBufferAdd : out of memory!\n");
return;
}
buf->content = rebuf;
}
buf->content[buf->use++] = *cur;
}
}
/**
* xmlBufferCat:
* @buf: the buffer to dump
* @str: the CHAR string
*
* Append a zero terminated string to an XML buffer.
*/
void
xmlBufferCat(xmlBufferPtr buf, const CHAR *str) {
const CHAR *cur;
if (str == NULL) {
fprintf(stderr, "xmlBufferAdd: str == NULL\n");
return;
}
for (cur = str;*cur != 0;cur++) {
if (buf->use + 10 >= buf->size) {
CHAR *rebuf;
buf->size *= 2;
rebuf = (CHAR *) realloc(buf->content, buf->size * sizeof(CHAR));
if (rebuf == NULL) {
fprintf(stderr, "xmlBufferAdd : out of memory!\n");
return;
}
buf->content = rebuf;
}
buf->content[buf->use++] = *cur;
}
}
/**
* xmlBufferCCat:
* @buf: the buffer to dump
* @str: the C char string
*
* Append a zero terminated C string to an XML buffer.
*/
void
xmlBufferCCat(xmlBufferPtr buf, const char *str) {
const char *cur;
if (str == NULL) {
fprintf(stderr, "xmlBufferAdd: str == NULL\n");
return;
}
for (cur = str;*cur != 0;cur++) {
if (buf->use + 10 >= buf->size) {
CHAR *rebuf;
buf->size *= 2;
rebuf = (CHAR *) realloc(buf->content, buf->size * sizeof(CHAR));
if (rebuf == NULL) {
fprintf(stderr, "xmlBufferAdd : out of memory!\n");
return;
}
buf->content = rebuf;
}
buf->content[buf->use++] = *cur;
}
}
/**
* xmlBufferWriteCHAR:
* @buf: the XML buffer
* @string: the string to add
*
* routine which manage and grows an output buffer. This one add
* CHARs at the end of the array.
* CHARs at the end of the buffer.
*/
void
xmlBufferWriteCHAR(const CHAR *string) {
const CHAR *cur;
if (buffer == NULL) {
buffer_size = 50000;
buffer = (CHAR *) malloc(buffer_size * sizeof(CHAR));
if (buffer == NULL) {
fprintf(stderr, "xmlBufferWrite : out of memory!\n");
exit(1);
}
}
if (string == NULL) return;
for (cur = string;*cur != 0;cur++) {
if (buffer_index + 10 >= buffer_size) {
buffer_size *= 2;
buffer = (CHAR *) realloc(buffer, buffer_size * sizeof(CHAR));
if (buffer == NULL) {
fprintf(stderr, "xmlBufferWrite : out of memory!\n");
exit(1);
}
}
buffer[buffer_index++] = *cur;
}
buffer[buffer_index] = 0;
xmlBufferWriteCHAR(xmlBufferPtr buf, const CHAR *string) {
xmlBufferCat(buf, string);
}
/**
* xmlBufferWriteChar:
* @buf: the XML buffer
* @string: the string to add
*
* routine which manage and grows an output buffer. This one add
* C chars at the end of the array.
*/
void
xmlBufferWriteChar(const char *string) {
const char *cur;
if (buffer == NULL) {
buffer_size = 50000;
buffer = (CHAR *) malloc(buffer_size * sizeof(CHAR));
if (buffer == NULL) {
fprintf(stderr, "xmlBufferWrite : out of memory!\n");
exit(1);
}
}
if (string == NULL) return;
for (cur = string;*cur != 0;cur++) {
if (buffer_index + 10 >= buffer_size) {
buffer_size *= 2;
buffer = (CHAR *) realloc(buffer, buffer_size * sizeof(CHAR));
if (buffer == NULL) {
fprintf(stderr, "xmlBufferWrite : out of memory!\n");
exit(1);
}
}
buffer[buffer_index++] = *cur;
}
buffer[buffer_index] = 0;
xmlBufferWriteChar(xmlBufferPtr buf, const char *string) {
xmlBufferCCat(buf, string);
}
/**
* xmlGlobalNsDump:
* @cur: a namespace
@ -2187,24 +2311,24 @@ xmlBufferWriteChar(const char *string) {
* Dump a global Namespace, this is the old version based on PIs.
*/
static void
xmlGlobalNsDump(xmlNsPtr cur) {
xmlGlobalNsDump(xmlBufferPtr buf, xmlNsPtr cur) {
if (cur == NULL) {
fprintf(stderr, "xmlGlobalNsDump : Ns == NULL\n");
return;
}
if (cur->type == XML_GLOBAL_NAMESPACE) {
xmlBufferWriteChar("<?namespace");
xmlBufferWriteChar(buf, "<?namespace");
if (cur->href != NULL) {
xmlBufferWriteChar(" href=\"");
xmlBufferWriteCHAR(cur->href);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " href=\"");
xmlBufferWriteCHAR(buf, cur->href);
xmlBufferWriteChar(buf, "\"");
}
if (cur->prefix != NULL) {
xmlBufferWriteChar(" AS=\"");
xmlBufferWriteCHAR(cur->prefix);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " AS=\"");
xmlBufferWriteCHAR(buf, cur->prefix);
xmlBufferWriteChar(buf, "\"");
}
xmlBufferWriteChar("?>\n");
xmlBufferWriteChar(buf, "?>\n");
}
}
@ -2215,9 +2339,9 @@ xmlGlobalNsDump(xmlNsPtr cur) {
* Dump a list of global Namespace, this is the old version based on PIs.
*/
static void
xmlGlobalNsListDump(xmlNsPtr cur) {
xmlGlobalNsListDump(xmlBufferPtr buf, xmlNsPtr cur) {
while (cur != NULL) {
xmlGlobalNsDump(cur);
xmlGlobalNsDump(buf, cur);
cur = cur->next;
}
}
@ -2230,7 +2354,7 @@ xmlGlobalNsListDump(xmlNsPtr cur) {
* Should be called in the context of attributes dumps.
*/
static void
xmlNsDump(xmlNsPtr cur) {
xmlNsDump(xmlBufferPtr buf, xmlNsPtr cur) {
if (cur == NULL) {
fprintf(stderr, "xmlNsDump : Ns == NULL\n");
return;
@ -2238,13 +2362,13 @@ xmlNsDump(xmlNsPtr cur) {
if (cur->type == XML_LOCAL_NAMESPACE) {
/* Within the context of an element attributes */
if (cur->prefix != NULL) {
xmlBufferWriteChar(" xmlns:");
xmlBufferWriteCHAR(cur->prefix);
xmlBufferWriteChar(buf, " xmlns:");
xmlBufferWriteCHAR(buf, cur->prefix);
} else
xmlBufferWriteChar(" xmlns");
xmlBufferWriteChar("=\"");
xmlBufferWriteCHAR(cur->href);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " xmlns");
xmlBufferWriteChar(buf, "=\"");
xmlBufferWriteCHAR(buf, cur->href);
xmlBufferWriteChar(buf, "\"");
}
}
@ -2256,9 +2380,9 @@ xmlNsDump(xmlNsPtr cur) {
* Should be called in the context of attributes dumps.
*/
static void
xmlNsListDump(xmlNsPtr cur) {
xmlNsListDump(xmlBufferPtr buf, xmlNsPtr cur) {
while (cur != NULL) {
xmlNsDump(cur);
xmlNsDump(buf, cur);
cur = cur->next;
}
}
@ -2270,44 +2394,44 @@ xmlNsListDump(xmlNsPtr cur) {
* Dump the XML document DTD, if any.
*/
static void
xmlDtdDump(xmlDocPtr doc) {
xmlDtdDump(xmlBufferPtr buf, xmlDocPtr doc) {
xmlDtdPtr cur = doc->intSubset;
if (cur == NULL) {
fprintf(stderr, "xmlDtdDump : no internal subset\n");
return;
}
xmlBufferWriteChar("<!DOCTYPE ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(buf, "<!DOCTYPE ");
xmlBufferWriteCHAR(buf, cur->name);
if (cur->ExternalID != NULL) {
xmlBufferWriteChar(" PUBLIC \"");
xmlBufferWriteCHAR(cur->ExternalID);
xmlBufferWriteChar("\" \"");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " PUBLIC \"");
xmlBufferWriteCHAR(buf, cur->ExternalID);
xmlBufferWriteChar(buf, "\" \"");
xmlBufferWriteCHAR(buf, cur->SystemID);
xmlBufferWriteChar(buf, "\"");
} else if (cur->SystemID != NULL) {
xmlBufferWriteChar(" SYSTEM \"");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " SYSTEM \"");
xmlBufferWriteCHAR(buf, cur->SystemID);
xmlBufferWriteChar(buf, "\"");
}
if ((cur->entities == NULL) && (cur->elements == NULL) &&
(cur->attributes == NULL) && (cur->notations == NULL)) {
xmlBufferWriteChar(">\n");
xmlBufferWriteChar(buf, ">\n");
return;
}
xmlBufferWriteChar(" [\n");
xmlBufferWriteChar(buf, " [\n");
if (cur->entities != NULL)
xmlDumpEntitiesTable((xmlEntitiesTablePtr) cur->entities);
xmlDumpEntitiesTable(buf, (xmlEntitiesTablePtr) cur->entities);
if (cur->notations != NULL)
xmlDumpNotationTable((xmlNotationTablePtr) cur->notations);
xmlDumpNotationTable(buf, (xmlNotationTablePtr) cur->notations);
if (cur->elements != NULL)
xmlDumpElementTable((xmlElementTablePtr) cur->elements);
xmlDumpElementTable(buf, (xmlElementTablePtr) cur->elements);
if (cur->attributes != NULL)
xmlDumpAttributeTable((xmlAttributeTablePtr) cur->attributes);
xmlBufferWriteChar("]");
xmlDumpAttributeTable(buf, (xmlAttributeTablePtr) cur->attributes);
xmlBufferWriteChar(buf, "]");
/* TODO !!! a lot more things to dump ... */
xmlBufferWriteChar(">\n");
xmlBufferWriteChar(buf, ">\n");
}
/**
@ -2318,23 +2442,23 @@ xmlDtdDump(xmlDocPtr doc) {
* Dump an XML attribute
*/
static void
xmlAttrDump(xmlDocPtr doc, xmlAttrPtr cur) {
xmlAttrDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
CHAR *value;
if (cur == NULL) {
fprintf(stderr, "xmlAttrDump : property == NULL\n");
return;
}
xmlBufferWriteChar(" ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(buf, " ");
xmlBufferWriteCHAR(buf, cur->name);
value = xmlNodeListGetString(doc, cur->val, 0);
if (value) {
xmlBufferWriteChar("=\"");
xmlBufferWriteCHAR(value);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, "=\"");
xmlBufferWriteCHAR(buf, value);
xmlBufferWriteChar(buf, "\"");
free(value);
} else {
xmlBufferWriteChar("=\"\"");
xmlBufferWriteChar(buf, "=\"\"");
}
}
@ -2346,20 +2470,20 @@ xmlAttrDump(xmlDocPtr doc, xmlAttrPtr cur) {
* Dump a list of XML attributes
*/
static void
xmlAttrListDump(xmlDocPtr doc, xmlAttrPtr cur) {
xmlAttrListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
if (cur == NULL) {
fprintf(stderr, "xmlAttrListDump : property == NULL\n");
return;
}
while (cur != NULL) {
xmlAttrDump(doc, cur);
xmlAttrDump(buf, doc, cur);
cur = cur->next;
}
}
static void
xmlNodeDump(xmlDocPtr doc, xmlNodePtr cur, int level);
xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level);
/**
* xmlNodeListDump:
* @doc: the document
@ -2369,7 +2493,7 @@ xmlNodeDump(xmlDocPtr doc, xmlNodePtr cur, int level);
* Dump an XML node list, recursive behaviour,children are printed too.
*/
static void
xmlNodeListDump(xmlDocPtr doc, xmlNodePtr cur, int level) {
xmlNodeListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) {
int needIndent = 0, i;
if (cur == NULL) {
@ -2381,15 +2505,15 @@ xmlNodeListDump(xmlDocPtr doc, xmlNodePtr cur, int level) {
(cur->type != XML_ENTITY_REF_NODE)) {
if (!needIndent) {
needIndent = 1;
xmlBufferWriteChar("\n");
xmlBufferWriteChar(buf, "\n");
}
}
xmlNodeDump(doc, cur, level);
xmlNodeDump(buf, doc, cur, level);
cur = cur->next;
}
if ((xmlIndentTreeOutput) && (needIndent))
for (i = 1;i < level;i++)
xmlBufferWriteChar(" ");
xmlBufferWriteChar(buf, " ");
}
/**
@ -2401,7 +2525,7 @@ xmlNodeListDump(xmlDocPtr doc, xmlNodePtr cur, int level) {
* Dump an XML node, recursive behaviour,children are printed too.
*/
static void
xmlNodeDump(xmlDocPtr doc, xmlNodePtr cur, int level) {
xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) {
int i;
if (cur == NULL) {
@ -2410,57 +2534,57 @@ xmlNodeDump(xmlDocPtr doc, xmlNodePtr cur, int level) {
}
if (cur->type == XML_TEXT_NODE) {
if (cur->content != NULL)
xmlBufferWriteCHAR(xmlEncodeEntities(doc, cur->content));
xmlBufferWriteCHAR(buf, xmlEncodeEntities(doc, cur->content));
return;
}
if (cur->type == XML_COMMENT_NODE) {
if (cur->content != NULL) {
xmlBufferWriteChar("<!--");
xmlBufferWriteCHAR(cur->content);
xmlBufferWriteChar("-->");
xmlBufferWriteChar(buf, "<!--");
xmlBufferWriteCHAR(buf, cur->content);
xmlBufferWriteChar(buf, "-->");
}
return;
}
if (cur->type == XML_ENTITY_REF_NODE) {
xmlBufferWriteChar("&");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(";");
xmlBufferWriteChar(buf, "&");
xmlBufferWriteCHAR(buf, cur->name);
xmlBufferWriteChar(buf, ";");
return;
}
if (xmlIndentTreeOutput)
for (i = 0;i < level;i++)
xmlBufferWriteChar(" ");
xmlBufferWriteChar(buf, " ");
xmlBufferWriteChar("<");
xmlBufferWriteChar(buf, "<");
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
xmlBufferWriteCHAR(cur->ns->prefix);
xmlBufferWriteChar(":");
xmlBufferWriteCHAR(buf, cur->ns->prefix);
xmlBufferWriteChar(buf, ":");
}
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteCHAR(buf, cur->name);
if (cur->nsDef)
xmlNsListDump(cur->nsDef);
xmlNsListDump(buf, cur->nsDef);
if (cur->properties != NULL)
xmlAttrListDump(doc, cur->properties);
xmlAttrListDump(buf, doc, cur->properties);
if ((cur->content == NULL) && (cur->childs == NULL)) {
xmlBufferWriteChar("/>\n");
xmlBufferWriteChar(buf, "/>\n");
return;
}
xmlBufferWriteChar(">");
xmlBufferWriteChar(buf, ">");
if (cur->content != NULL)
xmlBufferWriteCHAR(xmlEncodeEntities(doc, cur->content));
xmlBufferWriteCHAR(buf, xmlEncodeEntities(doc, cur->content));
if (cur->childs != NULL) {
xmlNodeListDump(doc, cur->childs, level + 1);
xmlNodeListDump(buf, doc, cur->childs, level + 1);
}
xmlBufferWriteChar("</");
xmlBufferWriteChar(buf, "</");
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
xmlBufferWriteCHAR(cur->ns->prefix);
xmlBufferWriteChar(":");
xmlBufferWriteCHAR(buf, cur->ns->prefix);
xmlBufferWriteChar(buf, ":");
}
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(">\n");
xmlBufferWriteCHAR(buf, cur->name);
xmlBufferWriteChar(buf, ">\n");
}
/**
@ -2470,36 +2594,36 @@ xmlNodeDump(xmlDocPtr doc, xmlNodePtr cur, int level) {
* Dump an XML document.
*/
static void
xmlDocContentDump(xmlDocPtr cur) {
xmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur) {
if (oldXMLWDcompatibility)
xmlBufferWriteChar("<?XML version=\"");
xmlBufferWriteChar(buf, "<?XML version=\"");
else
xmlBufferWriteChar("<?xml version=\"");
xmlBufferWriteCHAR(cur->version);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, "<?xml version=\"");
xmlBufferWriteCHAR(buf, cur->version);
xmlBufferWriteChar(buf, "\"");
if (cur->encoding != NULL) {
xmlBufferWriteChar(" encoding=\"");
xmlBufferWriteCHAR(cur->encoding);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " encoding=\"");
xmlBufferWriteCHAR(buf, cur->encoding);
xmlBufferWriteChar(buf, "\"");
}
switch (cur->standalone) {
case 0:
xmlBufferWriteChar(" standalone=\"no\"");
xmlBufferWriteChar(buf, " standalone=\"no\"");
break;
case 1:
xmlBufferWriteChar(" standalone=\"yes\"");
xmlBufferWriteChar(buf, " standalone=\"yes\"");
break;
}
xmlBufferWriteChar("?>\n");
xmlBufferWriteChar(buf, "?>\n");
if (cur->intSubset != NULL)
xmlDtdDump(cur);
xmlDtdDump(buf, cur);
if (cur->root != NULL) {
/* global namespace definitions, the old way */
if (oldXMLWDcompatibility)
xmlGlobalNsListDump(cur->oldNs);
xmlGlobalNsListDump(buf, cur->oldNs);
else
xmlUpgradeOldNs(cur);
xmlNodeDump(cur, cur->root, 0);
xmlNodeDump(buf, cur, cur->root, 0);
}
}
@ -2514,6 +2638,8 @@ xmlDocContentDump(xmlDocPtr cur) {
*/
void
xmlDocDumpMemory(xmlDocPtr cur, CHAR**mem, int *size) {
xmlBufferPtr buf;
if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlDocDumpMemory : document == NULL\n");
@ -2522,11 +2648,17 @@ xmlDocDumpMemory(xmlDocPtr cur, CHAR**mem, int *size) {
*size = 0;
return;
}
buffer_index = 0;
xmlDocContentDump(cur);
*mem = buffer;
*size = buffer_index;
buf = xmlBufferCreate();
if (buf == NULL) {
*mem = NULL;
*size = 0;
return;
}
xmlDocContentDump(buf, cur);
*mem = buf->content;
*size = buf->use;
memset(buf, -1, sizeof(xmlBuffer));
free(buf);
}
/**
@ -2592,16 +2724,19 @@ xmlSetCompressMode(int mode) {
*/
void
xmlDocDump(FILE *f, xmlDocPtr cur) {
xmlBufferPtr buf;
if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "xmlDocDump : document == NULL\n");
#endif
return;
}
buffer_index = 0;
xmlDocContentDump(cur);
fwrite(buffer, sizeof(CHAR), buffer_index, f);
buf = xmlBufferCreate();
if (buf == NULL) return;
xmlDocContentDump(buf, cur);
xmlBufferDump(f, buf);
xmlBufferFree(buf);
}
/**
@ -2615,6 +2750,7 @@ xmlDocDump(FILE *f, xmlDocPtr cur) {
*/
int
xmlSaveFile(const char *filename, xmlDocPtr cur) {
xmlBufferPtr buf;
#ifdef HAVE_ZLIB_H
gzFile zoutput = NULL;
char mode[15];
@ -2622,6 +2758,13 @@ xmlSaveFile(const char *filename, xmlDocPtr cur) {
FILE *output = NULL;
int ret;
/*
* save the content to a temp buffer.
*/
buf = xmlBufferCreate();
if (buf == NULL) return(0);
xmlDocContentDump(buf, cur);
#ifdef HAVE_ZLIB_H
if ((cur->compression > 0) && (cur->compression <= 9)) {
sprintf(mode, "w%d", cur->compression);
@ -2635,21 +2778,19 @@ xmlSaveFile(const char *filename, xmlDocPtr cur) {
}
#endif
/*
* save the content to a temp buffer.
*/
buffer_index = 0;
xmlDocContentDump(cur);
xmlDocContentDump(buf, cur);
#ifdef HAVE_ZLIB_H
if (zoutput != NULL) {
ret = gzwrite(zoutput, buffer, sizeof(CHAR) * buffer_index);
ret = gzwrite(zoutput, buf->content, sizeof(CHAR) * buf->use);
gzclose(zoutput);
return(ret);
} else {
#endif
ret = xmlBufferDump(output, buf);
fclose(output);
#ifdef HAVE_ZLIB_H
}
#endif
ret = fwrite(buffer, sizeof(CHAR), buffer_index, output);
fclose(output);
return(ret * sizeof(CHAR));
}

27
tree.h
View File

@ -240,6 +240,18 @@ typedef struct xmlDoc {
typedef _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
/*
* A buffer structure
*/
typedef struct xmlBuffer {
CHAR *content; /* The buffer content UTF8 */
unsigned int use; /* The buffer size used */
unsigned int size; /* The buffer size */
} _xmlBuffer;
typedef _xmlBuffer xmlBuffer;
typedef xmlBuffer *xmlBufferPtr;
/*
* Variables.
*/
@ -247,6 +259,17 @@ extern xmlNsPtr baseDTD;
extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
/*
* Handling Buffers.
*/
xmlBufferPtr xmlBufferCreate(void);
void xmlBufferFree(xmlBufferPtr buf);
int xmlBufferDump(FILE *file, xmlBufferPtr buf);
void xmlBufferAdd(xmlBufferPtr buf, const CHAR *str, int len);
void xmlBufferCat(xmlBufferPtr buf, const CHAR *str);
void xmlBufferCCat(xmlBufferPtr buf, const char *str);
/*
* Creating/freeing new structures
*/
@ -337,8 +360,8 @@ CHAR *xmlNodeGetContent(xmlNodePtr cur);
/*
* Internal, don't use
*/
void xmlBufferWriteCHAR(const CHAR *string);
void xmlBufferWriteChar(const char *string);
void xmlBufferWriteCHAR(xmlBufferPtr buf, const CHAR *string);
void xmlBufferWriteChar(xmlBufferPtr buf, const char *string);
/*
* Saving

144
valid.c
View File

@ -101,67 +101,65 @@ xmlFreeElementContent(xmlElementContentPtr cur) {
/**
* xmlDumpElementContent:
* @buf: An XML buffer
* @content: An element table
* @glob: 1 if one must print the englobing parenthesis, 0 otherwise
*
* This will dump the content of the element table as an XML DTD definition
*
* NOTE: TODO an extra parameter allowing a reentant implementation will
* be added.
*/
void
xmlDumpElementContent(xmlElementContentPtr content, int glob) {
xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) {
if (content == NULL) return;
if (glob) xmlBufferWriteChar("(");
if (glob) xmlBufferWriteChar(buf, "(");
switch (content->type) {
case XML_ELEMENT_CONTENT_PCDATA:
xmlBufferWriteChar("#PCDATA");
xmlBufferWriteChar(buf, "#PCDATA");
break;
case XML_ELEMENT_CONTENT_ELEMENT:
xmlBufferWriteCHAR(content->name);
xmlBufferWriteCHAR(buf, content->name);
break;
case XML_ELEMENT_CONTENT_SEQ:
if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
(content->c1->type == XML_ELEMENT_CONTENT_SEQ))
xmlDumpElementContent(content->c1, 1);
xmlDumpElementContent(buf, content->c1, 1);
else
xmlDumpElementContent(content->c1, 0);
xmlBufferWriteChar(" , ");
xmlDumpElementContent(buf, content->c1, 0);
xmlBufferWriteChar(buf, " , ");
if (content->c2->type == XML_ELEMENT_CONTENT_OR)
xmlDumpElementContent(content->c2, 1);
xmlDumpElementContent(buf, content->c2, 1);
else
xmlDumpElementContent(content->c2, 0);
xmlDumpElementContent(buf, content->c2, 0);
break;
case XML_ELEMENT_CONTENT_OR:
if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
(content->c1->type == XML_ELEMENT_CONTENT_SEQ))
xmlDumpElementContent(content->c1, 1);
xmlDumpElementContent(buf, content->c1, 1);
else
xmlDumpElementContent(content->c1, 0);
xmlBufferWriteChar(" | ");
xmlDumpElementContent(buf, content->c1, 0);
xmlBufferWriteChar(buf, " | ");
if (content->c2->type == XML_ELEMENT_CONTENT_SEQ)
xmlDumpElementContent(content->c2, 1);
xmlDumpElementContent(buf, content->c2, 1);
else
xmlDumpElementContent(content->c2, 0);
xmlDumpElementContent(buf, content->c2, 0);
break;
default:
fprintf(stderr, "xmlDumpElementContent: unknown type %d\n",
content->type);
}
if (glob)
xmlBufferWriteChar(")");
xmlBufferWriteChar(buf, ")");
switch (content->ocur) {
case XML_ELEMENT_CONTENT_ONCE:
break;
case XML_ELEMENT_CONTENT_OPT:
xmlBufferWriteChar("?");
xmlBufferWriteChar(buf, "?");
break;
case XML_ELEMENT_CONTENT_MULT:
xmlBufferWriteChar("*");
xmlBufferWriteChar(buf, "*");
break;
case XML_ELEMENT_CONTENT_PLUS:
xmlBufferWriteChar("+");
xmlBufferWriteChar(buf, "+");
break;
}
}
@ -404,7 +402,7 @@ xmlCopyElementTable(xmlElementTablePtr table) {
* be added.
*/
void
xmlDumpElementTable(xmlElementTablePtr table) {
xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) {
int i;
xmlElementPtr cur;
@ -414,28 +412,28 @@ xmlDumpElementTable(xmlElementTablePtr table) {
cur = &table->table[i];
switch (cur->type) {
case XML_ELEMENT_TYPE_EMPTY:
xmlBufferWriteChar("<!ELEMENT ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(" EMPTY>\n");
xmlBufferWriteChar(buf, "<!ELEMENT ");
xmlBufferWriteCHAR(buf, cur->name);
xmlBufferWriteChar(buf, " EMPTY>\n");
break;
case XML_ELEMENT_TYPE_ANY:
xmlBufferWriteChar("<!ELEMENT ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(" ANY>\n");
xmlBufferWriteChar(buf, "<!ELEMENT ");
xmlBufferWriteCHAR(buf, cur->name);
xmlBufferWriteChar(buf, " ANY>\n");
break;
case XML_ELEMENT_TYPE_MIXED:
xmlBufferWriteChar("<!ELEMENT ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(" ");
xmlDumpElementContent(cur->content, 1);
xmlBufferWriteChar(">\n");
xmlBufferWriteChar(buf, "<!ELEMENT ");
xmlBufferWriteCHAR(buf, cur->name);
xmlBufferWriteChar(buf, " ");
xmlDumpElementContent(buf, cur->content, 1);
xmlBufferWriteChar(buf, ">\n");
break;
case XML_ELEMENT_TYPE_ELEMENT:
xmlBufferWriteChar("<!ELEMENT ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(" ");
xmlDumpElementContent(cur->content, 1);
xmlBufferWriteChar(">\n");
xmlBufferWriteChar(buf, "<!ELEMENT ");
xmlBufferWriteCHAR(buf, cur->name);
xmlBufferWriteChar(buf, " ");
xmlDumpElementContent(buf, cur->content, 1);
xmlBufferWriteChar(buf, ">\n");
break;
default:
fprintf(stderr,
@ -765,7 +763,7 @@ xmlCopyAttributeTable(xmlAttributeTablePtr table) {
* be added.
*/
void
xmlDumpAttributeTable(xmlAttributeTablePtr table) {
xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) {
int i;
xmlAttributePtr cur;
@ -773,40 +771,40 @@ xmlDumpAttributeTable(xmlAttributeTablePtr table) {
for (i = 0;i < table->nb_attributes;i++) {
cur = &table->table[i];
xmlBufferWriteChar("<!ATTLIST ");
xmlBufferWriteCHAR(cur->elem);
xmlBufferWriteChar(" ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(buf, "<!ATTLIST ");
xmlBufferWriteCHAR(buf, cur->elem);
xmlBufferWriteChar(buf, " ");
xmlBufferWriteCHAR(buf, cur->name);
switch (cur->type) {
case XML_ATTRIBUTE_CDATA:
xmlBufferWriteChar(" CDATA");
xmlBufferWriteChar(buf, " CDATA");
break;
case XML_ATTRIBUTE_ID:
xmlBufferWriteChar(" ID");
xmlBufferWriteChar(buf, " ID");
break;
case XML_ATTRIBUTE_IDREF:
xmlBufferWriteChar(" IDREF");
xmlBufferWriteChar(buf, " IDREF");
break;
case XML_ATTRIBUTE_IDREFS:
xmlBufferWriteChar(" IDREFS");
xmlBufferWriteChar(buf, " IDREFS");
break;
case XML_ATTRIBUTE_ENTITY:
xmlBufferWriteChar(" ENTITY");
xmlBufferWriteChar(buf, " ENTITY");
break;
case XML_ATTRIBUTE_ENTITIES:
xmlBufferWriteChar(" ENTITIES");
xmlBufferWriteChar(buf, " ENTITIES");
break;
case XML_ATTRIBUTE_NMTOKEN:
xmlBufferWriteChar(" NMTOKEN");
xmlBufferWriteChar(buf, " NMTOKEN");
break;
case XML_ATTRIBUTE_NMTOKENS:
xmlBufferWriteChar(" NMTOKENS");
xmlBufferWriteChar(buf, " NMTOKENS");
break;
case XML_ATTRIBUTE_ENUMERATION:
xmlBufferWriteChar(" (pbm)");
xmlBufferWriteChar(buf, " (pbm)");
break;
case XML_ATTRIBUTE_NOTATION:
xmlBufferWriteChar(" NOTATION (pbm)");
xmlBufferWriteChar(buf, " NOTATION (pbm)");
break;
default:
fprintf(stderr,
@ -817,27 +815,27 @@ xmlDumpAttributeTable(xmlAttributeTablePtr table) {
case XML_ATTRIBUTE_NONE:
break;
case XML_ATTRIBUTE_REQUIRED:
xmlBufferWriteChar(" #REQUIRED");
xmlBufferWriteChar(buf, " #REQUIRED");
break;
case XML_ATTRIBUTE_IMPLIED:
xmlBufferWriteChar(" #IMPLIED");
xmlBufferWriteChar(buf, " #IMPLIED");
if (cur->defaultValue != NULL) {
xmlBufferWriteChar(" \"");
xmlBufferWriteCHAR(cur->defaultValue);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " \"");
xmlBufferWriteCHAR(buf, cur->defaultValue);
xmlBufferWriteChar(buf, "\"");
}
break;
case XML_ATTRIBUTE_FIXED:
xmlBufferWriteChar(" #FIXED \"");
xmlBufferWriteCHAR(cur->defaultValue);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " #FIXED \"");
xmlBufferWriteCHAR(buf, cur->defaultValue);
xmlBufferWriteChar(buf, "\"");
break;
default:
fprintf(stderr,
"xmlDumpAttributeTable: internal: unknown default %d\n",
cur->def);
}
xmlBufferWriteChar(">\n");
xmlBufferWriteChar(buf, ">\n");
}
}
@ -1063,7 +1061,7 @@ xmlCopyNotationTable(xmlNotationTablePtr table) {
* be added.
*/
void
xmlDumpNotationTable(xmlNotationTablePtr table) {
xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
int i;
xmlNotationPtr cur;
@ -1071,20 +1069,20 @@ xmlDumpNotationTable(xmlNotationTablePtr table) {
for (i = 0;i < table->nb_notations;i++) {
cur = &table->table[i];
xmlBufferWriteChar("<!NOTATION ");
xmlBufferWriteCHAR(cur->name);
xmlBufferWriteChar(buf, "<!NOTATION ");
xmlBufferWriteCHAR(buf, cur->name);
if (cur->PublicID != NULL) {
xmlBufferWriteChar(" PUBLIC \"");
xmlBufferWriteCHAR(cur->PublicID);
xmlBufferWriteChar("\"");
xmlBufferWriteChar(buf, " PUBLIC \"");
xmlBufferWriteCHAR(buf, cur->PublicID);
xmlBufferWriteChar(buf, "\"");
if (cur->SystemID != NULL) {
xmlBufferWriteChar(" ");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar(buf, " ");
xmlBufferWriteCHAR(buf, cur->SystemID);
}
} else {
xmlBufferWriteChar(" SYSTEM ");
xmlBufferWriteCHAR(cur->SystemID);
xmlBufferWriteChar(buf, " SYSTEM ");
xmlBufferWriteCHAR(buf, cur->SystemID);
}
xmlBufferWriteChar(" >\n");
xmlBufferWriteChar(buf, " >\n");
}
}

View File

@ -58,7 +58,7 @@ xmlNotationPtr xmlAddNotationDecl(xmlDtdPtr dtd, const CHAR *name,
const CHAR *PublicID, const CHAR *SystemID);
xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
void xmlFreeNotationTable(xmlNotationTablePtr table);
void xmlDumpNotationTable(xmlNotationTablePtr table);
void xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table);
/* Element Content */
xmlElementContentPtr xmlNewElementContent(CHAR *name, int type);
@ -70,7 +70,7 @@ xmlElementPtr xmlAddElementDecl(xmlDtdPtr dtd, const CHAR *name, int type,
xmlElementContentPtr content);
xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table);
void xmlFreeElementTable(xmlElementTablePtr table);
void xmlDumpElementTable(xmlElementTablePtr table);
void xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table);
/* Enumeration */
xmlEnumerationPtr xmlCreateEnumeration(CHAR *name);
@ -83,6 +83,6 @@ xmlAttributePtr xmlAddAttributeDecl(xmlDtdPtr dtd, const CHAR *elem,
const CHAR *defaultValue, xmlEnumerationPtr tree);
xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table);
void xmlFreeAttributeTable(xmlAttributeTablePtr table);
void xmlDumpAttributeTable(xmlAttributeTablePtr table);
void xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table);
#endif /* __XML_VALID_H__ */