mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-12 09:17:37 +03:00
Work done on the plane, ready to release libxml2-2.0.0, Daniel
This commit is contained in:
parent
ec30341c5c
commit
361d845de0
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
Mon Apr 3 21:47:10 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||
|
||||
* configure.in: preparing libxml-2.0.0 version looks Ok so far
|
||||
* README TODO: updated for release
|
||||
* uri.c uri.h: added authority parsing/saving
|
||||
* uri.c testURI.c Makefile.am: moved the testing code to testURI.c
|
||||
* xmlversion.h.in configure.in nanoftp.[ch] nanohttp.[ch] encoding.h
|
||||
debugXML.[ch] xpath.[ch] xmlIO.c tester.c testXPath.c testHTML.c
|
||||
tree.c HTMLtree.c HTMLparser.c tree.c tree.h parser.c
|
||||
Makefile.am : added compile-time customization of libxml
|
||||
--with-ftp --with-http --with-html --with-xpath --with-debug
|
||||
--with-mem-debug
|
||||
* *.[ch] autoconf.sh : moved to an absolute adressing of includes :
|
||||
#include <libxml/xxx.h> I hope it won't break too much stuff
|
||||
and will be manageable in the future...
|
||||
* xmllint.c Makefile.am libxml.spec.in : renamed tester.c to xmllint.c
|
||||
and added xmllint to the installed programs
|
||||
* uri.h: added xmlFreeURI()
|
||||
|
||||
Fri Mar 24 14:35:21 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||
|
||||
* uri.c uri.h: finished the escaping handling, the base support
|
||||
|
21
HTMLparser.c
21
HTMLparser.c
@ -12,6 +12,9 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xmlversion.h"
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* for memset() only */
|
||||
#ifdef HAVE_CTYPE_H
|
||||
@ -33,14 +36,14 @@
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "tree.h"
|
||||
#include "HTMLparser.h"
|
||||
#include "entities.h"
|
||||
#include "encoding.h"
|
||||
#include "valid.h"
|
||||
#include "parserInternals.h"
|
||||
#include "xmlIO.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/encoding.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include "xml-error.h"
|
||||
|
||||
#define HTML_MAX_NAMELEN 1000
|
||||
@ -3843,3 +3846,5 @@ htmlDocPtr
|
||||
htmlParseFile(const char *filename, const char *encoding) {
|
||||
return(htmlSAXParseFile(filename, encoding, NULL, NULL));
|
||||
}
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#ifndef __HTML_PARSER_H__
|
||||
#define __HTML_PARSER_H__
|
||||
#include "parser.h"
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
15
HTMLtree.c
15
HTMLtree.c
@ -12,6 +12,10 @@
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xmlversion.h"
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* for memset() only ! */
|
||||
|
||||
@ -22,11 +26,11 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "HTMLparser.h"
|
||||
#include "HTMLtree.h"
|
||||
#include "entities.h"
|
||||
#include "valid.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/valid.h>
|
||||
|
||||
static void
|
||||
htmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur);
|
||||
@ -404,3 +408,4 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) {
|
||||
return(ret * sizeof(xmlChar));
|
||||
}
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
|
@ -11,7 +11,7 @@
|
||||
#define __HTML_TREE_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
81
Makefile.am
81
Makefile.am
@ -2,11 +2,11 @@
|
||||
|
||||
SUBDIRS = doc
|
||||
|
||||
INCLUDES = -I@srcdir@ @Z_CFLAGS@ @CORBA_CFLAGS@ $(VERSION_FLAGS)
|
||||
INCLUDES = -I@srcdir@ @Z_CFLAGS@ @CORBA_CFLAGS@
|
||||
|
||||
VERSION_FLAGS = -DLIBXML_VERSION=\"@LIBXML_VERSION@\"
|
||||
noinst_PROGRAMS=testSAX testHTML testXPath testURI
|
||||
|
||||
noinst_PROGRAMS=tester testSAX testHTML testXPath testURI
|
||||
bin_PROGRAMS = xmllint
|
||||
|
||||
bin_SCRIPTS=xml-config
|
||||
|
||||
@ -21,20 +21,20 @@ libxml_la_SOURCES = \
|
||||
encoding.c \
|
||||
error.c \
|
||||
parser.c \
|
||||
tree.c \
|
||||
xmlIO.c \
|
||||
xmlmemory.c \
|
||||
uri.c \
|
||||
valid.c \
|
||||
xlink.c \
|
||||
HTMLparser.c \
|
||||
HTMLtree.c \
|
||||
debugXML.c \
|
||||
tree.c \
|
||||
xpath.c \
|
||||
xmlIO.c \
|
||||
xmlmemory.c \
|
||||
nanohttp.c \
|
||||
nanoftp.c \
|
||||
uri.c \
|
||||
valid.c \
|
||||
xlink.c
|
||||
nanoftp.c
|
||||
|
||||
xmlincdir = $(includedir)/gnome-xml
|
||||
xmlincdir = $(includedir)/libxml
|
||||
xmlinc_HEADERS = \
|
||||
SAX.h \
|
||||
entities.h \
|
||||
@ -53,15 +53,16 @@ xmlinc_HEADERS = \
|
||||
nanoftp.h \
|
||||
uri.h \
|
||||
valid.h \
|
||||
xlink.h
|
||||
xlink.h \
|
||||
xmlversion.h
|
||||
|
||||
DEPS = $(top_builddir)/libxml.la
|
||||
LDADDS = $(top_builddir)/libxml.la @Z_LIBS@ @M_LIBS@
|
||||
|
||||
tester_SOURCES=tester.c
|
||||
tester_LDFLAGS =
|
||||
tester_DEPENDENCIES = $(DEPS)
|
||||
tester_LDADD= @RDL_LIBS@ $(LDADDS)
|
||||
xmllint_SOURCES=xmllint.c
|
||||
xmllint_LDFLAGS =
|
||||
xmllint_DEPENDENCIES = $(DEPS)
|
||||
xmllint_LDADD= @RDL_LIBS@ $(LDADDS)
|
||||
|
||||
testSAX_SOURCES=testSAX.c
|
||||
testSAX_LDFLAGS =
|
||||
@ -78,15 +79,23 @@ testXPath_LDFLAGS =
|
||||
testXPath_DEPENDENCIES = $(DEPS)
|
||||
testXPath_LDADD= $(LDADDS)
|
||||
|
||||
testURI_SOURCES=testURI.c
|
||||
testURI_LDFLAGS =
|
||||
testURI_DEPENDENCIES = $(DEPS)
|
||||
testURI_LDADD= $(LDADDS)
|
||||
|
||||
check-local: tests
|
||||
|
||||
install-data: $(srcdir)/libxml
|
||||
|
||||
$(srcdir)/libxml:
|
||||
-$(RM) $(srcdir)/libxml
|
||||
ln -s $(srcdir)/. $(srcdir)/libxml
|
||||
|
||||
testall : tests SVGtests SAXtests XPathtests XMLenttests
|
||||
|
||||
tests: XMLtests HTMLtests Validtests
|
||||
|
||||
testURI: $(srcdir)/uri.c $(srcdir)/uri.h xmlmemory.o
|
||||
$(CC) $(CFLAGS) -DSTANDALONE -o testURI $(srcdir)/uri.c xmlmemory.o
|
||||
|
||||
HTMLtests : testHTML
|
||||
@echo "##"
|
||||
@echo "## HTML regression tests"
|
||||
@ -107,7 +116,7 @@ HTMLtests : testHTML
|
||||
rm result.$$name result2.$$name error.$$name ; \
|
||||
fi ; fi ; done)
|
||||
|
||||
XMLtests : tester
|
||||
XMLtests : xmllint
|
||||
@echo "##"
|
||||
@echo "## XML regression tests"
|
||||
@echo "##"
|
||||
@ -116,17 +125,17 @@ XMLtests : tester
|
||||
if [ ! -d $$i ] ; then \
|
||||
if [ ! -f $(srcdir)/result/$$name ] ; then \
|
||||
echo New test file $$name ; \
|
||||
$(top_builddir)/tester $$i > $(srcdir)/result/$$name ; \
|
||||
$(top_builddir)/xmllint $$i > $(srcdir)/result/$$name ; \
|
||||
else \
|
||||
echo Testing $$name ; \
|
||||
$(top_builddir)/tester $$i > result.$$name ; \
|
||||
$(top_builddir)/xmllint $$i > result.$$name ; \
|
||||
diff $(srcdir)/result/$$name result.$$name ; \
|
||||
$(top_builddir)/tester result.$$name > result2.$$name ; \
|
||||
$(top_builddir)/xmllint result.$$name > result2.$$name ; \
|
||||
diff result.$$name result2.$$name ; \
|
||||
rm result.$$name result2.$$name ; \
|
||||
fi ; fi ; done)
|
||||
|
||||
XMLenttests : tester
|
||||
XMLenttests : xmllint
|
||||
@echo "##"
|
||||
@echo "## XML entity subst regression tests"
|
||||
@echo "##"
|
||||
@ -135,12 +144,12 @@ XMLenttests : tester
|
||||
if [ ! -d $$i ] ; then \
|
||||
if [ ! -f $(srcdir)/result/noent/$$name ] ; then \
|
||||
echo New test file $$name ; \
|
||||
$(top_builddir)/tester --noent $$i > $(srcdir)/result/noent/$$name ; \
|
||||
$(top_builddir)/xmllint --noent $$i > $(srcdir)/result/noent/$$name ; \
|
||||
else \
|
||||
echo Testing $$name ; \
|
||||
$(top_builddir)/tester --noent $$i > result.$$name ; \
|
||||
$(top_builddir)/xmllint --noent $$i > result.$$name ; \
|
||||
diff $(srcdir)/result/noent/$$name result.$$name ; \
|
||||
$(top_builddir)/tester --noent result.$$name > result2.$$name ; \
|
||||
$(top_builddir)/xmllint --noent result.$$name > result2.$$name ; \
|
||||
diff result.$$name result2.$$name ; \
|
||||
rm result.$$name result2.$$name ; \
|
||||
fi ; fi ; done)
|
||||
@ -177,7 +186,7 @@ XPathtests : testXPath
|
||||
rm result.$$name ; \
|
||||
fi ; fi ; done ; fi ; done)
|
||||
|
||||
SVGtests : tester
|
||||
SVGtests : xmllint
|
||||
@echo "##"
|
||||
@echo "## SVG parsing regression tests"
|
||||
@echo "##"
|
||||
@ -186,12 +195,12 @@ SVGtests : tester
|
||||
if [ ! -d $$i ] ; then \
|
||||
if [ ! -f $(srcdir)/result/SVG/$$name ] ; then \
|
||||
echo New test file $$name ; \
|
||||
$(top_builddir)/tester $$i > $(srcdir)/result/SVG/$$name ; \
|
||||
$(top_builddir)/xmllint $$i > $(srcdir)/result/SVG/$$name ; \
|
||||
else \
|
||||
echo Testing $$name ; \
|
||||
$(top_builddir)/tester $$i > result.$$name ; \
|
||||
$(top_builddir)/xmllint $$i > result.$$name ; \
|
||||
diff $(srcdir)/result/SVG/$$name result.$$name ; \
|
||||
$(top_builddir)/tester result.$$name > result2.$$name ; \
|
||||
$(top_builddir)/xmllint result.$$name > result2.$$name ; \
|
||||
diff result.$$name result2.$$name ; \
|
||||
rm result.$$name result2.$$name ; \
|
||||
fi ; fi ; done)
|
||||
@ -214,7 +223,7 @@ SAXtests : testSAX
|
||||
fi ; fi ; done)
|
||||
|
||||
|
||||
Validtests : tester
|
||||
Validtests : xmllint
|
||||
@echo "##"
|
||||
@echo "## Validity checking regression tests"
|
||||
@echo "##"
|
||||
@ -223,10 +232,10 @@ Validtests : tester
|
||||
if [ ! -d $$i ] ; then \
|
||||
if [ ! -f $(srcdir)/result/VC/$$name ] ; then \
|
||||
echo New test file $$name ; \
|
||||
$(top_builddir)/tester --noout --valid $$i 2> $(srcdir)/result/VC/$$name ; \
|
||||
$(top_builddir)/xmllint --noout --valid $$i 2> $(srcdir)/result/VC/$$name ; \
|
||||
else \
|
||||
echo Testing $$name ; \
|
||||
$(top_builddir)/tester --noout --valid $$i 2> result.$$name ; \
|
||||
$(top_builddir)/xmllint --noout --valid $$i 2> result.$$name ; \
|
||||
diff $(srcdir)/result/VC/$$name result.$$name ; \
|
||||
rm result.$$name ; \
|
||||
fi ; fi ; done)
|
||||
@ -238,10 +247,10 @@ Validtests : tester
|
||||
if [ ! -d $$i ] ; then \
|
||||
if [ ! -f $(srcdir)/result/valid/$$name ] ; then \
|
||||
echo New test file $$name ; \
|
||||
$(top_builddir)/tester --valid $$i > $(srcdir)/result/valid/$$name 2>$(srcdir)/result/valid/$$name.err ; \
|
||||
$(top_builddir)/xmllint --valid $$i > $(srcdir)/result/valid/$$name 2>$(srcdir)/result/valid/$$name.err ; \
|
||||
else \
|
||||
echo Testing $$name ; \
|
||||
$(top_builddir)/tester --valid $$i > result.$$name 2>error.$$name ; \
|
||||
$(top_builddir)/xmllint --valid $$i > result.$$name 2>error.$$name ; \
|
||||
diff $(srcdir)/result/valid/$$name result.$$name ; \
|
||||
diff $(srcdir)/result/valid/$$name.err error.$$name ; \
|
||||
rm result.$$name error.$$name ; \
|
||||
|
8
README
8
README
@ -1,14 +1,14 @@
|
||||
|
||||
XML parser for Gnome
|
||||
|
||||
Documentation is available on-line at
|
||||
http://rufus.w3.org/veillard/XML/xml.html
|
||||
Full documentation is available on-line at
|
||||
http://xmlsoft.org/
|
||||
|
||||
A mailing-list has been set-up, to subscribe:
|
||||
A mailing-list is available, to subscribe:
|
||||
echo "subscribe xml" | mail majordomo@rufus.w3.org
|
||||
|
||||
The list archive is at:
|
||||
http://rufus.w3.org/veillard/XML/messages/
|
||||
http://xmlsoft.org/messages/
|
||||
|
||||
NOTE: I use a second CVS server for experimental version of the XML code,
|
||||
this mean that if you commit without a Changelog or without sending
|
||||
|
18
SAX.c
18
SAX.c
@ -14,16 +14,16 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "xmlmemory.h"
|
||||
#include "tree.h"
|
||||
#include "parser.h"
|
||||
#include "parserInternals.h"
|
||||
#include "valid.h"
|
||||
#include "entities.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/entities.h>
|
||||
#include "xml-error.h"
|
||||
#include "debugXML.h"
|
||||
#include "xmlIO.h"
|
||||
#include "SAX.h"
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/SAX.h>
|
||||
|
||||
/* #define DEBUG_SAX */
|
||||
/* #define DEBUG_SAX_TREE */
|
||||
|
4
SAX.h
4
SAX.h
@ -12,8 +12,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "parser.h"
|
||||
#include "xlink.h"
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xlink.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define extern "C" {
|
||||
|
27
TODO
27
TODO
@ -2,6 +2,10 @@
|
||||
TODO for the XML parser and stuff:
|
||||
==================================
|
||||
|
||||
CVS:
|
||||
====
|
||||
rename tester.c to xmllint.c
|
||||
|
||||
TODO:
|
||||
=====
|
||||
|
||||
@ -14,6 +18,9 @@ TODO:
|
||||
be saved back.
|
||||
- Go through erratas and do the cleanup.
|
||||
http://www.w3.org/XML/xml-19980210-errata ... bummmer
|
||||
- Handle undefined namespaces in entity contents better ... at least
|
||||
issue a warning
|
||||
- General checking of DTD validation in presence of namespaces ... hairy
|
||||
|
||||
TODO:
|
||||
=====
|
||||
@ -36,14 +43,6 @@ TODO:
|
||||
EXTENSIONS:
|
||||
===========
|
||||
|
||||
- Check attribute normalization especially xmlGetProp()
|
||||
- Validity checking problems for NOTATIONS attributes
|
||||
- Validity checking problems for ENTITY ENTITIES attributes
|
||||
- dynamically adapt the alloc entry point to use g_alloc()/g_free()
|
||||
if the programmer wants it:
|
||||
- use xmlMemSetup() to reset the routines used.
|
||||
- Parsing of a well balanced chunk
|
||||
- URI module: validation, base, etc ...
|
||||
- Tools to produce man pages from the SGML docs.
|
||||
- Finish XPath
|
||||
=> attributes addressing troubles
|
||||
@ -79,8 +78,7 @@ EXTENSIONS:
|
||||
- Add a DTD cache prefilled with xhtml DTDs and entities and a program to
|
||||
manage them -> like the /usr/bin/install-catalog from SGML
|
||||
right place seems $datadir/xmldtds
|
||||
|
||||
- turn tester into a generic program xml-test installed with xml-devel
|
||||
Maybe this is better left to user apps
|
||||
|
||||
- Add output to XHTML in case of HTML documents.
|
||||
|
||||
@ -88,6 +86,15 @@ EXTENSIONS:
|
||||
Done:
|
||||
=====
|
||||
|
||||
- dynamically adapt the alloc entry point to use g_alloc()/g_free()
|
||||
if the programmer wants it:
|
||||
- use xmlMemSetup() to reset the routines used.
|
||||
- Check attribute normalization especially xmlGetProp()
|
||||
- Validity checking problems for NOTATIONS attributes
|
||||
- Validity checking problems for ENTITY ENTITIES attributes
|
||||
- Parsing of a well balanced chunk xmlParseBalancedChunkMemory()
|
||||
- URI module: validation, base, etc ... see uri.[ch]
|
||||
- turn tester into a generic program xmllint installed with libxml
|
||||
- extend validity checks to go through entities content instead of
|
||||
just labelling them PCDATA
|
||||
- Save Dtds using the children list instead of dumping the tables,
|
||||
|
10
autogen.sh
10
autogen.sh
@ -10,7 +10,7 @@ DIE=0
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile gnome-xml."
|
||||
echo "You must have autoconf installed to compile libxml."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
@ -18,7 +18,7 @@ DIE=0
|
||||
|
||||
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have libtool installed to compile gnome-xml."
|
||||
echo "You must have libtool installed to compile libxml."
|
||||
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.0h.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
@ -26,7 +26,7 @@ DIE=0
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to compile gnome-xml."
|
||||
echo "You must have automake installed to compile libxml."
|
||||
echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2d.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
@ -37,7 +37,7 @@ if test "$DIE" -eq 1; then
|
||||
fi
|
||||
|
||||
test -f entities.h || {
|
||||
echo "You must run this script in the top-level gnome-xml directory"
|
||||
echo "You must run this script in the top-level libxml directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -61,4 +61,4 @@ fi
|
||||
$srcdir/configure "$@"
|
||||
|
||||
echo
|
||||
echo "Now type 'make' to compile gnome-xml."
|
||||
echo "Now type 'make' to compile libxml."
|
||||
|
96
configure.in
96
configure.in
@ -9,13 +9,16 @@ LIBXML_MICRO_VERSION=0
|
||||
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
|
||||
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
|
||||
|
||||
LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
|
||||
|
||||
AC_SUBST(LIBXML_MAJOR_VERSION)
|
||||
AC_SUBST(LIBXML_MINOR_VERSION)
|
||||
AC_SUBST(LIBXML_MICRO_VERSION)
|
||||
AC_SUBST(LIBXML_VERSION)
|
||||
AC_SUBST(LIBXML_VERSION_INFO)
|
||||
AC_SUBST(LIBXML_VERSION_NUMBER)
|
||||
|
||||
VERSION=${LIBXML_VERSION}beta
|
||||
VERSION=${LIBXML_VERSION}
|
||||
|
||||
AM_INIT_AUTOMAKE(libxml2, $VERSION)
|
||||
|
||||
@ -108,7 +111,7 @@ AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf,
|
||||
[M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)]))
|
||||
|
||||
XML_LIBDIR='-L${libdir}'
|
||||
XML_INCLUDEDIR='-I${includedir}/gnome-xml'
|
||||
XML_INCLUDEDIR='-I${includedir}/libxml -I${includedir}'
|
||||
XML_LIBS="-lxml $Z_LIBS $M_LIBS $LIBS"
|
||||
|
||||
dnl
|
||||
@ -147,6 +150,80 @@ AC_CHECK_LIB(history, append_history,
|
||||
AC_CHECK_LIB(readline, readline,
|
||||
RDL_LIBS="-lreadline ${RDL_LIBS}"; AC_DEFINE(HAVE_LIBREADLINE))
|
||||
|
||||
|
||||
dnl
|
||||
dnl Aloow to disable various pieces
|
||||
dnl
|
||||
|
||||
AC_ARG_WITH(ftp, [ --with-ftp Add the FTP support (on)])
|
||||
if test "$with_ftp" = "no" ; then
|
||||
echo Disabling FTP support
|
||||
WITH_FTP=0
|
||||
FTP_OBJ=
|
||||
else
|
||||
WITH_FTP=1
|
||||
FTP_OBJ=nanoftp.o
|
||||
fi
|
||||
AC_SUBST(WITH_FTP)
|
||||
AC_SUBST(FTP_OBJ)
|
||||
|
||||
AC_ARG_WITH(http, [ --with-http Add the HTTP support (on)])
|
||||
if test "$with_http" = "no" ; then
|
||||
echo Disabling HTTP support
|
||||
WITH_HTTP=0
|
||||
HTTP_OBJ=
|
||||
else
|
||||
WITH_HTTP=1
|
||||
HTTP_OBJ=nanohttp.o
|
||||
fi
|
||||
AC_SUBST(WITH_HTTP)
|
||||
AC_SUBST(HTTP_OBJ)
|
||||
|
||||
AC_ARG_WITH(html, [ --with-html Add the HTML support (on)])
|
||||
if test "$with_html" = "no" ; then
|
||||
echo Disabling HTML support
|
||||
WITH_HTML=0
|
||||
HTML_OBJ=
|
||||
else
|
||||
WITH_HTML=1
|
||||
HTML_OBJ="HTMLparser.o HTMLtree.o"
|
||||
fi
|
||||
AC_SUBST(WITH_HTML)
|
||||
AC_SUBST(HTML_OBJ)
|
||||
|
||||
AC_ARG_WITH(xpath, [ --with-xpath Add the XPATH support (on)])
|
||||
if test "$with_xpath" = "no" ; then
|
||||
echo Disabling XPATH support
|
||||
WITH_XPATH=0
|
||||
XPATH_OBJ=
|
||||
else
|
||||
WITH_XPATH=1
|
||||
XPATH_OBJ=xpath.o
|
||||
fi
|
||||
AC_SUBST(WITH_XPATH)
|
||||
AC_SUBST(XPATH_OBJ)
|
||||
|
||||
AC_ARG_WITH(debug, [ --with-debug Add the debugging module (on)])
|
||||
if test "$with_debug" = "no" ; then
|
||||
echo Disabling DEBUG support
|
||||
WITH_DEBUG=0
|
||||
DEBUG_OBJ=
|
||||
else
|
||||
WITH_DEBUG=1
|
||||
DEBUG_OBJ=debugXML.o
|
||||
fi
|
||||
AC_SUBST(WITH_DEBUG)
|
||||
AC_SUBST(DEBUG_OBJ)
|
||||
|
||||
AC_ARG_WITH(mem_debug, [ --with-mem-debug Add the memory debugging module (off)])
|
||||
if test "$with_mem_debug" = "yes" ; then
|
||||
echo Enabling memory debug support
|
||||
WITH_MEM_DEBUG=1
|
||||
else
|
||||
WITH_MEM_DEBUG=0
|
||||
fi
|
||||
AC_SUBST(WITH_MEM_DEBUG)
|
||||
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(XML_CFLAGS)
|
||||
|
||||
@ -159,5 +236,18 @@ AC_SUBST(HAVE_ISINF)
|
||||
|
||||
AC_SUBST(M_LIBS)
|
||||
AC_SUBST(RDL_LIBS)
|
||||
AC_OUTPUT(libxml.spec Makefile doc/Makefile example/Makefile xml-config win32config.h)
|
||||
|
||||
dnl
|
||||
dnl create the libxml link needed to get dependencies right
|
||||
dnl
|
||||
if test -f $srcdir/libxml
|
||||
then
|
||||
rm -f $srcdir/libxml libxml
|
||||
(cd $srcdir ; ln -s . libxml)
|
||||
(ln -s . libxml)
|
||||
else
|
||||
(cd $srcdir ; rm -f libxml ; ln -s . libxml)
|
||||
(rm -f libxml ; ln -s . libxml)
|
||||
fi
|
||||
AC_OUTPUT(libxml.spec Makefile doc/Makefile example/Makefile xmlversion.h xml-config win32config.h)
|
||||
|
||||
|
70
debugXML.c
70
debugXML.c
@ -12,6 +12,10 @@
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xmlversion.h"
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
@ -19,13 +23,13 @@
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include "xmlmemory.h"
|
||||
#include "tree.h"
|
||||
#include "parser.h"
|
||||
#include "valid.h"
|
||||
#include "debugXML.h"
|
||||
#include "HTMLtree.h"
|
||||
#include "HTMLparser.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
|
||||
#define IS_BLANK(c) \
|
||||
(((c) == '\n') || ((c) == '\r') || ((c) == '\t') || ((c) == ' '))
|
||||
@ -1059,10 +1063,17 @@ int
|
||||
xmlShellCat(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
|
||||
xmlNodePtr node2) {
|
||||
if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) {
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
if (node->type == XML_HTML_DOCUMENT_NODE)
|
||||
htmlDocDump(stdout, (htmlDocPtr) node);
|
||||
else
|
||||
htmlNodeDumpFile(stdout, ctxt->doc, node);
|
||||
#else
|
||||
if (node->type == XML_DOCUMENT_NODE)
|
||||
xmlDocDump(stdout, (xmlDocPtr) node);
|
||||
else
|
||||
xmlElemDump(stdout, ctxt->doc, node);
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
} else {
|
||||
if (node->type == XML_DOCUMENT_NODE)
|
||||
xmlDocDump(stdout, (xmlDocPtr) node);
|
||||
@ -1095,7 +1106,12 @@ xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
|
||||
html = (ctxt->doc->type == XML_HTML_DOCUMENT_NODE);
|
||||
|
||||
if (html) {
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
doc = htmlParseFile(filename, NULL);
|
||||
#else
|
||||
printf("HTML support not compiled in\n");
|
||||
doc = NULL;
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
} else {
|
||||
doc = xmlParseFile(filename);
|
||||
}
|
||||
@ -1104,11 +1120,15 @@ xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
|
||||
xmlFreeDoc(ctxt->doc);
|
||||
}
|
||||
ctxt->loaded = 1;
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
xmlXPathFreeContext(ctxt->pctxt);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
xmlFree(ctxt->filename);
|
||||
ctxt->doc = doc;
|
||||
ctxt->node = (xmlNodePtr) doc;
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
ctxt->pctxt = xmlXPathNewContext(doc);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
ctxt->filename = (char *) xmlStrdup((xmlChar *) filename);
|
||||
} else
|
||||
return(-1);
|
||||
@ -1151,10 +1171,17 @@ xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
|
||||
}
|
||||
break;
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
if (htmlSaveFile((char *) filename, ctxt->doc) < 0) {
|
||||
fprintf(stderr, "Failed to write to %s\n", filename);
|
||||
return(-1);
|
||||
}
|
||||
#else
|
||||
if (xmlSaveFile((char *) filename, ctxt->doc) < -1) {
|
||||
fprintf(stderr, "Failed to write to %s\n", filename);
|
||||
return(-1);
|
||||
}
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
break;
|
||||
default: {
|
||||
FILE *f;
|
||||
@ -1203,9 +1230,15 @@ xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
|
||||
}
|
||||
break;
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
if (htmlSaveFile((char *) filename, ctxt->doc) < 0) {
|
||||
fprintf(stderr, "Failed to save to %s\n", filename);
|
||||
}
|
||||
#else
|
||||
if (xmlSaveFile((char *) filename, ctxt->doc) < 0) {
|
||||
fprintf(stderr, "Failed to save to %s\n", filename);
|
||||
}
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
@ -1444,11 +1477,13 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
ctxt->filename = (char *) xmlStrdup((xmlChar *) filename);
|
||||
ctxt->node = (xmlNodePtr) ctxt->doc;
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
ctxt->pctxt = xmlXPathNewContext(ctxt->doc);
|
||||
if (ctxt->pctxt == NULL) {
|
||||
xmlFree(ctxt);
|
||||
return;
|
||||
}
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
while (1) {
|
||||
if (ctxt->node == (xmlNodePtr) ctxt->doc)
|
||||
sprintf(prompt, "%s > ", "/");
|
||||
@ -1503,10 +1538,14 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
xmlShellList(ctxt, NULL, ctxt->node, NULL);
|
||||
} else {
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
ctxt->pctxt->nodelist = xmlXPathNodeSetCreate(ctxt->node);
|
||||
list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
|
||||
#else
|
||||
list = NULL;
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
if (list != NULL) {
|
||||
switch (list->type) {
|
||||
case XPATH_UNDEFINED:
|
||||
@ -1539,8 +1578,10 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
} else {
|
||||
fprintf(stderr, "%s: no such node\n", arg);
|
||||
}
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
ctxt->pctxt->nodelist = NULL;
|
||||
}
|
||||
} else if (!strcmp(command, "cd")) {
|
||||
@ -1548,10 +1589,14 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
ctxt->node = (xmlNodePtr) ctxt->doc;
|
||||
} else {
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
ctxt->pctxt->nodelist = xmlXPathNodeSetCreate(ctxt->node);
|
||||
list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
|
||||
#else
|
||||
list = NULL;
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
if (list != NULL) {
|
||||
switch (list->type) {
|
||||
case XPATH_UNDEFINED:
|
||||
@ -1578,8 +1623,10 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
} else {
|
||||
fprintf(stderr, "%s: no such node\n", arg);
|
||||
}
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
ctxt->pctxt->nodelist = NULL;
|
||||
}
|
||||
} else if (!strcmp(command, "cat")) {
|
||||
@ -1587,10 +1634,14 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
xmlShellCat(ctxt, NULL, ctxt->node, NULL);
|
||||
} else {
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
ctxt->pctxt->nodelist = xmlXPathNodeSetCreate(ctxt->node);
|
||||
list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
|
||||
#else
|
||||
list = NULL;
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
if (list != NULL) {
|
||||
switch (list->type) {
|
||||
case XPATH_UNDEFINED:
|
||||
@ -1620,8 +1671,10 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
} else {
|
||||
fprintf(stderr, "%s: no such node\n", arg);
|
||||
}
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
ctxt->pctxt->nodelist = NULL;
|
||||
}
|
||||
} else {
|
||||
@ -1629,7 +1682,9 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
}
|
||||
free(cmdline); /* not xmlFree here ! */
|
||||
}
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
xmlXPathFreeContext(ctxt->pctxt);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
if (ctxt->loaded) {
|
||||
xmlFreeDoc(ctxt->doc);
|
||||
}
|
||||
@ -1638,3 +1693,4 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
free(cmdline); /* not xmlFree here ! */
|
||||
}
|
||||
|
||||
#endif /* LIBXML_DEBUG_ENABLED */
|
||||
|
@ -8,8 +8,11 @@
|
||||
#ifndef __DEBUG_XML__
|
||||
#define __DEBUG_XML__
|
||||
#include <stdio.h>
|
||||
#include "tree.h"
|
||||
#include "xpath.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -103,4 +106,6 @@ void xmlShell (xmlDocPtr doc,
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_DEBUG_ENABLED */
|
||||
#endif /* __DEBUG_XML__ */
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Upgrading libxml client code from 1.x to 2.x</title>
|
||||
<meta name="GENERATOR" content="amaya V2.1">
|
||||
<meta name="GENERATOR" content="amaya V2.4">
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
</head>
|
||||
|
||||
@ -67,6 +67,14 @@ mail</a>:</p>
|
||||
(read and save) without inflating the document with extra formatting
|
||||
chars.</p>
|
||||
</li>
|
||||
<li>The include path has changed to $prefix/libxml/ and the includes
|
||||
themselves uses this new prefix in includes instructions... If you are
|
||||
using (as expected) the
|
||||
<pre>xml-config --cflags</pre>
|
||||
<p>output to generate you compile commands this will probably work out of
|
||||
the box</p>
|
||||
<p> </p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>Let me put some emphasis on the fact that there is far more changes from
|
||||
@ -77,6 +85,6 @@ upgrade, it may cost a lot on the long term ...</p>
|
||||
|
||||
<p><a href="mailto:Daniel.Veillard@w3.org">Daniel Veillard</a></p>
|
||||
|
||||
<p>$Id: upgrade.html,v 1.1 2000/03/04 11:39:43 veillard Exp $</p>
|
||||
<p>$Id: upgrade.html,v 1.2 2000/03/06 07:41:49 veillard Exp $</p>
|
||||
</body>
|
||||
</html>
|
||||
|
38
doc/xml.html
38
doc/xml.html
@ -184,12 +184,30 @@ for really accurate description</h3>
|
||||
<ul>
|
||||
<li>working on HTML and XML links recognition layers, get in touch with me
|
||||
if you want to test those.</li>
|
||||
<li>So far the feedback on the libxml2 beta is positive</li>
|
||||
</ul>
|
||||
|
||||
<h3>2.0.0: Apr 3 2000</h3>
|
||||
<ul>
|
||||
<li>First public release of libxml2. If you are using libxml, it's a good
|
||||
idea to check the 1.x to 2.x upgrade instructions</li>
|
||||
<li>The include are now located under $prefix/include/libxml (instead of
|
||||
$prefix/include/gnome-xml), they also are referenced by
|
||||
<pre>#include <libxml/xxx.h></pre>
|
||||
<p>instead of </p>
|
||||
<pre>#include "xxx.h"</pre>
|
||||
</li>
|
||||
<li>a new URI module for parsing URIs and following strictly RFC 2396</li>
|
||||
<li>the memory allocation routines used by libxml can now be overloaded
|
||||
dynamically by using xmlMemSetup()</li>
|
||||
<li>So far the feedback on the libxml2 beta is positive</li>
|
||||
<li>The previously CVS only tool tester has been renamed
|
||||
<strong>xmllint</strong> and is now installed as part of the libxml2
|
||||
package</li>
|
||||
<li></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<h3>2.0.0beta: Mar 14 2000</h3>
|
||||
<ul>
|
||||
<li>This is a first Beta release of libxml version 2</li>
|
||||
@ -404,7 +422,7 @@ should be only one ELEMENT under the root):</p>
|
||||
<p><img src="structure.gif" alt=" structure.gif "></p>
|
||||
|
||||
<p>In the source package there is a small program (not installed by default)
|
||||
called <strong>tester</strong> which parses XML files given as argument and
|
||||
called <strong>xmllint</strong> which parses XML files given as argument and
|
||||
prints them back as parsed. This is useful for detecting errors both in XML
|
||||
code and in the XML parser itself. It has an option <strong>--debug</strong>
|
||||
which prints the actual in-memory structure of the document, here is the
|
||||
@ -590,9 +608,10 @@ limited to SAX. Just use the two first arguments of
|
||||
|
||||
<p>The other way to get an XML tree in memory is by building it. Basically
|
||||
there is a set of functions dedicated to building new elements. (These are
|
||||
also described in "tree.h".) For example, here is a piece of code that
|
||||
produces the XML document used in the previous examples:</p>
|
||||
<pre> xmlDocPtr doc;
|
||||
also described in <libxml/tree.h>.) For example, here is a piece of code
|
||||
that produces the XML document used in the previous examples:</p>
|
||||
<pre> #include <libxml/tree.h>
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr tree, subtree;
|
||||
|
||||
doc = xmlNewDoc("1.0");
|
||||
@ -759,7 +778,7 @@ substitute entities by default.</p>
|
||||
|
||||
<p>Here is the DOM tree built by libxml for the previous document in the
|
||||
default case:</p>
|
||||
<pre>/gnome/src/gnome-xml -> ./tester --debug test/ent1
|
||||
<pre>/gnome/src/gnome-xml -> ./xmllint --debug test/ent1
|
||||
DOCUMENT
|
||||
version=1.0
|
||||
ELEMENT EXAMPLE
|
||||
@ -816,7 +835,7 @@ have to point to any existing resource on the Web. It will bind all the
|
||||
element and atributes with that URL. I suggest to use an URL within a domain
|
||||
you control, and that the URL should contain some kind of version information
|
||||
if possible. For example, <code>"http://www.gnome.org/gnumeric/1.0/"</code> is
|
||||
a good namespace scheme. </p>
|
||||
a good namespace scheme.</p>
|
||||
|
||||
<p>Then when you load a file, make sure that a namespace carrying the
|
||||
version-independent prefix is installed on the root element of your document,
|
||||
@ -1047,7 +1066,8 @@ DEBUG("parsePerson\n");
|
||||
|
||||
<p>Here is another piece of code used to parse another level of the
|
||||
structure:</p>
|
||||
<pre>/*
|
||||
<pre>#include <libxml/tree.h>
|
||||
/*
|
||||
* a Description for a Job
|
||||
*/
|
||||
typedef struct job {
|
||||
@ -1112,6 +1132,6 @@ base under gnome-xml/example</p>
|
||||
|
||||
<p><a href="mailto:Daniel.Veillard@w3.org">Daniel Veillard</a></p>
|
||||
|
||||
<p>$Id: xml.html,v 1.30 2000/03/20 13:07:14 veillard Exp $</p>
|
||||
<p>$Id: xml.html,v 1.31 2000/03/24 13:41:54 veillard Exp $</p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -34,8 +34,8 @@
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include "encoding.h"
|
||||
#include "xmlmemory.h"
|
||||
#include <libxml/encoding.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
|
||||
xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
|
||||
xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#ifndef __XML_CHAR_ENCODING_H__
|
||||
#define __XML_CHAR_ENCODING_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -17,9 +17,9 @@
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include "xmlmemory.h"
|
||||
#include "entities.h"
|
||||
#include "parser.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#define DEBUG_ENT_REF /* debugging of cross entities dependancies */
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef __XML_ENTITIES_H__
|
||||
#define __XML_ENTITIES_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
2
error.c
2
error.c
@ -14,7 +14,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "parser.h"
|
||||
#include <libxml/parser.h>
|
||||
|
||||
/**
|
||||
* xmlParserPrintFileInfo:
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#ifndef __HTML_PARSER_H__
|
||||
#define __HTML_PARSER_H__
|
||||
#include "parser.h"
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#define __HTML_TREE_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "parser.h"
|
||||
#include "xlink.h"
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xlink.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define extern "C" {
|
||||
|
@ -8,8 +8,11 @@
|
||||
#ifndef __DEBUG_XML__
|
||||
#define __DEBUG_XML__
|
||||
#include <stdio.h>
|
||||
#include "tree.h"
|
||||
#include "xpath.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -103,4 +106,6 @@ void xmlShell (xmlDocPtr doc,
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_DEBUG_ENABLED */
|
||||
#endif /* __DEBUG_XML__ */
|
||||
|
@ -21,6 +21,7 @@
|
||||
#ifndef __XML_CHAR_ENCODING_H__
|
||||
#define __XML_CHAR_ENCODING_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef __XML_ENTITIES_H__
|
||||
#define __XML_ENTITIES_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -8,6 +8,10 @@
|
||||
|
||||
#ifndef __NANO_FTP_H__
|
||||
#define __NANO_FTP_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#ifdef LIBXML_FTP_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -101,5 +105,6 @@ int xmlNanoFTPRead (void *ctx,
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* LIBXML_FTP_ENABLED */
|
||||
#endif
|
||||
#endif /* __NANO_FTP_H__ */
|
||||
|
@ -8,6 +8,10 @@
|
||||
|
||||
#ifndef __NANO_HTTP_H__
|
||||
#define __NANO_HTTP_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -33,5 +37,7 @@ int xmlNanoHTTPSave (void *ctxt,
|
||||
void xmlNanoHTTPClose (void *ctx);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif /* LIBXML_HTTP_ENABLED */
|
||||
#endif
|
||||
#endif /* __NANO_HTTP_H__ */
|
||||
|
@ -9,10 +9,10 @@
|
||||
#ifndef __XML_PARSER_H__
|
||||
#define __XML_PARSER_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include "valid.h"
|
||||
#include "xmlIO.h"
|
||||
#include "entities.h"
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/entities.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef __XML_PARSER_INTERNALS_H__
|
||||
#define __XML_PARSER_INTERNALS_H__
|
||||
|
||||
#include "parser.h"
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define __XML_TREE_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef __XML_URI_H__
|
||||
#define __XML_URI_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -24,10 +24,11 @@ typedef struct _xmlURI xmlURI;
|
||||
typedef xmlURI *xmlURIPtr;
|
||||
struct _xmlURI {
|
||||
char *scheme;
|
||||
char *opaque;
|
||||
char *authority;
|
||||
char *server;
|
||||
char *user;
|
||||
int port;
|
||||
char *opaque;
|
||||
char *path;
|
||||
char *query;
|
||||
char *fragment;
|
||||
@ -42,7 +43,13 @@ xmlChar * xmlBuildURI (const xmlChar *URI,
|
||||
const xmlChar *base);
|
||||
xmlURIPtr xmlParseURI (const char *URI);
|
||||
xmlChar * xmlSaveUri (xmlURIPtr uri);
|
||||
void xmlPrintURI (FILE *stream,
|
||||
xmlURIPtr uri);
|
||||
char * xmlURIUnescapeString (const char *str,
|
||||
int len,
|
||||
char *target);
|
||||
int xmlNormalizeURIPath (char *path);
|
||||
void xmlFreeURI (xmlURIPtr uri);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef __XML_VALID_H__
|
||||
#define __XML_VALID_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#ifndef __XML_XLINK_H__
|
||||
#define __XML_XLINK_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define extern "C" {
|
||||
|
@ -10,9 +10,9 @@
|
||||
#define __XML_IO_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "tree.h"
|
||||
#include "parser.h"
|
||||
#include "encoding.h"
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/encoding.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define _DEBUG_MEMORY_ALLOC_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
/*
|
||||
* DEBUG_MEMORY_LOCATION should be activated only done when debugging
|
||||
|
@ -12,7 +12,7 @@
|
||||
#ifndef __XML_XPATH_H__
|
||||
#define __XML_XPATH_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -92,7 +92,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%doc AUTHORS ChangeLog NEWS README COPYING COPYING.LIB TODO
|
||||
%{prefix}/lib/lib*.so.*
|
||||
%{prefix}/bin/xml-config
|
||||
%{prefix}/bin/xmllint
|
||||
|
||||
%files devel
|
||||
%defattr(-, root, root)
|
||||
@ -101,3 +101,4 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{prefix}/lib/*a
|
||||
%{prefix}/lib/*.sh
|
||||
%{prefix}/include/*
|
||||
%{prefix}/bin/xml-config
|
||||
|
15
nanoftp.c
15
nanoftp.c
@ -11,7 +11,9 @@
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "xmlversion.h"
|
||||
|
||||
#ifdef LIBXML_FTP_ENABLED
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -60,8 +62,8 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "nanoftp.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/nanoftp.h>
|
||||
|
||||
/* #define DEBUG_FTP 1 */
|
||||
#ifdef STANDALONE
|
||||
@ -1815,3 +1817,12 @@ int main(int argc, char **argv) {
|
||||
exit(0);
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
#else /* !LIBXML_FTP_ENABLED */
|
||||
#ifdef STANDALONE
|
||||
#include <stdio.h>
|
||||
int main(int argc, char **argv) {
|
||||
printf("%s : FTP support not compiled in\n", argv[0]);
|
||||
return(0);
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
#endif /* LIBXML_FTP_ENABLED */
|
||||
|
@ -8,6 +8,10 @@
|
||||
|
||||
#ifndef __NANO_FTP_H__
|
||||
#define __NANO_FTP_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#ifdef LIBXML_FTP_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -101,5 +105,6 @@ int xmlNanoFTPRead (void *ctx,
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* LIBXML_FTP_ENABLED */
|
||||
#endif
|
||||
#endif /* __NANO_FTP_H__ */
|
||||
|
15
nanohttp.c
15
nanohttp.c
@ -21,7 +21,9 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xmlversion.h"
|
||||
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -59,8 +61,8 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "nanohttp.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/nanohttp.h>
|
||||
|
||||
#ifdef STANDALONE
|
||||
#define DEBUG_HTTP
|
||||
@ -1231,3 +1233,12 @@ int main(int argc, char **argv) {
|
||||
return(0);
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
#else /* !LIBXML_HTTP_ENABLED */
|
||||
#ifdef STANDALONE
|
||||
#include <stdio.h>
|
||||
int main(int argc, char **argv) {
|
||||
printf("%s : HTTP support not compiled in\n", argv[0]);
|
||||
return(0);
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
#endif /* LIBXML_HTTP_ENABLED */
|
||||
|
@ -8,6 +8,10 @@
|
||||
|
||||
#ifndef __NANO_HTTP_H__
|
||||
#define __NANO_HTTP_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -33,5 +37,7 @@ int xmlNanoHTTPSave (void *ctxt,
|
||||
void xmlNanoHTTPClose (void *ctx);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif /* LIBXML_HTTP_ENABLED */
|
||||
#endif
|
||||
#endif /* __NANO_HTTP_H__ */
|
||||
|
18
parser.c
18
parser.c
@ -33,20 +33,20 @@
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "tree.h"
|
||||
#include "parser.h"
|
||||
#include "entities.h"
|
||||
#include "encoding.h"
|
||||
#include "valid.h"
|
||||
#include "parserInternals.h"
|
||||
#include "xmlIO.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/encoding.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include "xml-error.h"
|
||||
|
||||
#define XML_PARSER_BIG_BUFFER_SIZE 1000
|
||||
#define XML_PARSER_BUFFER_SIZE 100
|
||||
|
||||
const char *xmlParserVersion = LIBXML_VERSION;
|
||||
const char *xmlParserVersion = LIBXML_VERSION_STRING;
|
||||
int xmlGetWarningsDefaultValue = 1;
|
||||
|
||||
/*
|
||||
|
8
parser.h
8
parser.h
@ -9,10 +9,10 @@
|
||||
#ifndef __XML_PARSER_H__
|
||||
#define __XML_PARSER_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include "valid.h"
|
||||
#include "xmlIO.h"
|
||||
#include "entities.h"
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/entities.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef __XML_PARSER_INTERNALS_H__
|
||||
#define __XML_PARSER_INTERNALS_H__
|
||||
|
||||
#include "parser.h"
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
31
testHTML.c
31
testHTML.c
@ -12,6 +12,9 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xmlversion.h"
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
@ -33,12 +36,14 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "HTMLparser.h"
|
||||
#include "HTMLtree.h"
|
||||
#include "debugXML.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/debugXML.h>
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
static int debug = 0;
|
||||
#endif
|
||||
static int copy = 0;
|
||||
static int sax = 0;
|
||||
static int repeat = 0;
|
||||
@ -632,10 +637,14 @@ void parseAndPrintFile(char *filename) {
|
||||
* print it.
|
||||
*/
|
||||
if (!noout) {
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
if (!debug)
|
||||
htmlDocDump(stdout, doc);
|
||||
else
|
||||
xmlDebugDumpDocument(stdout, doc);
|
||||
#else
|
||||
htmlDocDump(stdout, doc);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -649,9 +658,12 @@ int main(int argc, char **argv) {
|
||||
int files = 0;
|
||||
|
||||
for (i = 1; i < argc ; i++) {
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
|
||||
debug++;
|
||||
else if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy")))
|
||||
else
|
||||
#endif
|
||||
if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy")))
|
||||
copy++;
|
||||
else if ((!strcmp(argv[i], "-push")) || (!strcmp(argv[i], "--push")))
|
||||
push++;
|
||||
@ -685,7 +697,9 @@ int main(int argc, char **argv) {
|
||||
printf("Usage : %s [--debug] [--copy] [--copy] HTMLfiles ...\n",
|
||||
argv[0]);
|
||||
printf("\tParse the HTML files and output the result of the parsing\n");
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
printf("\t--debug : dump a debug tree of the in-memory document\n");
|
||||
#endif
|
||||
printf("\t--copy : used to test the internal copy implementation\n");
|
||||
printf("\t--sax : debug the sequence of SAX callbacks\n");
|
||||
printf("\t--repeat : parse the file 100 times, for timing\n");
|
||||
@ -697,3 +711,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
return(0);
|
||||
}
|
||||
#else /* !LIBXML_HTML_ENABLED */
|
||||
#include <stdio.h>
|
||||
int main(int argc, char **argv) {
|
||||
printf("%s : HTML support not compiled in\n", argv[0]);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
10
testSAX.c
10
testSAX.c
@ -36,11 +36,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "parser.h"
|
||||
#include "parserInternals.h" /* only for xmlNewInputFromFile() */
|
||||
#include "tree.h"
|
||||
#include "debugXML.h"
|
||||
#include "xmlmemory.h"
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h> /* only for xmlNewInputFromFile() */
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
|
||||
static int debug = 0;
|
||||
static int copy = 0;
|
||||
|
20
testXPath.c
20
testXPath.c
@ -12,6 +12,9 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xmlversion.h"
|
||||
#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -32,11 +35,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "xpath.h"
|
||||
#include "tree.h"
|
||||
#include "parser.h"
|
||||
#include "debugXML.h"
|
||||
#include "xmlmemory.h"
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
|
||||
static int debug = 0;
|
||||
static int expr = 0;
|
||||
@ -211,3 +214,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
return(0);
|
||||
}
|
||||
#else
|
||||
#include <stdio.h>
|
||||
int main(int argc, char **argv) {
|
||||
printf("%s : XPath/Debug support not compiled in\n", argv[0]);
|
||||
return(0);
|
||||
}
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
|
14
tree.c
14
tree.c
@ -25,11 +25,11 @@
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "tree.h"
|
||||
#include "parser.h"
|
||||
#include "entities.h"
|
||||
#include "valid.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/valid.h>
|
||||
|
||||
static xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
|
||||
static xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
|
||||
@ -4451,7 +4451,11 @@ xmlElemDump(FILE *f, xmlDocPtr doc, xmlNodePtr cur) {
|
||||
if (buf == NULL) return;
|
||||
if ((doc != NULL) &&
|
||||
(doc->type == XML_HTML_DOCUMENT_NODE)) {
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
htmlNodeDump(buf, doc, cur);
|
||||
#else
|
||||
printf("HTML support not compiled in\n");
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
} else
|
||||
xmlNodeDump(buf, doc, cur, 0, 1);
|
||||
xmlBufferDump(f, buf);
|
||||
|
1
tree.h
1
tree.h
@ -11,6 +11,7 @@
|
||||
#define __XML_TREE_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
378
uri.c
378
uri.c
@ -18,8 +18,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "uri.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/uri.h>
|
||||
|
||||
/**
|
||||
* alpha = lowalpha | upalpha
|
||||
@ -159,30 +159,14 @@
|
||||
#define NEXT(p) ((*p == '%')? p += 3 : p++)
|
||||
|
||||
/**
|
||||
* Productions from the spec.
|
||||
*
|
||||
|
||||
*
|
||||
authority = server | reg_name
|
||||
server = [ [ userinfo "@" ] hostport ]
|
||||
|
||||
* authority = server | reg_name
|
||||
* reg_name = 1*( unreserved | escaped | "$" | "," |
|
||||
* ";" | ":" | "@" | "&" | "=" | "+" )
|
||||
|
||||
* userinfo = *( unreserved | escaped |
|
||||
* ";" | ":" | "&" | "=" | "+" | "$" | "," )
|
||||
|
||||
hostport = host [ ":" port ]
|
||||
host = hostname | IPv4address
|
||||
hostname = *( domainlabel "." ) toplabel [ "." ]
|
||||
domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
|
||||
toplabel = alpha | alpha *( alphanum | "-" ) alphanum
|
||||
IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit
|
||||
port = *digit
|
||||
|
||||
path = [ abs_path | opaque_part ]
|
||||
|
||||
|
||||
*/
|
||||
*
|
||||
* path = [ abs_path | opaque_part ]
|
||||
*/
|
||||
|
||||
/**
|
||||
* xmlCreateURI:
|
||||
@ -302,7 +286,90 @@ xmlSaveUri(xmlURIPtr uri) {
|
||||
}
|
||||
ret[len++] = 0;
|
||||
} else {
|
||||
if (uri->authority != NULL) {
|
||||
if (uri->server != NULL) {
|
||||
if (len + 3 >= max) {
|
||||
max *= 2;
|
||||
ret = xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
|
||||
if (ret == NULL) {
|
||||
fprintf(stderr, "xmlSaveUri: out of memory\n");
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
ret[len++] = '/';
|
||||
ret[len++] = '/';
|
||||
if (uri->user != NULL) {
|
||||
p = uri->user;
|
||||
while (*p != 0) {
|
||||
if (len + 3 >= max) {
|
||||
max *= 2;
|
||||
ret = xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
|
||||
if (ret == NULL) {
|
||||
fprintf(stderr, "xmlSaveUri: out of memory\n");
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
if ((IS_UNRESERVED(*(p))) ||
|
||||
((*(p) == ';')) || ((*(p) == ':')) || ((*(p) == '&')) ||
|
||||
((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) ||
|
||||
((*(p) == ',')))
|
||||
ret[len++] = *p++;
|
||||
else {
|
||||
int val = *p++;
|
||||
ret[len++] = '%';
|
||||
switch (val / 0x10) {
|
||||
case 0xF: ret[len++] = 'F'; break;
|
||||
case 0xE: ret[len++] = 'E'; break;
|
||||
case 0xD: ret[len++] = 'D'; break;
|
||||
case 0xC: ret[len++] = 'C'; break;
|
||||
case 0xB: ret[len++] = 'B'; break;
|
||||
case 0xA: ret[len++] = 'A'; break;
|
||||
default: ret[len++] = '0' + (val / 0x10);
|
||||
}
|
||||
switch (val % 0x10) {
|
||||
case 0xF: ret[len++] = 'F'; break;
|
||||
case 0xE: ret[len++] = 'E'; break;
|
||||
case 0xD: ret[len++] = 'D'; break;
|
||||
case 0xC: ret[len++] = 'C'; break;
|
||||
case 0xB: ret[len++] = 'B'; break;
|
||||
case 0xA: ret[len++] = 'A'; break;
|
||||
default: ret[len++] = '0' + (val % 0x10);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (len + 3 >= max) {
|
||||
max *= 2;
|
||||
ret = xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
|
||||
if (ret == NULL) {
|
||||
fprintf(stderr, "xmlSaveUri: out of memory\n");
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
ret[len++] = '@';
|
||||
}
|
||||
p = uri->server;
|
||||
while (*p != 0) {
|
||||
if (len >= max) {
|
||||
max *= 2;
|
||||
ret = xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
|
||||
if (ret == NULL) {
|
||||
fprintf(stderr, "xmlSaveUri: out of memory\n");
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
ret[len++] = *p++;
|
||||
}
|
||||
if (uri->port > 0) {
|
||||
if (len + 10 >= max) {
|
||||
max *= 2;
|
||||
ret = xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
|
||||
if (ret == NULL) {
|
||||
fprintf(stderr, "xmlSaveUri: out of memory\n");
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
len += sprintf((char *) &ret[len], ":%d", uri->port);
|
||||
}
|
||||
} else if (uri->authority != NULL) {
|
||||
if (len + 3 >= max) {
|
||||
max *= 2;
|
||||
ret = xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
|
||||
@ -529,6 +596,8 @@ xmlCleanURI(xmlURIPtr uri) {
|
||||
uri->scheme = NULL;
|
||||
if (uri->server != NULL) xmlFree(uri->server);
|
||||
uri->server = NULL;
|
||||
if (uri->user != NULL) xmlFree(uri->user);
|
||||
uri->user = NULL;
|
||||
if (uri->path != NULL) xmlFree(uri->path);
|
||||
uri->path = NULL;
|
||||
if (uri->fragment != NULL) xmlFree(uri->fragment);
|
||||
@ -553,6 +622,7 @@ xmlFreeURI(xmlURIPtr uri) {
|
||||
|
||||
if (uri->scheme != NULL) xmlFree(uri->scheme);
|
||||
if (uri->server != NULL) xmlFree(uri->server);
|
||||
if (uri->user != NULL) xmlFree(uri->user);
|
||||
if (uri->path != NULL) xmlFree(uri->path);
|
||||
if (uri->fragment != NULL) xmlFree(uri->fragment);
|
||||
if (uri->opaque != NULL) xmlFree(uri->opaque);
|
||||
@ -563,7 +633,7 @@ xmlFreeURI(xmlURIPtr uri) {
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlURIUnescape:
|
||||
* xmlURIUnescapeString:
|
||||
* @str: the string to unescape
|
||||
* @len: the lenght in bytes to unescape (or <= 0 to indicate full string)
|
||||
* @target: optionnal destination buffer
|
||||
@ -574,7 +644,7 @@ xmlFreeURI(xmlURIPtr uri) {
|
||||
* Returns an copy of the string, but unescaped
|
||||
*/
|
||||
char *
|
||||
xmlURIUnescape(const char *str, int len, char *target) {
|
||||
xmlURIUnescapeString(const char *str, int len, char *target) {
|
||||
char *ret, *out;
|
||||
const char *in;
|
||||
|
||||
@ -586,7 +656,7 @@ xmlURIUnescape(const char *str, int len, char *target) {
|
||||
if (target == NULL) {
|
||||
ret = (char *) xmlMalloc(len + 1);
|
||||
if (ret == NULL) {
|
||||
fprintf(stderr, "xmlURIUnescape: out of memory\n");
|
||||
fprintf(stderr, "xmlURIUnescapeString: out of memory\n");
|
||||
return(NULL);
|
||||
}
|
||||
} else
|
||||
@ -643,7 +713,7 @@ xmlParseURIFragment(xmlURIPtr uri, const char **str) {
|
||||
while (IS_URIC(cur)) NEXT(cur);
|
||||
if (uri != NULL) {
|
||||
if (uri->fragment != NULL) xmlFree(uri->fragment);
|
||||
uri->fragment = xmlURIUnescape(*str, cur - *str, NULL);
|
||||
uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL);
|
||||
}
|
||||
*str = cur;
|
||||
return(0);
|
||||
@ -669,7 +739,7 @@ xmlParseURIQuery(xmlURIPtr uri, const char **str) {
|
||||
while (IS_URIC(cur)) NEXT(cur);
|
||||
if (uri != NULL) {
|
||||
if (uri->query != NULL) xmlFree(uri->query);
|
||||
uri->query = xmlURIUnescape(*str, cur - *str, NULL);
|
||||
uri->query = xmlURIUnescapeString(*str, cur - *str, NULL);
|
||||
}
|
||||
*str = cur;
|
||||
return(0);
|
||||
@ -700,7 +770,7 @@ xmlParseURIScheme(xmlURIPtr uri, const char **str) {
|
||||
while (IS_SCHEME(*cur)) cur++;
|
||||
if (uri != NULL) {
|
||||
if (uri->scheme != NULL) xmlFree(uri->scheme);
|
||||
uri->scheme = xmlURIUnescape(*str, cur - *str, NULL); /* !!! strndup */
|
||||
uri->scheme = xmlURIUnescapeString(*str, cur - *str, NULL); /* !!! strndup */
|
||||
}
|
||||
*str = cur;
|
||||
return(0);
|
||||
@ -732,12 +802,142 @@ xmlParseURIOpaquePart(xmlURIPtr uri, const char **str) {
|
||||
while (IS_URIC(cur)) NEXT(cur);
|
||||
if (uri != NULL) {
|
||||
if (uri->opaque != NULL) xmlFree(uri->opaque);
|
||||
uri->opaque = xmlURIUnescape(*str, cur - *str, NULL);
|
||||
uri->opaque = xmlURIUnescapeString(*str, cur - *str, NULL);
|
||||
}
|
||||
*str = cur;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParseURIServer:
|
||||
* @uri: pointer to an URI structure
|
||||
* @str: pointer to the string to analyze
|
||||
*
|
||||
* Parse a server subpart of an URI, it's a finer grain analysis
|
||||
* of the authority part.
|
||||
*
|
||||
* server = [ [ userinfo "@" ] hostport ]
|
||||
* userinfo = *( unreserved | escaped |
|
||||
* ";" | ":" | "&" | "=" | "+" | "$" | "," )
|
||||
* hostport = host [ ":" port ]
|
||||
* host = hostname | IPv4address
|
||||
* hostname = *( domainlabel "." ) toplabel [ "." ]
|
||||
* domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
|
||||
* toplabel = alpha | alpha *( alphanum | "-" ) alphanum
|
||||
* IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit
|
||||
* port = *digit
|
||||
*
|
||||
* Returns 0 or the error code
|
||||
*/
|
||||
int
|
||||
xmlParseURIServer(xmlURIPtr uri, const char **str) {
|
||||
const char *cur;
|
||||
const char *host, *tmp;
|
||||
|
||||
if (str == NULL)
|
||||
return(-1);
|
||||
|
||||
cur = *str;
|
||||
|
||||
/*
|
||||
* is there an userinfo ?
|
||||
*/
|
||||
while (IS_USERINFO(cur)) NEXT(cur);
|
||||
if (*cur == '@') {
|
||||
if (uri != NULL) {
|
||||
if (uri->user != NULL) xmlFree(uri->user);
|
||||
uri->user = xmlURIUnescapeString(*str, cur - *str, NULL);
|
||||
}
|
||||
cur++;
|
||||
} else {
|
||||
if (uri != NULL) {
|
||||
if (uri->user != NULL) xmlFree(uri->user);
|
||||
uri->user = NULL;
|
||||
}
|
||||
cur = *str;
|
||||
}
|
||||
/*
|
||||
* host part of hostport can derive either an IPV4 address
|
||||
* or an unresolved name. Check the IP first, it easier to detect
|
||||
* errors if wrong one
|
||||
*/
|
||||
host = cur;
|
||||
if (IS_DIGIT(*cur)) {
|
||||
while(IS_DIGIT(*cur)) cur++;
|
||||
if (*cur != '.')
|
||||
goto host_name;
|
||||
cur++;
|
||||
if (!IS_DIGIT(*cur))
|
||||
goto host_name;
|
||||
while(IS_DIGIT(*cur)) cur++;
|
||||
if (*cur != '.')
|
||||
goto host_name;
|
||||
cur++;
|
||||
if (!IS_DIGIT(*cur))
|
||||
goto host_name;
|
||||
while(IS_DIGIT(*cur)) cur++;
|
||||
if (*cur != '.')
|
||||
goto host_name;
|
||||
cur++;
|
||||
if (!IS_DIGIT(*cur))
|
||||
goto host_name;
|
||||
while(IS_DIGIT(*cur)) cur++;
|
||||
if (uri != NULL) {
|
||||
if (uri->authority != NULL) xmlFree(uri->authority);
|
||||
uri->authority = NULL;
|
||||
if (uri->server != NULL) xmlFree(uri->server);
|
||||
uri->server = xmlURIUnescapeString(host, cur - host, NULL);
|
||||
}
|
||||
goto host_done;
|
||||
}
|
||||
host_name:
|
||||
/*
|
||||
* the hostname production as-is is a parser nightmare.
|
||||
* simplify it to
|
||||
* hostname = *( domainlabel "." ) domainlabel [ "." ]
|
||||
* and just make sure the last label starts with a non numeric char.
|
||||
*/
|
||||
if (!IS_ALPHANUM(*cur))
|
||||
return(6);
|
||||
while (IS_ALPHANUM(*cur)) {
|
||||
while ((IS_ALPHANUM(*cur)) || (*cur == '-')) cur++;
|
||||
if (*cur == '.')
|
||||
cur++;
|
||||
}
|
||||
tmp = cur;
|
||||
tmp--;
|
||||
while (IS_ALPHANUM(*tmp) && (*tmp != '.') && (tmp >= host)) tmp--;
|
||||
tmp++;
|
||||
if (!IS_ALPHA(*tmp))
|
||||
return(7);
|
||||
if (uri != NULL) {
|
||||
if (uri->authority != NULL) xmlFree(uri->authority);
|
||||
uri->authority = NULL;
|
||||
if (uri->server != NULL) xmlFree(uri->server);
|
||||
uri->server = xmlURIUnescapeString(host, cur - host, NULL);
|
||||
}
|
||||
|
||||
host_done:
|
||||
|
||||
/*
|
||||
* finish by checking for a port presence.
|
||||
*/
|
||||
if (*cur == ':') {
|
||||
cur++;
|
||||
if (IS_DIGIT(*cur)) {
|
||||
if (uri != NULL)
|
||||
uri->port = 0;
|
||||
while (IS_DIGIT(*cur)) {
|
||||
if (uri != NULL)
|
||||
uri->port = uri->port * 10 + (*cur - '0');
|
||||
cur++;
|
||||
}
|
||||
}
|
||||
}
|
||||
*str = cur;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParseURIRelSegment:
|
||||
* @uri: pointer to an URI structure
|
||||
@ -765,7 +965,7 @@ xmlParseURIRelSegment(xmlURIPtr uri, const char **str) {
|
||||
while (IS_SEGMENT(cur)) NEXT(cur);
|
||||
if (uri != NULL) {
|
||||
if (uri->path != NULL) xmlFree(uri->path);
|
||||
uri->path = xmlURIUnescape(*str, cur - *str, NULL);
|
||||
uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
|
||||
}
|
||||
*str = cur;
|
||||
return(0);
|
||||
@ -830,7 +1030,7 @@ xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash) {
|
||||
path[len2] = '/';
|
||||
len2++;
|
||||
}
|
||||
xmlURIUnescape(*str, cur - *str, &path[len2]);
|
||||
xmlURIUnescapeString(*str, cur - *str, &path[len2]);
|
||||
if (uri->path != NULL)
|
||||
xmlFree(uri->path);
|
||||
uri->path = path;
|
||||
@ -865,21 +1065,35 @@ xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash) {
|
||||
int
|
||||
xmlParseURIAuthority(xmlURIPtr uri, const char **str) {
|
||||
const char *cur;
|
||||
int ret;
|
||||
|
||||
if (str == NULL)
|
||||
return(-1);
|
||||
|
||||
cur = *str;
|
||||
|
||||
/*
|
||||
* try first to parse it as a server string.
|
||||
*/
|
||||
ret = xmlParseURIServer(uri, str);
|
||||
if (ret == 0)
|
||||
return(0);
|
||||
|
||||
/*
|
||||
* failed, fallback to reg_name
|
||||
*/
|
||||
if (!IS_REG_NAME(cur)) {
|
||||
return(5);
|
||||
}
|
||||
NEXT(cur);
|
||||
while (IS_REG_NAME(cur)) NEXT(cur);
|
||||
if (uri != NULL) {
|
||||
if (uri->server != NULL) xmlFree(uri->server);
|
||||
uri->server = NULL;
|
||||
if (uri->user != NULL) xmlFree(uri->user);
|
||||
uri->user = NULL;
|
||||
if (uri->authority != NULL) xmlFree(uri->authority);
|
||||
uri->authority = xmlURIUnescape(*str, cur - *str, NULL);
|
||||
|
||||
/* @@ Parse the authority to try to extract server infos !!! */
|
||||
uri->authority = xmlURIUnescapeString(*str, cur - *str, NULL);
|
||||
}
|
||||
*str = cur;
|
||||
return(0);
|
||||
@ -1252,7 +1466,8 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
|
||||
if (res == NULL)
|
||||
goto done;
|
||||
if ((ref->scheme == NULL) && (ref->path == NULL) &&
|
||||
(ref->authority == NULL) && (ref->query == NULL)) {
|
||||
((ref->authority == NULL) && (ref->server == NULL)) &&
|
||||
(ref->query == NULL)) {
|
||||
if (ref->fragment == NULL)
|
||||
goto done;
|
||||
res->fragment = xmlMemStrdup(ref->fragment);
|
||||
@ -1279,8 +1494,15 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
|
||||
* component, which will also be undefined if the URI scheme does not
|
||||
* use an authority component.
|
||||
*/
|
||||
if (ref->authority != NULL) {
|
||||
res->authority = xmlMemStrdup(ref->authority);
|
||||
if ((ref->authority != NULL) || (ref->server != NULL)) {
|
||||
if (ref->authority != NULL)
|
||||
res->authority = xmlMemStrdup(ref->authority);
|
||||
else {
|
||||
res->server = xmlMemStrdup(ref->server);
|
||||
if (ref->user != NULL)
|
||||
res->user = xmlMemStrdup(ref->user);
|
||||
res->port = ref->port;
|
||||
}
|
||||
if (ref->path != NULL)
|
||||
res->path = xmlMemStrdup(ref->path);
|
||||
if (ref->query != NULL)
|
||||
@ -1291,6 +1513,12 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
|
||||
}
|
||||
if (bas->authority != NULL)
|
||||
res->authority = xmlMemStrdup(bas->authority);
|
||||
else if (bas->server != NULL) {
|
||||
res->server = xmlMemStrdup(bas->server);
|
||||
if (bas->user != NULL)
|
||||
res->user = xmlMemStrdup(bas->user);
|
||||
res->port = bas->port;
|
||||
}
|
||||
|
||||
/*
|
||||
* 5) If the path component begins with a slash character ("/"), then
|
||||
@ -1386,75 +1614,3 @@ done:
|
||||
}
|
||||
|
||||
|
||||
#ifdef STANDALONE
|
||||
int main(int argc, char **argv) {
|
||||
int i, ret, arg = 1;
|
||||
xmlURIPtr uri;
|
||||
const char *base = NULL;
|
||||
xmlChar *composite;
|
||||
|
||||
if ((!strcmp(argv[arg], "-base")) || (!strcmp(argv[arg], "--base"))) {
|
||||
arg++;
|
||||
base = argv[arg];
|
||||
if (base != NULL)
|
||||
arg++;
|
||||
}
|
||||
uri = xmlCreateURI();
|
||||
if (argv[arg] == NULL) {
|
||||
char str[1024];
|
||||
|
||||
while (1) {
|
||||
/*
|
||||
* read one line in string buffer.
|
||||
*/
|
||||
if (fgets (&str[0], sizeof (str) - 1, stdin) == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* remove the ending spaces
|
||||
*/
|
||||
i = strlen(str);
|
||||
while ((i > 0) &&
|
||||
((str[i - 1] == '\n') || (str[i - 1] == '\r') ||
|
||||
(str[i - 1] == ' ') || (str[i - 1] == '\t'))) {
|
||||
i--;
|
||||
str[i] = 0;
|
||||
}
|
||||
if (i <= 0)
|
||||
continue;
|
||||
|
||||
ret = xmlParseURIReference(uri, str);
|
||||
if (ret != 0)
|
||||
printf("%s : error %d\n", str, ret);
|
||||
else {
|
||||
xmlPrintURI(stdout, uri);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
while (argv[arg] != NULL) {
|
||||
if (base == NULL) {
|
||||
ret = xmlParseURIReference(uri, argv[arg]);
|
||||
if (ret != 0)
|
||||
printf("%s : error %d\n", argv[arg], ret);
|
||||
else {
|
||||
xmlPrintURI(stdout, uri);
|
||||
printf("\n");
|
||||
}
|
||||
} else {
|
||||
composite = xmlBuildURI((xmlChar *)argv[arg], (xmlChar *) base);
|
||||
if (base == NULL) {
|
||||
} else {
|
||||
printf("%s\n", composite);
|
||||
xmlFree(composite);
|
||||
}
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
}
|
||||
xmlFreeURI(uri);
|
||||
xmlMemoryDump();
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
11
uri.h
11
uri.h
@ -11,7 +11,7 @@
|
||||
#ifndef __XML_URI_H__
|
||||
#define __XML_URI_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -24,10 +24,11 @@ typedef struct _xmlURI xmlURI;
|
||||
typedef xmlURI *xmlURIPtr;
|
||||
struct _xmlURI {
|
||||
char *scheme;
|
||||
char *opaque;
|
||||
char *authority;
|
||||
char *server;
|
||||
char *user;
|
||||
int port;
|
||||
char *opaque;
|
||||
char *path;
|
||||
char *query;
|
||||
char *fragment;
|
||||
@ -42,7 +43,13 @@ xmlChar * xmlBuildURI (const xmlChar *URI,
|
||||
const xmlChar *base);
|
||||
xmlURIPtr xmlParseURI (const char *URI);
|
||||
xmlChar * xmlSaveUri (xmlURIPtr uri);
|
||||
void xmlPrintURI (FILE *stream,
|
||||
xmlURIPtr uri);
|
||||
char * xmlURIUnescapeString (const char *str,
|
||||
int len,
|
||||
char *target);
|
||||
int xmlNormalizeURIPath (char *path);
|
||||
void xmlFreeURI (xmlURIPtr uri);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
8
valid.c
8
valid.c
@ -20,10 +20,10 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "valid.h"
|
||||
#include "parser.h"
|
||||
#include "parserInternals.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
|
||||
/*
|
||||
* Generic function for accessing stacks in the Validity Context
|
||||
|
2
valid.h
2
valid.h
@ -10,7 +10,7 @@
|
||||
#ifndef __XML_VALID_H__
|
||||
#define __XML_VALID_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
10
xlink.c
10
xlink.c
@ -35,11 +35,11 @@
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "tree.h"
|
||||
#include "parser.h"
|
||||
#include "valid.h"
|
||||
#include "xlink.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/xlink.h>
|
||||
|
||||
#define XLINK_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xlink/namespace/")
|
||||
#define XHTML_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xhtml/")
|
||||
|
2
xlink.h
2
xlink.h
@ -13,7 +13,7 @@
|
||||
#ifndef __XML_XLINK_H__
|
||||
#define __XML_XLINK_H__
|
||||
|
||||
#include "tree.h"
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define extern "C" {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __XML_ERROR_H__
|
||||
#define __XML_ERROR_H__
|
||||
|
||||
#include "parser.h"
|
||||
#include <libxml/parser.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
36
xmlIO.c
36
xmlIO.c
@ -34,12 +34,12 @@
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "parser.h"
|
||||
#include "parserInternals.h"
|
||||
#include "xmlIO.h"
|
||||
#include "nanohttp.h"
|
||||
#include "nanoftp.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/nanohttp.h>
|
||||
#include <libxml/nanoftp.h>
|
||||
|
||||
/* #define DEBUG_INPUT */
|
||||
/* #define VERBOSE_FAILURE */
|
||||
@ -99,10 +99,14 @@ xmlFreeParserInputBuffer(xmlParserInputBufferPtr in) {
|
||||
if (in->gzfile != NULL)
|
||||
gzclose(in->gzfile);
|
||||
#endif
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
if (in->httpIO != NULL)
|
||||
xmlNanoHTTPClose(in->httpIO);
|
||||
#endif
|
||||
#ifdef LIBXML_FTP_ENABLED
|
||||
if (in->ftpIO != NULL)
|
||||
xmlNanoFTPClose(in->ftpIO);
|
||||
#endif
|
||||
if (in->fd >= 0)
|
||||
close(in->fd);
|
||||
memset(in, 0xbe, (size_t) sizeof(xmlParserInputBuffer));
|
||||
@ -135,6 +139,7 @@ xmlParserInputBufferCreateFilename(const char *filename, xmlCharEncoding enc) {
|
||||
|
||||
if (filename == NULL) return(NULL);
|
||||
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
if (!strncmp(filename, "http://", 7)) {
|
||||
httpIO = xmlNanoHTTPOpen(filename, NULL);
|
||||
if (httpIO == NULL) {
|
||||
@ -144,7 +149,10 @@ xmlParserInputBufferCreateFilename(const char *filename, xmlCharEncoding enc) {
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
} else if (!strncmp(filename, "ftp://", 6)) {
|
||||
} else
|
||||
#endif /* LIBXML_HTTP_ENABLED */
|
||||
#ifdef LIBXML_FTP_ENABLED
|
||||
if (!strncmp(filename, "ftp://", 6)) {
|
||||
ftpIO = xmlNanoFTPOpen(filename);
|
||||
if (ftpIO == NULL) {
|
||||
#ifdef VERBOSE_FAILURE
|
||||
@ -153,7 +161,9 @@ xmlParserInputBufferCreateFilename(const char *filename, xmlCharEncoding enc) {
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
} else if (!strcmp(filename, "-")) {
|
||||
} else
|
||||
#endif /* LIBXML_FTP_ENABLED */
|
||||
if (!strcmp(filename, "-")) {
|
||||
#ifdef HAVE_ZLIB_H
|
||||
input = gzdopen (fileno(stdin), "r");
|
||||
if (input == NULL) {
|
||||
@ -362,11 +372,17 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
|
||||
fprintf(stderr, "xmlParserInputBufferGrow : out of memory !\n");
|
||||
return(-1);
|
||||
}
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
if (in->httpIO != NULL) {
|
||||
res = xmlNanoHTTPRead(in->httpIO, &buffer[0], len);
|
||||
} else if (in->ftpIO != NULL) {
|
||||
} else
|
||||
#endif
|
||||
#ifdef LIBXML_FTP_ENABLED
|
||||
if (in->ftpIO != NULL) {
|
||||
res = xmlNanoFTPRead(in->ftpIO, &buffer[0], len);
|
||||
} else if (in->file != NULL) {
|
||||
} else
|
||||
#endif
|
||||
if (in->file != NULL) {
|
||||
res = fread(&buffer[0], 1, len, in->file);
|
||||
#ifdef HAVE_ZLIB_H
|
||||
} else if (in->gzfile != NULL) {
|
||||
|
6
xmlIO.h
6
xmlIO.h
@ -10,9 +10,9 @@
|
||||
#define __XML_IO_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "tree.h"
|
||||
#include "parser.h"
|
||||
#include "encoding.h"
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/encoding.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -30,7 +30,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
|
||||
#ifdef xmlMalloc
|
||||
#undef xmlMalloc
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define _DEBUG_MEMORY_ALLOC_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
/*
|
||||
* DEBUG_MEMORY_LOCATION should be activated only done when debugging
|
||||
|
14
xpath.c
14
xpath.c
@ -19,6 +19,9 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xmlversion.h"
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -41,11 +44,11 @@
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include "xmlmemory.h"
|
||||
#include "tree.h"
|
||||
#include "valid.h"
|
||||
#include "xpath.h"
|
||||
#include "parserInternals.h"
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
|
||||
/* #define DEBUG */
|
||||
/* #define DEBUG_STEP */
|
||||
@ -4579,3 +4582,4 @@ xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) {
|
||||
return(res);
|
||||
}
|
||||
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
|
Loading…
Reference in New Issue
Block a user