1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-09 04:58:16 +03:00

Followup to LibXML2 docs/examples cleanup patch

This commit is contained in:
Daniel Veillard 2012-09-08 21:09:26 +08:00
parent f933c89813
commit e00778b492
3 changed files with 131 additions and 130 deletions

View File

@ -1,134 +1,135 @@
# Beware this is autogenerated by index.py
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include $(THREAD_CFLAGS) $(Z_CFLAGS)
DEPS = $(top_builddir)/libxml2.la
LDADDS = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm $(WIN32_EXTRA_LIBADD)
##
## This file is auto-generated by index.py
## DO NOT EDIT !!!
##
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include
AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS)
LDADD = $(RDL_LIBS) $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm $(WIN32_EXTRA_LIBADD)
CLEANFILES = *.tmp
if REBUILD_DOCS
rebuild: examples.xml index.html
.PHONY: rebuild
examples.xml: index.py $(noinst_PROGRAMS:=.c)
-@($(srcdir)/index.py)
cd $(srcdir) && $(PYTHON) index.py
$(MAKE) Makefile
index.html: examples.xml examples.xsl
-@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html)
cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page"
-cd $(srcdir) && xmllint --valid --noout index.html
endif
install-data-local:
$(MKDIR_P) $(DESTDIR)$(HTML_DIR)
-$(INSTALL) -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
EXTRA_DIST=examples.xsl index.py test2.xml tst.xml examples.xml test1.xml writer.xml test3.xml io2.res reader4.res tree2.res xpath2.res xpath1.res reader3.res reader1.res tree1.res io1.res
clean-local:
test -f Makefile.am || rm -f test?.xml
noinst_PROGRAMS=xpath1 parse3 reader2 tree2 io1 parse4 xpath2 io2 reader1 tree1 reader3 parse2 parse1 reader4 testWriter
EXTRA_DIST = \
examples.xml \
examples.xsl \
index.html \
index.py \
io1.res \
io2.res \
reader1.res \
reader3.res \
reader4.res \
test1.xml \
test2.xml \
test3.xml \
tree1.res \
tree2.res \
tst.xml \
writer.xml \
xpath1.res \
xpath2.res
xpath1_SOURCES=xpath1.c
xpath1_LDFLAGS=
xpath1_DEPENDENCIES= $(DEPS)
xpath1_LDADD= $(RDL_LIBS) $(LDADDS)
noinst_PROGRAMS = \
io1 \
io2 \
parse1 \
parse2 \
parse3 \
parse4 \
reader1 \
reader2 \
reader3 \
reader4 \
testWriter \
tree1 \
tree2 \
xpath1 \
xpath2
parse3_SOURCES=parse3.c
parse3_LDFLAGS=
parse3_DEPENDENCIES= $(DEPS)
parse3_LDADD= $(RDL_LIBS) $(LDADDS)
io1_SOURCES = io1.c
reader2_SOURCES=reader2.c
reader2_LDFLAGS=
reader2_DEPENDENCIES= $(DEPS)
reader2_LDADD= $(RDL_LIBS) $(LDADDS)
io2_SOURCES = io2.c
tree2_SOURCES=tree2.c
tree2_LDFLAGS=
tree2_DEPENDENCIES= $(DEPS)
tree2_LDADD= $(RDL_LIBS) $(LDADDS)
parse1_SOURCES = parse1.c
io1_SOURCES=io1.c
io1_LDFLAGS=
io1_DEPENDENCIES= $(DEPS)
io1_LDADD= $(RDL_LIBS) $(LDADDS)
parse2_SOURCES = parse2.c
parse4_SOURCES=parse4.c
parse4_LDFLAGS=
parse4_DEPENDENCIES= $(DEPS)
parse4_LDADD= $(RDL_LIBS) $(LDADDS)
parse3_SOURCES = parse3.c
xpath2_SOURCES=xpath2.c
xpath2_LDFLAGS=
xpath2_DEPENDENCIES= $(DEPS)
xpath2_LDADD= $(RDL_LIBS) $(LDADDS)
parse4_SOURCES = parse4.c
io2_SOURCES=io2.c
io2_LDFLAGS=
io2_DEPENDENCIES= $(DEPS)
io2_LDADD= $(RDL_LIBS) $(LDADDS)
reader1_SOURCES = reader1.c
reader1_SOURCES=reader1.c
reader1_LDFLAGS=
reader1_DEPENDENCIES= $(DEPS)
reader1_LDADD= $(RDL_LIBS) $(LDADDS)
reader2_SOURCES = reader2.c
tree1_SOURCES=tree1.c
tree1_LDFLAGS=
tree1_DEPENDENCIES= $(DEPS)
tree1_LDADD= $(RDL_LIBS) $(LDADDS)
reader3_SOURCES = reader3.c
reader3_SOURCES=reader3.c
reader3_LDFLAGS=
reader3_DEPENDENCIES= $(DEPS)
reader3_LDADD= $(RDL_LIBS) $(LDADDS)
reader4_SOURCES = reader4.c
parse2_SOURCES=parse2.c
parse2_LDFLAGS=
parse2_DEPENDENCIES= $(DEPS)
parse2_LDADD= $(RDL_LIBS) $(LDADDS)
testWriter_SOURCES = testWriter.c
parse1_SOURCES=parse1.c
parse1_LDFLAGS=
parse1_DEPENDENCIES= $(DEPS)
parse1_LDADD= $(RDL_LIBS) $(LDADDS)
tree1_SOURCES = tree1.c
reader4_SOURCES=reader4.c
reader4_LDFLAGS=
reader4_DEPENDENCIES= $(DEPS)
reader4_LDADD= $(RDL_LIBS) $(LDADDS)
tree2_SOURCES = tree2.c
testWriter_SOURCES=testWriter.c
testWriter_LDFLAGS=
testWriter_DEPENDENCIES= $(DEPS)
testWriter_LDADD= $(RDL_LIBS) $(LDADDS)
xpath1_SOURCES = xpath1.c
xpath2_SOURCES = xpath2.c
valgrind:
$(MAKE) CHECKER='valgrind' tests
tests: $(noinst_PROGRAMS)
test -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .
@(echo '## examples regression tests')
@(echo > .memdump)
@($(CHECKER) ./xpath1 $(srcdir)/test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp $(srcdir)/xpath1.res ; rm xpath1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./parse3)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./reader2 $(srcdir)/test2.xml > reader1.tmp ; diff reader1.tmp $(srcdir)/reader1.res ; rm reader1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./tree2 > tree2.tmp ; diff tree2.tmp $(srcdir)/tree2.res ; rm tree2.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp $(srcdir)/io1.res ; rm -f io1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./parse4 $(srcdir)/test3.xml)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./xpath2 $(srcdir)/test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp $(srcdir)/xpath2.res ; rm xpath2.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./io2 > io2.tmp ; diff io2.tmp $(srcdir)/io2.res ; rm -f io2.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./reader1 $(srcdir)/test2.xml > reader1.tmp ; diff reader1.tmp $(srcdir)/reader1.res ; rm reader1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./tree1 $(srcdir)/test2.xml > tree1.tmp ; diff tree1.tmp $(srcdir)/tree1.res ; rm tree1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./reader3 $(srcdir)/test3.xml preserved > reader3.tmp ; diff reader3.tmp $(srcdir)/reader3.res ; rm reader3.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./parse2 $(srcdir)/test2.xml)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./parse1 $(srcdir)/test1.xml)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./reader4 $(srcdir)/test1.xml $(srcdir)/test2.xml $(srcdir)/test3.xml > reader4.tmp ; diff reader4.tmp $(srcdir)/reader4.res ; rm reader4.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@($(CHECKER) ./testWriter ; for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.res ; done ; rm writer*.res)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
$(CHECKER) ./io1 > io1.tmp && diff io1.tmp $(srcdir)/io1.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./io2 > io2.tmp && diff io2.tmp $(srcdir)/io2.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./parse1 test1.xml
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./parse2 test2.xml
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./parse3
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./parse4 test3.xml
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./reader1 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./reader2 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./reader3 > reader3.tmp && diff reader3.tmp $(srcdir)/reader3.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp && diff reader4.tmp $(srcdir)/reader4.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./testWriter && for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./tree1 test2.xml > tree1.tmp && diff tree1.tmp $(srcdir)/tree1.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./tree2 > tree2.tmp && diff tree2.tmp $(srcdir)/tree2.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./xpath1 test3.xml '//child2' > xpath1.tmp && diff xpath1.tmp $(srcdir)/xpath1.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
$(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res
@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0

View File

@ -3,7 +3,7 @@
<synopsis>Evaluate XPath expression and prints result node set.</synopsis>
<purpose>Shows how to evaluate XPath expression and register known namespaces in XPath context.</purpose>
<usage>xpath1 &lt;xml-file&gt; &lt;xpath-expr&gt; [&lt;known-ns-list&gt;]</usage>
<test>./xpath1 test3.xml &apos;//child2&apos; &gt; xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp</test>
<test>xpath1 test3.xml &apos;//child2&apos; &gt; xpath1.tmp &amp;&amp; diff xpath1.tmp $(srcdir)/xpath1.res</test>
<author>Aleksey Sanin</author>
<copy>see Copyright for the status of this software. </copy>
<section>XPath</section>
@ -62,7 +62,7 @@
<synopsis>Parse and validate an XML file with an xmlReader</synopsis>
<purpose>Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting. (Note that the XMLReader functions require libxml2 version later than 2.6.)</purpose>
<usage>reader2 &lt;valid_xml_filename&gt;</usage>
<test>reader2 test2.xml &gt; reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp</test>
<test>reader2 test2.xml &gt; reader1.tmp &amp;&amp; diff reader1.tmp $(srcdir)/reader1.res</test>
<author>Daniel Veillard</author>
<copy>see Copyright for the status of this software. </copy>
<section>xmlReader</section>
@ -94,7 +94,7 @@
<synopsis>Creates a tree</synopsis>
<purpose>Shows how to create document, nodes and dump it to stdout or file.</purpose>
<usage>tree2 &lt;filename&gt; -Default output: stdout</usage>
<test>tree2 &gt; tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp</test>
<test>tree2 &gt; tree2.tmp &amp;&amp; diff tree2.tmp $(srcdir)/tree2.res</test>
<author>Lucas Brasilino &lt;brasilino@recife.pe.gov.br&gt;</author>
<copy>see Copyright for the status of this software </copy>
<section>Tree</section>
@ -122,7 +122,7 @@
<synopsis>Example of custom Input/Output</synopsis>
<purpose>Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way.</purpose>
<usage>io1</usage>
<test>io1 &gt; io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp</test>
<test>io1 &gt; io1.tmp &amp;&amp; diff io1.tmp $(srcdir)/io1.res</test>
<author>Daniel Veillard</author>
<copy>see Copyright for the status of this software. </copy>
<section>InputOutput</section>
@ -172,7 +172,7 @@
<synopsis>Load a document, locate subelements with XPath, modify said elements and save the resulting document.</synopsis>
<purpose>Shows how to make a full round-trip from a load/edit/save</purpose>
<usage>xpath2 &lt;xml-file&gt; &lt;xpath-expr&gt; &lt;new-value&gt;</usage>
<test>xpath2 test3.xml &apos;//discarded&apos; discarded &gt; xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp</test>
<test>xpath2 test3.xml &apos;//discarded&apos; discarded &gt; xpath2.tmp &amp;&amp; diff xpath2.tmp $(srcdir)/xpath2.res</test>
<author>Aleksey Sanin and Daniel Veillard</author>
<copy>see Copyright for the status of this software. </copy>
<section>XPath</section>
@ -202,7 +202,7 @@
<synopsis>Output to char buffer</synopsis>
<purpose>Demonstrate the use of xmlDocDumpMemory to output document to a character buffer</purpose>
<usage>io2</usage>
<test>io2 &gt; io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp</test>
<test>io2 &gt; io2.tmp &amp;&amp; diff io2.tmp $(srcdir)/io2.res</test>
<author>John Fleck</author>
<copy>see Copyright for the status of this software. </copy>
<section>InputOutput</section>
@ -224,7 +224,7 @@
<synopsis>Parse an XML file with an xmlReader</synopsis>
<purpose>Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process. (Note that the XMLReader functions require libxml2 version later than 2.6.)</purpose>
<usage>reader1 &lt;filename&gt;</usage>
<test>reader1 test2.xml &gt; reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp</test>
<test>reader1 test2.xml &gt; reader1.tmp &amp;&amp; diff reader1.tmp $(srcdir)/reader1.res</test>
<author>Daniel Veillard</author>
<copy>see Copyright for the status of this software. </copy>
<section>xmlReader</section>
@ -249,7 +249,7 @@
<synopsis>Navigates a tree to print element names</synopsis>
<purpose>Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order.</purpose>
<usage>tree1 filename_or_URL</usage>
<test>tree1 test2.xml &gt; tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp</test>
<test>tree1 test2.xml &gt; tree1.tmp &amp;&amp; diff tree1.tmp $(srcdir)/tree1.res</test>
<author>Dodji Seketeli</author>
<copy>see Copyright for the status of this software. </copy>
<section>Tree</section>
@ -267,7 +267,7 @@
<synopsis>Show how to extract subdocuments with xmlReader</synopsis>
<purpose>Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.)</purpose>
<usage>reader3</usage>
<test>reader3 &gt; reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp</test>
<test>reader3 &gt; reader3.tmp &amp;&amp; diff reader3.tmp $(srcdir)/reader3.res</test>
<author>Daniel Veillard</author>
<copy>see Copyright for the status of this software. </copy>
<section>xmlReader</section>
@ -324,7 +324,7 @@
<synopsis>Parse multiple XML files reusing an xmlReader</synopsis>
<purpose>Demonstrate the use of xmlReaderForFile() and xmlReaderNewFile to parse XML files while reusing the reader object and parser context. (Note that the XMLReader functions require libxml2 version later than 2.6.)</purpose>
<usage>reader4 &lt;filename&gt; [ filename ... ]</usage>
<test>reader4 test1.xml test2.xml test3.xml &gt; reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp</test>
<test>reader4 test1.xml test2.xml test3.xml &gt; reader4.tmp &amp;&amp; diff reader4.tmp $(srcdir)/reader4.res</test>
<author>Graham Bennett</author>
<copy>see Copyright for the status of this software. </copy>
<section>xmlReader</section>
@ -344,7 +344,7 @@
<synopsis>use various APIs for the xmlWriter</synopsis>
<purpose>tests a number of APIs for the xmlWriter, especially the various methods to write to a filename, to a memory buffer, to a new document, or to a subtree. It shows how to do encoding string conversions too. The resulting documents are then serialized.</purpose>
<usage>testWriter</usage>
<test>testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res</test>
<test>testWriter &amp;&amp; for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done</test>
<author>Alfred Mickautsch</author>
<copy>see Copyright for the status of this software. </copy>
<section>xmlWriter</section>

View File

@ -177,10 +177,10 @@ def parse(filename, output):
type = id.get_type()
output.write(" <%s line='%d' name='%s'/>\n" % (type,
line, name))
output.write(" </uses>\n")
output.write(" </example>\n")
return idx
def dump_symbols(output):
@ -280,23 +280,23 @@ clean-local:
print "Updated Makefile.am"
except:
print "Failed to read or save Makefile.am"
#
# Autogenerate the .cvsignore too ...
#
ignore = """.memdump
Makefile.in
Makefile
"""
for example in examples:
ignore = ignore + "%s\n" % (example)
try:
old = open(".cvsignore", "r").read()
if old != ignore:
n = open(".cvsignore", "w").write(ignore)
print "Updated .cvsignore"
except:
print "Failed to read or save .cvsignore"
# #
# # Autogenerate the .cvsignore too ... DEPRECATED
# #
# ignore = """.memdump
#Makefile.in
#Makefile
#"""
# for example in examples:
# ignore = ignore + "%s\n" % (example)
# try:
# old = open(".cvsignore", "r").read()
# if old != ignore:
# n = open(".cvsignore", "w").write(ignore)
# print "Updated .cvsignore"
# except:
# print "Failed to read or save .cvsignore"
if __name__ == "__main__":
load_api()
output = open("examples.xml", "w")