Add libxml and its dependencies

- Copied from Chromium.
- third_party/libxml (v2.7.7)
- third_party/zlib

Change-Id: I4a79601a7d8d5fa920cb27632d92448753e6d2dc
This commit is contained in:
Rintaro Kuroiwa 2013-10-17 14:05:18 -07:00
parent db7602f42e
commit 1ada724850
259 changed files with 385614 additions and 0 deletions

59
third_party/libxml/README.chromium vendored Normal file
View File

@ -0,0 +1,59 @@
Name: libxml
URL: http://xmlsoft.org
Version: 2.7.7
License: MIT
License File: src/Copyright
Security Critical: yes
Description:
The src/ directory contains a partial snapshot of the libxml library
with the patches in the patches/ directories applied.
See the files in that directory for discussion of their effects.
Current version: 2.7.7.
Modifications:
- Converted to utf-8 with: vim +"argdo write ++enc=utf-8" *.c
- Import XPath fix http://git.gnome.org/browse/libxml2/commit/?id=91d19754d46acd4a639a8b9e31f50f31c78f8c9c
- Import follow-on for above commit: http://git.gnome.org/browse/libxml2/commit/?id=ea90b894146030c214a7df6d8375310174f134b9
- Import additional XPath fix http://git.gnome.org/browse/libxml2/commit/?id=df83c17e5a2646bd923f75e5e507bc80d73c9722
- Import follow-on fix for above commit: http://git.gnome.org/browse/libxml2/commit/?id=fec31bcd452e77c10579467ca87a785b41115de6
- And a follow-on fix to the previous two fixes, committed upstream: http://git.gnome.org/browse/libxml2/commit/?id=f5048b3e71fc30ad096970b8df6e7af073bae4cb (slightly differently, but we can drop our local fix on the next roll).
- Add a fix for handling of unknown namespaces, commit upstream is pending.
- Add fixes for ending the parse properly if a SAX callback calls xmlStopParser(), commit upstream is pending.
- Add fix for entities, commit upstream is http://git.gnome.org/browse/libxml2/commit/?id=5bd3c061823a8499b27422aee04ea20aae24f03e
- Import UTF-8 fix from upstream: http://git.gnome.org/browse/libxml2/commit/?id=0795348aeb86648723bc391e4d02e20631c10bca
- Import XPath fix http://git.gnome.org/browse/libxml2/commit/xpath.c?id=2ddecc23862bab1a9a9e51e097aefc92ec305e28
- Merge clang warning fix http://git.gnome.org/browse/libxml2/commit/?id=aae48e64dfbf2b46b157a4c1857e30645116388f
- Add a fix for proper escaping of xpointer expressions, commit upstream is pending.
- Add helper classes in chromium/libxml_utils.cc and chromium/include/libxml/libxml_utils.h.
- Add a tweak to limit problems caused by excessive strings and buffers.
- Change the xmlNs struct a little bit, so it looks like it has no children
if treated as a generic xmlNode object.
- Fix pretty harmless use-after-free in generate-id function.
- Merge a clang warning fix http://git.gnome.org/browse/libxml2/commit/?id=713434d2309da469d64b35e163ea6556dadccada
- Import attribute normalization fix http://git.gnome.org/browse/libxml2/commit/?id=6a36fbe3b3e001a8a840b5c1fdd81cefc9947f0d
- Merge a redundant comparison fix http://git.gnome.org/browse/libxml2/commit/?id=2af19f985b911b6dc6ada478ba8d201d2ddc9309
- Merge a redundant comparisons fix https://git.gnome.org/browse/libxml2/commit/?id=eea38159be421dbafbee38f40e239f91734bc713
- Merge XML_PARSER_EOF checks https://git.gnome.org/browse/libxml2/commit/?id=48b4cdde3483e054af8ea02e0cd7ee467b0e9a50 and https://git.gnome.org/browse/libxml2/commit/?id=e50ba8164eee06461c73cd8abb9b46aa0be81869
To import a new snapshot of libxml:
- Visit http://xmlsoft.org/downloads.html and download the latest source
distribution.
- Copy the files into this directory, omitting files which have been omitted
here. E.g.: for i in $(find . -type f); do cp ../libxml-newver/$i $i; done
This should clobber all local changes to this directory.
- Apply the patches in patches/ and fix any problems.
UPDATE THOSE PATCHES OR EVAN WILL HUNT YOU DOWN.
- On a Linux system,
$ cd linux
$ ../configure --without-iconv --without-ftp --without-http
to generate config.h and include/libxml/xmlversion.h for Linux.
- On a Mac,
$ cd mac
$ ../configure --without-iconv --without-ftp --without-http
to generate config.h and include/libxml/xmlversion.h for Macs.
- On Windows, run build/generate-win32-headers.bat to re-generate config.h and
include/libxml/xmlversion.h for Windows builds.
- Update this README to reflect the new version number.

View File

@ -0,0 +1,9 @@
REM Generate config.h and xmlversion.h. We put the generated files in
REM win32 so they don't get included on other platforms.
cd %~dp0\..\win32
cscript //E:jscript configure.js compiler=msvc iconv=no icu=yes
move ..\config.h .
md include\libxml
move ..\include\libxml\xmlversion.h include\libxml\

View File

@ -0,0 +1,127 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libxml_utils.h"
#include "libxml/xmlreader.h"
std::string XmlStringToStdString(const xmlChar* xmlstring) {
// xmlChar*s are UTF-8, so this cast is safe.
if (xmlstring)
return std::string(reinterpret_cast<const char*>(xmlstring));
else
return "";
}
XmlReader::XmlReader() : reader_(NULL) {
}
XmlReader::~XmlReader() {
if (reader_)
xmlFreeTextReader(reader_);
}
bool XmlReader::Load(const std::string& input) {
const int kParseOptions = XML_PARSE_RECOVER | // recover on errors
XML_PARSE_NONET; // forbid network access
// TODO(evanm): Verify it's OK to pass NULL for the URL and encoding.
// The libxml code allows for these, but it's unclear what effect is has.
reader_ = xmlReaderForMemory(input.data(), static_cast<int>(input.size()),
NULL, NULL, kParseOptions);
return reader_ != NULL;
}
bool XmlReader::LoadFile(const std::string& file_path) {
const int kParseOptions = XML_PARSE_RECOVER | // recover on errors
XML_PARSE_NONET; // forbid network access
reader_ = xmlReaderForFile(file_path.c_str(), NULL, kParseOptions);
return reader_ != NULL;
}
bool XmlReader::NodeAttribute(const char* name, std::string* out) {
xmlChar* value = xmlTextReaderGetAttribute(reader_, BAD_CAST name);
if (!value)
return false;
*out = XmlStringToStdString(value);
xmlFree(value);
return true;
}
bool XmlReader::IsClosingElement() {
return NodeType() == XML_READER_TYPE_END_ELEMENT;
}
bool XmlReader::ReadElementContent(std::string* content) {
const int start_depth = Depth();
if (xmlTextReaderIsEmptyElement(reader_)) {
// Empty tag. We succesfully read the content, but it's
// empty.
*content = "";
// Advance past this empty tag.
if (!Read())
return false;
return true;
}
// Advance past opening element tag.
if (!Read())
return false;
// Read the content. We read up until we hit a closing tag at the
// same level as our starting point.
while (NodeType() != XML_READER_TYPE_END_ELEMENT || Depth() != start_depth) {
*content += XmlStringToStdString(xmlTextReaderConstValue(reader_));
if (!Read())
return false;
}
// Advance past ending element tag.
if (!Read())
return false;
return true;
}
bool XmlReader::SkipToElement() {
do {
switch (NodeType()) {
case XML_READER_TYPE_ELEMENT:
return true;
case XML_READER_TYPE_END_ELEMENT:
return false;
default:
// Skip all other node types.
continue;
}
} while (Read());
return false;
}
// XmlWriter functions
XmlWriter::XmlWriter()
: writer_(NULL),
buffer_(NULL) {}
XmlWriter::~XmlWriter() {
if (writer_)
xmlFreeTextWriter(writer_);
if (buffer_)
xmlBufferFree(buffer_);
}
void XmlWriter::StartWriting() {
buffer_ = xmlBufferCreate();
writer_ = xmlNewTextWriterMemory(buffer_, 0);
xmlTextWriterSetIndent(writer_, 1);
xmlTextWriterStartDocument(writer_, NULL, NULL, NULL);
}
void XmlWriter::StopWriting() {
xmlTextWriterEndDocument(writer_);
xmlFreeTextWriter(writer_);
writer_ = NULL;
}

View File

@ -0,0 +1,180 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
#define THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
#pragma once
#include <string>
#include "libxml/xmlreader.h"
#include "libxml/xmlwriter.h"
// Converts a libxml xmlChar* into a UTF-8 std::string.
// NULL inputs produce an empty string.
std::string XmlStringToStdString(const xmlChar* xmlstring);
// libxml uses a global error function pointer for reporting errors.
// A ScopedXmlErrorFunc object lets you change the global error pointer
// for the duration of the object's lifetime.
class ScopedXmlErrorFunc {
public:
ScopedXmlErrorFunc(void* context, xmlGenericErrorFunc func) {
old_error_func_ = xmlGenericError;
old_error_context_ = xmlGenericErrorContext;
xmlSetGenericErrorFunc(context, func);
}
~ScopedXmlErrorFunc() {
xmlSetGenericErrorFunc(old_error_context_, old_error_func_);
}
private:
xmlGenericErrorFunc old_error_func_;
void* old_error_context_;
};
// XmlReader is a wrapper class around libxml's xmlReader,
// providing a simplified C++ API.
class XmlReader {
public:
XmlReader();
~XmlReader();
// Load a document into the reader from memory. |input| must be UTF-8 and
// exist for the lifetime of this object. Returns false on error.
// TODO(evanm): handle encodings other than UTF-8?
bool Load(const std::string& input);
// Load a document into the reader from a file. Returns false on error.
bool LoadFile(const std::string& file_path);
// Wrappers around libxml functions -----------------------------------------
// Read() advances to the next node. Returns false on EOF or error.
bool Read() { return xmlTextReaderRead(reader_) == 1; }
// Next(), when pointing at an opening tag, advances to the node after
// the matching closing tag. Returns false on EOF or error.
bool Next() { return xmlTextReaderNext(reader_) == 1; }
// Return the depth in the tree of the current node.
int Depth() { return xmlTextReaderDepth(reader_); }
// Returns the "local" name of the current node.
// For a tag like <foo:bar>, this is the string "foo:bar".
std::string NodeName() {
return XmlStringToStdString(xmlTextReaderConstLocalName(reader_));
}
// When pointing at a tag, retrieves the value of an attribute.
// Returns false on failure.
// E.g. for <foo bar:baz="a">, NodeAttribute("bar:baz", &value)
// returns true and |value| is set to "a".
bool NodeAttribute(const char* name, std::string* value);
// Returns true if the node is a closing element (e.g. </foo>).
bool IsClosingElement();
// Helper functions not provided by libxml ----------------------------------
// Return the string content within an element.
// "<foo>bar</foo>" is a sequence of three nodes:
// (1) open tag, (2) text, (3) close tag.
// With the reader currently at (1), this returns the text of (2),
// and advances past (3).
// Returns false on error.
bool ReadElementContent(std::string* content);
// Skip to the next opening tag, returning false if we reach a closing
// tag or EOF first.
// If currently on an opening tag, doesn't advance at all.
bool SkipToElement();
private:
// Returns the libxml node type of the current node.
int NodeType() { return xmlTextReaderNodeType(reader_); }
// The underlying libxml xmlTextReader.
xmlTextReaderPtr reader_;
};
// XmlWriter is a wrapper class around libxml's xmlWriter,
// providing a simplified C++ API.
// StartWriting must be called before other methods, and StopWriting
// must be called before GetWrittenString() will return results.
class XmlWriter {
public:
XmlWriter();
~XmlWriter();
// Allocates the xmlTextWriter and an xmlBuffer and starts an XML document.
// This must be called before any other functions. By default, indenting is
// set to true.
void StartWriting();
// Ends the XML document and frees the xmlTextWriter.
// This must be called before GetWrittenString() is called.
void StopWriting();
// Wrappers around libxml functions -----------------------------------------
// All following elements will be indented to match their depth.
void StartIndenting() { xmlTextWriterSetIndent(writer_, 1); }
// All follow elements will not be indented.
void StopIndenting() { xmlTextWriterSetIndent(writer_, 0); }
// Start an element with the given name. All future elements added will be
// children of this element, until it is ended. Returns false on error.
bool StartElement(const std::string& element_name) {
return xmlTextWriterStartElement(writer_,
BAD_CAST element_name.c_str()) >= 0;
}
// Ends the current open element. Returns false on error.
bool EndElement() {
return xmlTextWriterEndElement(writer_) >= 0;
}
// Appends to the content of the current open element.
bool AppendElementContent(const std::string& content) {
return xmlTextWriterWriteString(writer_,
BAD_CAST content.c_str()) >= 0;
}
// Adds an attribute to the current open element. Returns false on error.
bool AddAttribute(const std::string& attribute_name,
const std::string& attribute_value) {
return xmlTextWriterWriteAttribute(writer_,
BAD_CAST attribute_name.c_str(),
BAD_CAST attribute_value.c_str()) >= 0;
}
// Adds a new element with name |element_name| and content |content|
// to the buffer. Example: <|element_name|>|content|</|element_name|>
// Returns false on errors.
bool WriteElement(const std::string& element_name,
const std::string& content) {
return xmlTextWriterWriteElement(writer_,
BAD_CAST element_name.c_str(),
BAD_CAST content.c_str()) >= 0;
}
// Helper functions not provided by xmlTextWriter ---------------------------
// Returns the string that has been written to the buffer.
std::string GetWrittenString() {
if (buffer_ == NULL)
return "";
return XmlStringToStdString(buffer_->content);
}
private:
// The underlying libxml xmlTextWriter.
xmlTextWriterPtr writer_;
// Stores the output.
xmlBufferPtr buffer_;
};
#endif // THIRD_PARTY_LIBXML_CHROMIUM_INCLUDE_LIBXML_LIBXML_UTILS_H_

261
third_party/libxml/libxml.gyp vendored Normal file
View File

@ -0,0 +1,261 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'conditions': [
# Define an "os_include" variable that points at the OS-specific generated
# headers. These were generated by running the configure script offline.
['os_posix == 1 and OS != "mac" and OS != "ios"', {
'os_include': 'linux'
}],
['OS=="mac"', {'os_include': 'mac'}],
['OS=="win"', {'os_include': 'win32'}],
],
'use_system_libxml%': 0,
},
'targets': [
{
'target_name': 'libxml',
'conditions': [
['use_system_libxml', {
'conditions': [
['os_posix == 1 and OS != "mac" and OS != "ios"', {
'type': 'static_library',
'sources': [
'chromium/libxml_utils.h',
'chromium/libxml_utils.cc',
],
'cflags': [
'<!@(pkg-config --cflags libxml-2.0)',
],
'defines': [
'USE_SYSTEM_LIBXML',
],
'direct_dependent_settings': {
'cflags': [
'<!@(pkg-config --cflags libxml-2.0)',
],
'defines': [
'USE_SYSTEM_LIBXML',
],
},
'link_settings': {
'ldflags': [
'<!@(pkg-config --libs-only-L --libs-only-other libxml-2.0)',
],
'libraries': [
'<!@(pkg-config --libs-only-l libxml-2.0)',
],
},
}],
['OS == "ios"', {
'type': 'none',
'all_dependent_settings': {
'defines': [
'USE_SYSTEM_LIBXML',
],
'include_dirs': [
'$(SDKROOT)/usr/include/libxml2',
],
},
'link_settings': {
'libraries': [
'$(SDKROOT)/usr/lib/libxml2.dylib',
],
},
}],
],
}, { # else: !use_system_libxml
'type': 'static_library',
'sources': [
'chromium/libxml_utils.h',
'chromium/libxml_utils.cc',
'linux/config.h',
'linux/include/libxml/xmlversion.h',
'mac/config.h',
'mac/include/libxml/xmlversion.h',
'src/include/libxml/c14n.h',
'src/include/libxml/catalog.h',
'src/include/libxml/chvalid.h',
'src/include/libxml/debugXML.h',
'src/include/libxml/dict.h',
'src/include/libxml/DOCBparser.h',
'src/include/libxml/encoding.h',
'src/include/libxml/entities.h',
'src/include/libxml/globals.h',
'src/include/libxml/hash.h',
'src/include/libxml/HTMLparser.h',
'src/include/libxml/HTMLtree.h',
'src/include/libxml/list.h',
'src/include/libxml/nanoftp.h',
'src/include/libxml/nanohttp.h',
'src/include/libxml/parser.h',
'src/include/libxml/parserInternals.h',
'src/include/libxml/pattern.h',
'src/include/libxml/relaxng.h',
'src/include/libxml/SAX.h',
'src/include/libxml/SAX2.h',
'src/include/libxml/schemasInternals.h',
'src/include/libxml/schematron.h',
'src/include/libxml/threads.h',
'src/include/libxml/tree.h',
'src/include/libxml/uri.h',
'src/include/libxml/valid.h',
'src/include/libxml/xinclude.h',
'src/include/libxml/xlink.h',
'src/include/libxml/xmlautomata.h',
'src/include/libxml/xmlerror.h',
'src/include/libxml/xmlexports.h',
'src/include/libxml/xmlIO.h',
'src/include/libxml/xmlmemory.h',
'src/include/libxml/xmlmodule.h',
'src/include/libxml/xmlreader.h',
'src/include/libxml/xmlregexp.h',
'src/include/libxml/xmlsave.h',
'src/include/libxml/xmlschemas.h',
'src/include/libxml/xmlschemastypes.h',
'src/include/libxml/xmlstring.h',
'src/include/libxml/xmlunicode.h',
'src/include/libxml/xmlwriter.h',
'src/include/libxml/xpath.h',
'src/include/libxml/xpathInternals.h',
'src/include/libxml/xpointer.h',
'src/include/win32config.h',
'src/include/wsockcompat.h',
'src/acconfig.h',
'src/c14n.c',
'src/catalog.c',
'src/chvalid.c',
'src/debugXML.c',
'src/dict.c',
'src/DOCBparser.c',
'src/elfgcchack.h',
'src/encoding.c',
'src/entities.c',
'src/error.c',
'src/globals.c',
'src/hash.c',
'src/HTMLparser.c',
'src/HTMLtree.c',
'src/legacy.c',
'src/libxml.h',
'src/list.c',
'src/nanoftp.c',
'src/nanohttp.c',
'src/parser.c',
'src/parserInternals.c',
'src/pattern.c',
'src/relaxng.c',
'src/SAX.c',
'src/SAX2.c',
'src/schematron.c',
'src/threads.c',
'src/tree.c',
#'src/trio.c',
#'src/trio.h',
#'src/triodef.h',
#'src/trionan.c',
#'src/trionan.h',
#'src/triop.h',
#'src/triostr.c',
#'src/triostr.h',
'src/uri.c',
'src/valid.c',
'src/xinclude.c',
'src/xlink.c',
'src/xmlIO.c',
'src/xmlmemory.c',
'src/xmlmodule.c',
'src/xmlreader.c',
'src/xmlregexp.c',
'src/xmlsave.c',
'src/xmlschemas.c',
'src/xmlschemastypes.c',
'src/xmlstring.c',
'src/xmlunicode.c',
'src/xmlwriter.c',
'src/xpath.c',
'src/xpointer.c',
'win32/config.h',
'win32/include/libxml/xmlversion.h',
],
'defines': [
# Define LIBXML_STATIC as nothing to match how libxml.h
# (an internal header) defines LIBXML_STATIC, otherwise
# we get the macro redefined warning from GCC. (-DFOO
# defines the macro FOO as 1.)
'LIBXML_STATIC=',
],
'include_dirs': [
'<(os_include)',
'<(os_include)/include',
'src/include',
],
'dependencies': [
'../icu/icu.gyp:icuuc',
'../zlib/zlib.gyp:zlib',
],
'export_dependent_settings': [
'../icu/icu.gyp:icuuc',
],
'direct_dependent_settings': {
'defines': [
'LIBXML_STATIC',
],
'include_dirs': [
'<(os_include)/include',
'src/include',
],
},
'conditions': [
['OS=="linux"', {
'link_settings': {
'libraries': [
# We need dl for dlopen() and friends.
'-ldl',
],
},
}],
# http://www.xmlsoft.org/threads.html says that this is required
# when using libxml from several threads, which can possibly happen
# in chrome. On linux, this is picked up by transitivity from
# pkg-config output from build/linux/system.gyp.
['OS=="mac" or OS=="android"', {'defines': ['_REENTRANT']}],
['OS=="win"', {
'product_name': 'libxml2',
# Disable unimportant 'unused variable' warning, and
# signed/unsigned comparison warning. The signed/unsigned (4101)
# is fixed upstream and can be removed eventually.
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4018, 4101, 4267 ],
}, { # else: OS!="win"
'product_name': 'xml2',
}],
['clang == 1', {
'xcode_settings': {
'WARNING_CFLAGS': [
# libxml passes `const unsigned char*` through `const char*`.
'-Wno-pointer-sign',
# pattern.c and uri.c both have an intentional
# `for (...);` / `while(...);` loop. I submitted a patch to
# move the `'` to its own line, but until that's landed
# suppress the warning:
'-Wno-empty-body',
],
},
'cflags': [
'-Wno-pointer-sign',
'-Wno-empty-body',
# See http://crbug.com/138571#c8
'-Wno-ignored-attributes',
],
}],
],
}],
],
},
],
}

312
third_party/libxml/linux/config.h vendored Normal file
View File

@ -0,0 +1,312 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
#define PACKAGE "libxml2"
#define VERSION "2.7.7"
#define HAVE_LIBZ 1
/* #undef HAVE_LIBM */
#define HAVE_ISINF /**/
#define HAVE_ISNAN /**/
/* #undef HAVE_LIBHISTORY */
/* #undef HAVE_LIBREADLINE */
#define HAVE_LIBPTHREAD /**/
#define HAVE_PTHREAD_H /**/
/* Define if IPV6 support is there */
#define SUPPORT_IP6 /**/
/* Define if getaddrinfo is there */
#define HAVE_GETADDRINFO /**/
/* Define to 1 if you have the <ansidecl.h> header file. */
/* #undef HAVE_ANSIDECL_H */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#define HAVE_ARPA_NAMESER_H 1
/* Whether struct sockaddr::__ss_family exists */
/* #undef HAVE_BROKEN_SS_FAMILY */
/* Define to 1 if you have the `class' function. */
/* #undef HAVE_CLASS */
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define to 1 if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Have dlopen based dso */
#define HAVE_DLOPEN /**/
/* Define to 1 if you have the <dl.h> header file. */
/* #undef HAVE_DL_H */
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `finite' function. */
#define HAVE_FINITE 1
/* Define to 1 if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define to 1 if you have the `fpclass' function. */
/* #undef HAVE_FPCLASS */
/* Define to 1 if you have the `fprintf' function. */
#define HAVE_FPRINTF 1
/* Define to 1 if you have the `fp_class' function. */
/* #undef HAVE_FP_CLASS */
/* Define to 1 if you have the <fp_class.h> header file. */
/* #undef HAVE_FP_CLASS_H */
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
/* Define if getaddrinfo is there */
#define HAVE_GETADDRINFO /**/
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef HAVE_IEEEFP_H */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <inttypes.h.h> header file. */
/* #undef HAVE_INTTYPES_H_H */
/* Define if isinf is there */
#define HAVE_ISINF /**/
/* Define if isnan is there */
#define HAVE_ISNAN /**/
/* Define to 1 if you have the `isnand' function. */
/* #undef HAVE_ISNAND */
/* Define if history library is there (-lhistory) */
/* #undef HAVE_LIBHISTORY */
/* Define if pthread library is there (-lpthread) */
#define HAVE_LIBPTHREAD /**/
/* Define if readline library is there (-lreadline) */
/* #undef HAVE_LIBREADLINE */
/* Have compression library */
#define HAVE_LIBZ 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the `localtime' function. */
#define HAVE_LOCALTIME 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the <math.h> header file. */
#define HAVE_MATH_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <nan.h> header file. */
/* #undef HAVE_NAN_H */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define to 1 if you have the `printf' function. */
#define HAVE_PRINTF 1
/* Define if <pthread.h> is there */
#define HAVE_PTHREAD_H /**/
/* Define to 1 if you have the <resolv.h> header file. */
#define HAVE_RESOLV_H 1
/* Have shl_load based dso */
/* #undef HAVE_SHLLOAD */
/* Define to 1 if you have the `signal' function. */
#define HAVE_SIGNAL 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the `sprintf' function. */
#define HAVE_SPRINTF 1
/* Define to 1 if you have the `sscanf' function. */
#define HAVE_SSCANF 1
/* Define to 1 if you have the `stat' function. */
#define HAVE_STAT 1
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strndup' function. */
#define HAVE_STRNDUP 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Whether va_copy() is available */
#define HAVE_VA_COPY 1
/* Define to 1 if you have the `vfprintf' function. */
#define HAVE_VFPRINTF 1
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `vsprintf' function. */
#define HAVE_VSPRINTF 1
/* Define to 1 if you have the <zlib.h> header file. */
#define HAVE_ZLIB_H 1
/* Define to 1 if you have the `_stat' function. */
/* #undef HAVE__STAT */
/* Whether __va_copy() is available */
/* #undef HAVE___VA_COPY */
/* Define as const if the declaration of iconv() needs const. */
/* #undef ICONV_CONST */
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "libxml2"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to 1 if the C compiler supports function prototypes. */
#define PROTOTYPES 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Support for IPv6 */
#define SUPPORT_IP6 /**/
/* Version number of package */
#define VERSION "2.7.7"
/* Determine what socket length (socklen_t) data type is */
#define XML_SOCKLEN_T socklen_t
/* Using the Win32 Socket implementation */
/* #undef _WINSOCKAPI_ */
/* Define like PROTOTYPES; this can be used by system headers. */
#define __PROTOTYPES 1
/* Win32 Std C name mangling work-around */
/* #undef snprintf */
/* ss_family is not defined here, use __ss_family instead */
/* #undef ss_family */
/* Win32 Std C name mangling work-around */
/* #undef vsnprintf */

View File

@ -0,0 +1,467 @@
/*
* Summary: compile-time version informations
* Description: compile-time version informations for the XML library
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_VERSION_H__
#define __XML_VERSION_H__
#include <libxml/xmlexports.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* use those to be sure nothing nasty will happen if
* your library and includes mismatch
*/
#ifndef LIBXML2_COMPILING_MSCCDEF
XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif /* LIBXML2_COMPILING_MSCCDEF */
/**
* LIBXML_DOTTED_VERSION:
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.7.7"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 20707
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "20707"
/**
* LIBXML_VERSION_EXTRA:
*
* extra version information, used to show a CVS compilation
*/
#define LIBXML_VERSION_EXTRA ""
/**
* LIBXML_TEST_VERSION:
*
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(20707);
#ifndef VMS
#if 0
/**
* WITH_TRIO:
*
* defined if the trio support need to be configured in
*/
#define WITH_TRIO
#else
/**
* WITHOUT_TRIO:
*
* defined if the trio support should not be configured in
*/
#define WITHOUT_TRIO
#endif
#else /* VMS */
/**
* WITH_TRIO:
*
* defined if the trio support need to be configured in
*/
#define WITH_TRIO 1
#endif /* VMS */
/**
* LIBXML_THREAD_ENABLED:
*
* Whether the thread support is configured in
*/
#if 1
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED
#endif
#endif
/**
* LIBXML_TREE_ENABLED:
*
* Whether the DOM like tree manipulation API support is configured in
*/
#if 1
#define LIBXML_TREE_ENABLED
#endif
/**
* LIBXML_OUTPUT_ENABLED:
*
* Whether the serialization/saving support is configured in
*/
#if 1
#define LIBXML_OUTPUT_ENABLED
#endif
/**
* LIBXML_PUSH_ENABLED:
*
* Whether the push parsing interfaces are configured in
*/
#if 1
#define LIBXML_PUSH_ENABLED
#endif
/**
* LIBXML_READER_ENABLED:
*
* Whether the xmlReader parsing interface is configured in
*/
#if 1
#define LIBXML_READER_ENABLED
#endif
/**
* LIBXML_PATTERN_ENABLED:
*
* Whether the xmlPattern node selection interface is configured in
*/
#if 1
#define LIBXML_PATTERN_ENABLED
#endif
/**
* LIBXML_WRITER_ENABLED:
*
* Whether the xmlWriter saving interface is configured in
*/
#if 1
#define LIBXML_WRITER_ENABLED
#endif
/**
* LIBXML_SAX1_ENABLED:
*
* Whether the older SAX1 interface is configured in
*/
#if 1
#define LIBXML_SAX1_ENABLED
#endif
/**
* LIBXML_FTP_ENABLED:
*
* Whether the FTP support is configured in
*/
#if 0
#define LIBXML_FTP_ENABLED
#endif
/**
* LIBXML_HTTP_ENABLED:
*
* Whether the HTTP support is configured in
*/
#if 0
#define LIBXML_HTTP_ENABLED
#endif
/**
* LIBXML_VALID_ENABLED:
*
* Whether the DTD validation support is configured in
*/
#if 1
#define LIBXML_VALID_ENABLED
#endif
/**
* LIBXML_HTML_ENABLED:
*
* Whether the HTML support is configured in
*/
#if 1
#define LIBXML_HTML_ENABLED
#endif
/**
* LIBXML_LEGACY_ENABLED:
*
* Whether the deprecated APIs are compiled in for compatibility
*/
#if 1
#define LIBXML_LEGACY_ENABLED
#endif
/**
* LIBXML_C14N_ENABLED:
*
* Whether the Canonicalization support is configured in
*/
#if 1
#define LIBXML_C14N_ENABLED
#endif
/**
* LIBXML_CATALOG_ENABLED:
*
* Whether the Catalog support is configured in
*/
#if 1
#define LIBXML_CATALOG_ENABLED
#endif
/**
* LIBXML_DOCB_ENABLED:
*
* Whether the SGML Docbook support is configured in
*/
#if 1
#define LIBXML_DOCB_ENABLED
#endif
/**
* LIBXML_XPATH_ENABLED:
*
* Whether XPath is configured in
*/
#if 1
#define LIBXML_XPATH_ENABLED
#endif
/**
* LIBXML_XPTR_ENABLED:
*
* Whether XPointer is configured in
*/
#if 1
#define LIBXML_XPTR_ENABLED
#endif
/**
* LIBXML_XINCLUDE_ENABLED:
*
* Whether XInclude is configured in
*/
#if 1
#define LIBXML_XINCLUDE_ENABLED
#endif
/**
* LIBXML_ICONV_ENABLED:
*
* Whether iconv support is available
*/
#if 0
#define LIBXML_ICONV_ENABLED
#endif
/**
* LIBXML_ICU_ENABLED:
*
* Whether icu support is available
*/
#if 1
#define LIBXML_ICU_ENABLED
#endif
/**
* LIBXML_ISO8859X_ENABLED:
*
* Whether ISO-8859-* support is made available in case iconv is not
*/
#if 1
#define LIBXML_ISO8859X_ENABLED
#endif
/**
* LIBXML_DEBUG_ENABLED:
*
* Whether Debugging module is configured in
*/
#if 1
#define LIBXML_DEBUG_ENABLED
#endif
/**
* DEBUG_MEMORY_LOCATION:
*
* Whether the memory debugging is configured in
*/
#if 0
#define DEBUG_MEMORY_LOCATION
#endif
/**
* LIBXML_DEBUG_RUNTIME:
*
* Whether the runtime debugging is configured in
*/
#if 0
#define LIBXML_DEBUG_RUNTIME
#endif
/**
* LIBXML_UNICODE_ENABLED:
*
* Whether the Unicode related interfaces are compiled in
*/
#if 1
#define LIBXML_UNICODE_ENABLED
#endif
/**
* LIBXML_REGEXP_ENABLED:
*
* Whether the regular expressions interfaces are compiled in
*/
#if 1
#define LIBXML_REGEXP_ENABLED
#endif
/**
* LIBXML_AUTOMATA_ENABLED:
*
* Whether the automata interfaces are compiled in
*/
#if 1
#define LIBXML_AUTOMATA_ENABLED
#endif
/**
* LIBXML_EXPR_ENABLED:
*
* Whether the formal expressions interfaces are compiled in
*/
#if 1
#define LIBXML_EXPR_ENABLED
#endif
/**
* LIBXML_SCHEMAS_ENABLED:
*
* Whether the Schemas validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMAS_ENABLED
#endif
/**
* LIBXML_SCHEMATRON_ENABLED:
*
* Whether the Schematron validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMATRON_ENABLED
#endif
/**
* LIBXML_MODULES_ENABLED:
*
* Whether the module interfaces are compiled in
*/
#if 1
#define LIBXML_MODULES_ENABLED
/**
* LIBXML_MODULE_EXTENSION:
*
* the string suffix used by dynamic modules (usually shared libraries)
*/
#define LIBXML_MODULE_EXTENSION ".so"
#endif
/**
* LIBXML_ZLIB_ENABLED:
*
* Whether the Zlib support is compiled in
*/
#if 1
#define LIBXML_ZLIB_ENABLED
#endif
#ifdef __GNUC__
#ifdef HAVE_ANSIDECL_H
#include <ansidecl.h>
#endif
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__((unused))
#endif
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# else
# define LIBXML_ATTR_ALLOC_SIZE(x)
# endif
#else
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
# else
# define LIBXML_ATTR_FORMAT(fmt,args)
# endif
#else
# define LIBXML_ATTR_FORMAT(fmt,args)
#endif
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
#define ATTRIBUTE_UNUSED
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#define LIBXML_ATTR_ALLOC_SIZE(x)
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#define LIBXML_ATTR_FORMAT(fmt,args)
#endif /* __GNUC__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

106
third_party/libxml/linux/xml2-config vendored Executable file
View File

@ -0,0 +1,106 @@
#! /bin/sh
prefix=/usr/local
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
usage()
{
cat <<EOF
Usage: xml2-config [OPTION]
Known values for OPTION are:
--prefix=DIR change libxml prefix [default $prefix]
--exec-prefix=DIR change libxml exec prefix [default $exec_prefix]
--libs print library linking information
--cflags print pre-processor and compiler flags
--modules module support enabled
--help display this help and exit
--version output version information
EOF
exit $1
}
if test $# -eq 0; then
usage 1
fi
cflags=false
libs=false
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
--prefix=*)
prefix=$optarg
includedir=$prefix/include
libdir=$prefix/lib
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
libdir=$exec_prefix/lib
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo 2.7.7
exit 0
;;
--help)
usage 0
;;
--cflags)
echo -I${includedir}/libxml2
;;
--libtool-libs)
if [ -r ${libdir}/libxml2.la ]
then
echo ${libdir}/libxml2.la
fi
;;
--modules)
echo 1
;;
--libs)
if [ "`uname`" = "Linux" ]
then
if [ "-L${libdir}" = "-L/usr/lib" -o "-L${libdir}" = "-L/usr/lib64" ]
then
echo -lxml2 -lz -lm
else
echo -L${libdir} -lxml2 -lz -lm
fi
else
echo -L${libdir} -lxml2 -lz -lm
fi
;;
*)
usage
exit 1
;;
esac
shift
done
exit 0

312
third_party/libxml/mac/config.h vendored Normal file
View File

@ -0,0 +1,312 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
#define PACKAGE "libxml2"
#define VERSION "2.7.7"
#define HAVE_LIBZ 1
/* #undef HAVE_LIBM */
#define HAVE_ISINF /**/
#define HAVE_ISNAN /**/
/* #undef HAVE_LIBHISTORY */
/* #undef HAVE_LIBREADLINE */
#define HAVE_LIBPTHREAD /**/
#define HAVE_PTHREAD_H /**/
/* Define if IPV6 support is there */
#define SUPPORT_IP6 /**/
/* Define if getaddrinfo is there */
#define HAVE_GETADDRINFO /**/
/* Define to 1 if you have the <ansidecl.h> header file. */
/* #undef HAVE_ANSIDECL_H */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#define HAVE_ARPA_NAMESER_H 1
/* Whether struct sockaddr::__ss_family exists */
/* #undef HAVE_BROKEN_SS_FAMILY */
/* Define to 1 if you have the `class' function. */
/* #undef HAVE_CLASS */
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define to 1 if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Have dlopen based dso */
#define HAVE_DLOPEN /**/
/* Define to 1 if you have the <dl.h> header file. */
/* #undef HAVE_DL_H */
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `finite' function. */
#define HAVE_FINITE 1
/* Define to 1 if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define to 1 if you have the `fpclass' function. */
/* #undef HAVE_FPCLASS */
/* Define to 1 if you have the `fprintf' function. */
#define HAVE_FPRINTF 1
/* Define to 1 if you have the `fp_class' function. */
/* #undef HAVE_FP_CLASS */
/* Define to 1 if you have the <fp_class.h> header file. */
/* #undef HAVE_FP_CLASS_H */
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
/* Define if getaddrinfo is there */
#define HAVE_GETADDRINFO /**/
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef HAVE_IEEEFP_H */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <inttypes.h.h> header file. */
/* #undef HAVE_INTTYPES_H_H */
/* Define if isinf is there */
#define HAVE_ISINF /**/
/* Define if isnan is there */
#define HAVE_ISNAN /**/
/* Define to 1 if you have the `isnand' function. */
/* #undef HAVE_ISNAND */
/* Define if history library is there (-lhistory) */
/* #undef HAVE_LIBHISTORY */
/* Define if pthread library is there (-lpthread) */
#define HAVE_LIBPTHREAD /**/
/* Define if readline library is there (-lreadline) */
/* #undef HAVE_LIBREADLINE */
/* Have compression library */
#define HAVE_LIBZ 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the `localtime' function. */
#define HAVE_LOCALTIME 1
/* Define to 1 if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
/* Define to 1 if you have the <math.h> header file. */
#define HAVE_MATH_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <nan.h> header file. */
/* #undef HAVE_NAN_H */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define to 1 if you have the `printf' function. */
#define HAVE_PRINTF 1
/* Define if <pthread.h> is there */
#define HAVE_PTHREAD_H /**/
/* Define to 1 if you have the <resolv.h> header file. */
#define HAVE_RESOLV_H 1
/* Have shl_load based dso */
/* #undef HAVE_SHLLOAD */
/* Define to 1 if you have the `signal' function. */
#define HAVE_SIGNAL 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the `sprintf' function. */
#define HAVE_SPRINTF 1
/* Define to 1 if you have the `sscanf' function. */
#define HAVE_SSCANF 1
/* Define to 1 if you have the `stat' function. */
#define HAVE_STAT 1
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strndup' function. */
/* #undef HAVE_STRNDUP */
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Whether va_copy() is available */
#define HAVE_VA_COPY 1
/* Define to 1 if you have the `vfprintf' function. */
#define HAVE_VFPRINTF 1
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `vsprintf' function. */
#define HAVE_VSPRINTF 1
/* Define to 1 if you have the <zlib.h> header file. */
#define HAVE_ZLIB_H 1
/* Define to 1 if you have the `_stat' function. */
/* #undef HAVE__STAT */
/* Whether __va_copy() is available */
/* #undef HAVE___VA_COPY */
/* Define as const if the declaration of iconv() needs const. */
/* #undef ICONV_CONST */
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "libxml2"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to 1 if the C compiler supports function prototypes. */
#define PROTOTYPES 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Support for IPv6 */
#define SUPPORT_IP6 /**/
/* Version number of package */
#define VERSION "2.7.7"
/* Determine what socket length (socklen_t) data type is */
#define XML_SOCKLEN_T socklen_t
/* Using the Win32 Socket implementation */
/* #undef _WINSOCKAPI_ */
/* Define like PROTOTYPES; this can be used by system headers. */
#define __PROTOTYPES 1
/* Win32 Std C name mangling work-around */
/* #undef snprintf */
/* ss_family is not defined here, use __ss_family instead */
/* #undef ss_family */
/* Win32 Std C name mangling work-around */
/* #undef vsnprintf */

View File

@ -0,0 +1,467 @@
/*
* Summary: compile-time version informations
* Description: compile-time version informations for the XML library
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_VERSION_H__
#define __XML_VERSION_H__
#include <libxml/xmlexports.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* use those to be sure nothing nasty will happen if
* your library and includes mismatch
*/
#ifndef LIBXML2_COMPILING_MSCCDEF
XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif /* LIBXML2_COMPILING_MSCCDEF */
/**
* LIBXML_DOTTED_VERSION:
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.7.7"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 20707
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "20707"
/**
* LIBXML_VERSION_EXTRA:
*
* extra version information, used to show a CVS compilation
*/
#define LIBXML_VERSION_EXTRA ""
/**
* LIBXML_TEST_VERSION:
*
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(20707);
#ifndef VMS
#if 0
/**
* WITH_TRIO:
*
* defined if the trio support need to be configured in
*/
#define WITH_TRIO
#else
/**
* WITHOUT_TRIO:
*
* defined if the trio support should not be configured in
*/
#define WITHOUT_TRIO
#endif
#else /* VMS */
/**
* WITH_TRIO:
*
* defined if the trio support need to be configured in
*/
#define WITH_TRIO 1
#endif /* VMS */
/**
* LIBXML_THREAD_ENABLED:
*
* Whether the thread support is configured in
*/
#if 1
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED
#endif
#endif
/**
* LIBXML_TREE_ENABLED:
*
* Whether the DOM like tree manipulation API support is configured in
*/
#if 1
#define LIBXML_TREE_ENABLED
#endif
/**
* LIBXML_OUTPUT_ENABLED:
*
* Whether the serialization/saving support is configured in
*/
#if 1
#define LIBXML_OUTPUT_ENABLED
#endif
/**
* LIBXML_PUSH_ENABLED:
*
* Whether the push parsing interfaces are configured in
*/
#if 1
#define LIBXML_PUSH_ENABLED
#endif
/**
* LIBXML_READER_ENABLED:
*
* Whether the xmlReader parsing interface is configured in
*/
#if 1
#define LIBXML_READER_ENABLED
#endif
/**
* LIBXML_PATTERN_ENABLED:
*
* Whether the xmlPattern node selection interface is configured in
*/
#if 1
#define LIBXML_PATTERN_ENABLED
#endif
/**
* LIBXML_WRITER_ENABLED:
*
* Whether the xmlWriter saving interface is configured in
*/
#if 1
#define LIBXML_WRITER_ENABLED
#endif
/**
* LIBXML_SAX1_ENABLED:
*
* Whether the older SAX1 interface is configured in
*/
#if 1
#define LIBXML_SAX1_ENABLED
#endif
/**
* LIBXML_FTP_ENABLED:
*
* Whether the FTP support is configured in
*/
#if 0
#define LIBXML_FTP_ENABLED
#endif
/**
* LIBXML_HTTP_ENABLED:
*
* Whether the HTTP support is configured in
*/
#if 0
#define LIBXML_HTTP_ENABLED
#endif
/**
* LIBXML_VALID_ENABLED:
*
* Whether the DTD validation support is configured in
*/
#if 1
#define LIBXML_VALID_ENABLED
#endif
/**
* LIBXML_HTML_ENABLED:
*
* Whether the HTML support is configured in
*/
#if 1
#define LIBXML_HTML_ENABLED
#endif
/**
* LIBXML_LEGACY_ENABLED:
*
* Whether the deprecated APIs are compiled in for compatibility
*/
#if 1
#define LIBXML_LEGACY_ENABLED
#endif
/**
* LIBXML_C14N_ENABLED:
*
* Whether the Canonicalization support is configured in
*/
#if 1
#define LIBXML_C14N_ENABLED
#endif
/**
* LIBXML_CATALOG_ENABLED:
*
* Whether the Catalog support is configured in
*/
#if 1
#define LIBXML_CATALOG_ENABLED
#endif
/**
* LIBXML_DOCB_ENABLED:
*
* Whether the SGML Docbook support is configured in
*/
#if 1
#define LIBXML_DOCB_ENABLED
#endif
/**
* LIBXML_XPATH_ENABLED:
*
* Whether XPath is configured in
*/
#if 1
#define LIBXML_XPATH_ENABLED
#endif
/**
* LIBXML_XPTR_ENABLED:
*
* Whether XPointer is configured in
*/
#if 1
#define LIBXML_XPTR_ENABLED
#endif
/**
* LIBXML_XINCLUDE_ENABLED:
*
* Whether XInclude is configured in
*/
#if 1
#define LIBXML_XINCLUDE_ENABLED
#endif
/**
* LIBXML_ICONV_ENABLED:
*
* Whether iconv support is available
*/
#if 0
#define LIBXML_ICONV_ENABLED
#endif
/**
* LIBXML_ICU_ENABLED:
*
* Whether icu support is available
*/
#if 1
#define LIBXML_ICU_ENABLED
#endif
/**
* LIBXML_ISO8859X_ENABLED:
*
* Whether ISO-8859-* support is made available in case iconv is not
*/
#if 1
#define LIBXML_ISO8859X_ENABLED
#endif
/**
* LIBXML_DEBUG_ENABLED:
*
* Whether Debugging module is configured in
*/
#if 1
#define LIBXML_DEBUG_ENABLED
#endif
/**
* DEBUG_MEMORY_LOCATION:
*
* Whether the memory debugging is configured in
*/
#if 0
#define DEBUG_MEMORY_LOCATION
#endif
/**
* LIBXML_DEBUG_RUNTIME:
*
* Whether the runtime debugging is configured in
*/
#if 0
#define LIBXML_DEBUG_RUNTIME
#endif
/**
* LIBXML_UNICODE_ENABLED:
*
* Whether the Unicode related interfaces are compiled in
*/
#if 1
#define LIBXML_UNICODE_ENABLED
#endif
/**
* LIBXML_REGEXP_ENABLED:
*
* Whether the regular expressions interfaces are compiled in
*/
#if 1
#define LIBXML_REGEXP_ENABLED
#endif
/**
* LIBXML_AUTOMATA_ENABLED:
*
* Whether the automata interfaces are compiled in
*/
#if 1
#define LIBXML_AUTOMATA_ENABLED
#endif
/**
* LIBXML_EXPR_ENABLED:
*
* Whether the formal expressions interfaces are compiled in
*/
#if 1
#define LIBXML_EXPR_ENABLED
#endif
/**
* LIBXML_SCHEMAS_ENABLED:
*
* Whether the Schemas validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMAS_ENABLED
#endif
/**
* LIBXML_SCHEMATRON_ENABLED:
*
* Whether the Schematron validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMATRON_ENABLED
#endif
/**
* LIBXML_MODULES_ENABLED:
*
* Whether the module interfaces are compiled in
*/
#if 1
#define LIBXML_MODULES_ENABLED
/**
* LIBXML_MODULE_EXTENSION:
*
* the string suffix used by dynamic modules (usually shared libraries)
*/
#define LIBXML_MODULE_EXTENSION ".so"
#endif
/**
* LIBXML_ZLIB_ENABLED:
*
* Whether the Zlib support is compiled in
*/
#if 1
#define LIBXML_ZLIB_ENABLED
#endif
#ifdef __GNUC__
#ifdef HAVE_ANSIDECL_H
#include <ansidecl.h>
#endif
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__((unused))
#endif
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# else
# define LIBXML_ATTR_ALLOC_SIZE(x)
# endif
#else
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
# else
# define LIBXML_ATTR_FORMAT(fmt,args)
# endif
#else
# define LIBXML_ATTR_FORMAT(fmt,args)
#endif
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
#define ATTRIBUTE_UNUSED
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#define LIBXML_ATTR_ALLOC_SIZE(x)
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#define LIBXML_ATTR_FORMAT(fmt,args)
#endif /* __GNUC__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

16
third_party/libxml/patches/LoadLibraryA vendored Normal file
View File

@ -0,0 +1,16 @@
Change 'LoadLibrary' to 'LoadLibraryA' (used with 'const char*' as an
argument)
Index: libxml/xmlmodule.c
===================================================================
--- libxml.orig/xmlmodule.c 2010-07-09 14:17:46.959288280 -0700
+++ libxml/xmlmodule.c 2010-07-09 14:17:55.419051003 -0700
@@ -300,7 +300,7 @@
static void *
xmlModulePlatformOpen(const char *name)
{
- return LoadLibrary(name);
+ return LoadLibraryA(name);
}
/*

13
third_party/libxml/patches/bug_651202 vendored Normal file
View File

@ -0,0 +1,13 @@
Fix for https://bugzilla.gnome.org/show_bug.cgi?id=651202
--- libxml/xmlschemas.c.orig Thu May 26 20:21:54 2011
+++ libxml/xmlschemas.c Thu May 26 20:22:02 2011
@@ -13946,7 +13946,7 @@
*/
if ((sub->negNsSet != NULL) &&
(super->negNsSet != NULL) &&
- (sub->negNsSet->value == sub->negNsSet->value))
+ (sub->negNsSet->value == super->negNsSet->value))
return (0);
/*
* 3.1 sub must be a set whose members are either namespace names or <20>absent<6E>.

453
third_party/libxml/patches/icu vendored Normal file
View File

@ -0,0 +1,453 @@
Add code support for ICU.
diff --git a/third_party/libxml/encoding.c b/third_party/libxml/encoding.c
index b86a547..0f41df9 100644
--- a/third_party/libxml/encoding.c
+++ b/third_party/libxml/encoding.c
@@ -58,7 +58,7 @@ static xmlCharEncodingAliasPtr xmlCharEncodingAliases = NULL;
static int xmlCharEncodingAliasesNb = 0;
static int xmlCharEncodingAliasesMax = 0;
-#ifdef LIBXML_ICONV_ENABLED
+#if defined(LIBXML_ICONV_ENABLED) || defined(LIBXML_ICU_ENABLED)
#if 0
#define DEBUG_ENCODING /* Define this to get encoding traces */
#endif
@@ -97,6 +97,54 @@ xmlEncodingErr(xmlParserErrors error, const char *msg, const char *val)
NULL, 0, val, NULL, NULL, 0, 0, msg, val);
}
+#ifdef LIBXML_ICU_ENABLED
+static uconv_t*
+openIcuConverter(const char* name, int toUnicode)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ uconv_t *conv = (uconv_t *) xmlMalloc(sizeof(uconv_t));
+ if (conv == NULL)
+ return NULL;
+
+ conv->uconv = ucnv_open(name, &status);
+ if (U_FAILURE(status))
+ goto error;
+
+ status = U_ZERO_ERROR;
+ if (toUnicode) {
+ ucnv_setToUCallBack(conv->uconv, UCNV_TO_U_CALLBACK_STOP,
+ NULL, NULL, NULL, &status);
+ }
+ else {
+ ucnv_setFromUCallBack(conv->uconv, UCNV_FROM_U_CALLBACK_STOP,
+ NULL, NULL, NULL, &status);
+ }
+ if (U_FAILURE(status))
+ goto error;
+
+ status = U_ZERO_ERROR;
+ conv->utf8 = ucnv_open("UTF-8", &status);
+ if (U_SUCCESS(status))
+ return conv;
+
+error:
+ if (conv->uconv)
+ ucnv_close(conv->uconv);
+ xmlFree(conv);
+ return NULL;
+}
+
+static void
+closeIcuConverter(uconv_t *conv)
+{
+ if (conv != NULL) {
+ ucnv_close(conv->uconv);
+ ucnv_close(conv->utf8);
+ xmlFree(conv);
+ }
+}
+#endif /* LIBXML_ICU_ENABLED */
+
/************************************************************************
* *
* Conversions To/From UTF8 encoding *
@@ -1306,7 +1354,11 @@ xmlNewCharEncodingHandler(const char *name,
#ifdef LIBXML_ICONV_ENABLED
handler->iconv_in = NULL;
handler->iconv_out = NULL;
-#endif /* LIBXML_ICONV_ENABLED */
+#endif
+#ifdef LIBXML_ICU_ENABLED
+ handler->uconv_in = NULL;
+ handler->uconv_out = NULL;
+#endif
/*
* registers and returns the handler.
@@ -1371,7 +1423,7 @@ xmlInitCharEncodingHandlers(void) {
xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL);
xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL);
#endif /* LIBXML_OUTPUT_ENABLED */
-#ifndef LIBXML_ICONV_ENABLED
+#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED)
#ifdef LIBXML_ISO8859X_ENABLED
xmlRegisterCharEncodingHandlersISO8859x ();
#endif
@@ -1578,6 +1630,10 @@ xmlFindCharEncodingHandler(const char *name) {
xmlCharEncodingHandlerPtr enc;
iconv_t icv_in, icv_out;
#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ xmlCharEncodingHandlerPtr enc;
+ uconv_t *ucv_in, *ucv_out;
+#endif /* LIBXML_ICU_ENABLED */
char upper[100];
int i;
@@ -1647,6 +1703,35 @@ xmlFindCharEncodingHandler(const char *name) {
"iconv : problems with filters for '%s'\n", name);
}
#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ /* check whether icu can handle this */
+ ucv_in = openIcuConverter(name, 1);
+ ucv_out = openIcuConverter(name, 0);
+ if (ucv_in != NULL && ucv_out != NULL) {
+ enc = (xmlCharEncodingHandlerPtr)
+ xmlMalloc(sizeof(xmlCharEncodingHandler));
+ if (enc == NULL) {
+ closeIcuConverter(ucv_in);
+ closeIcuConverter(ucv_out);
+ return(NULL);
+ }
+ enc->name = xmlMemStrdup(name);
+ enc->input = NULL;
+ enc->output = NULL;
+ enc->uconv_in = ucv_in;
+ enc->uconv_out = ucv_out;
+#ifdef DEBUG_ENCODING
+ xmlGenericError(xmlGenericErrorContext,
+ "Found ICU converter handler for encoding %s\n", name);
+#endif
+ return enc;
+ } else if (ucv_in != NULL || ucv_out != NULL) {
+ closeIcuConverter(ucv_in);
+ closeIcuConverter(ucv_out);
+ xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
+ "ICU converter : problems with filters for '%s'\n", name);
+ }
+#endif /* LIBXML_ICU_ENABLED */
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
@@ -1737,6 +1822,75 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
/************************************************************************
* *
+ * ICU based generic conversion functions *
+ * *
+ ************************************************************************/
+
+#ifdef LIBXML_ICU_ENABLED
+/**
+ * xmlUconvWrapper:
+ * @cd: ICU uconverter data structure
+ * @toUnicode : non-zero if toUnicode. 0 otherwise.
+ * @out: a pointer to an array of bytes to store the result
+ * @outlen: the length of @out
+ * @in: a pointer to an array of ISO Latin 1 chars
+ * @inlen: the length of @in
+ *
+ * Returns 0 if success, or
+ * -1 by lack of space, or
+ * -2 if the transcoding fails (for *in is not valid utf8 string or
+ * the result of transformation can't fit into the encoding we want), or
+ * -3 if there the last byte can't form a single output char.
+ *
+ * The value of @inlen after return is the number of octets consumed
+ * as the return value is positive, else unpredictable.
+ * The value of @outlen after return is the number of ocetes consumed.
+ */
+static int
+xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
+ const unsigned char *in, int *inlen) {
+ const char *ucv_in = (const char *) in;
+ char *ucv_out = (char *) out;
+ UErrorCode err = U_ZERO_ERROR;
+
+ if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) {
+ if (outlen != NULL) *outlen = 0;
+ return(-1);
+ }
+
+ /*
+ * TODO(jungshik)
+ * 1. is ucnv_convert(To|From)Algorithmic better?
+ * 2. had we better use an explicit pivot buffer?
+ * 3. error returned comes from 'fromUnicode' only even
+ * when toUnicode is true !
+ */
+ if (toUnicode) {
+ /* encoding => UTF-16 => UTF-8 */
+ ucnv_convertEx(cd->utf8, cd->uconv, &ucv_out, ucv_out + *outlen,
+ &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL,
+ 0, TRUE, &err);
+ } else {
+ /* UTF-8 => UTF-16 => encoding */
+ ucnv_convertEx(cd->uconv, cd->utf8, &ucv_out, ucv_out + *outlen,
+ &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL,
+ 0, TRUE, &err);
+ }
+ *inlen = ucv_in - (const char*) in;
+ *outlen = ucv_out - (char *) out;
+ if (U_SUCCESS(err))
+ return 0;
+ if (err == U_BUFFER_OVERFLOW_ERROR)
+ return -1;
+ if (err == U_INVALID_CHAR_FOUND || err == U_ILLEGAL_CHAR_FOUND)
+ return -2;
+ /* if (err == U_TRUNCATED_CHAR_FOUND) */
+ return -3;
+}
+#endif /* LIBXML_ICU_ENABLED */
+
+/************************************************************************
+ * *
* The real API used by libxml for on-the-fly conversion *
* *
************************************************************************/
@@ -1810,6 +1964,16 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
if (ret == -1) ret = -3;
}
#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ else if (handler->uconv_in != NULL) {
+ ret = xmlUconvWrapper(handler->uconv_in, 1, &out->content[out->use],
+ &written, in->content, &toconv);
+ xmlBufferShrink(in, toconv);
+ out->use += written;
+ out->content[out->use] = 0;
+ if (ret == -1) ret = -3;
+ }
+#endif /* LIBXML_ICU_ENABLED */
#ifdef DEBUG_ENCODING
switch (ret) {
case 0:
@@ -1915,6 +2079,17 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
ret = -3;
}
#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ else if (handler->uconv_in != NULL) {
+ ret = xmlUconvWrapper(handler->uconv_in, 1, &out->content[out->use],
+ &written, in->content, &toconv);
+ xmlBufferShrink(in, toconv);
+ out->use += written;
+ out->content[out->use] = 0;
+ if (ret == -1)
+ ret = -3;
+ }
+#endif /* LIBXML_ICU_ENABLED */
switch (ret) {
case 0:
#ifdef DEBUG_ENCODING
@@ -2015,6 +2190,15 @@ retry:
out->content[out->use] = 0;
}
#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ else if (handler->uconv_out != NULL) {
+ ret = xmlUconvWrapper(handler->uconv_out, 0,
+ &out->content[out->use],
+ &written, NULL, &toconv);
+ out->use += written;
+ out->content[out->use] = 0;
+ }
+#endif /* LIBXML_ICU_ENABLED */
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"initialized encoder\n");
@@ -2061,6 +2245,26 @@ retry:
}
}
#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ else if (handler->uconv_out != NULL) {
+ ret = xmlUconvWrapper(handler->uconv_out, 0,
+ &out->content[out->use],
+ &written, in->content, &toconv);
+ xmlBufferShrink(in, toconv);
+ out->use += written;
+ writtentot += written;
+ out->content[out->use] = 0;
+ if (ret == -1) {
+ if (written > 0) {
+ /*
+ * Can be a limitation of iconv
+ */
+ goto retry;
+ }
+ ret = -3;
+ }
+ }
+#endif /* LIBXML_ICU_ENABLED */
else {
xmlEncodingErr(XML_I18N_NO_OUTPUT,
"xmlCharEncOutFunc: no output function !\n", NULL);
@@ -2173,6 +2377,22 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
xmlFree(handler);
}
#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ if ((handler->uconv_out != NULL) || (handler->uconv_in != NULL)) {
+ if (handler->name != NULL)
+ xmlFree(handler->name);
+ handler->name = NULL;
+ if (handler->uconv_out != NULL) {
+ closeIcuConverter(handler->uconv_out);
+ handler->uconv_out = NULL;
+ }
+ if (handler->uconv_in != NULL) {
+ closeIcuConverter(handler->uconv_in);
+ handler->uconv_in = NULL;
+ }
+ xmlFree(handler);
+ }
+#endif
#ifdef DEBUG_ENCODING
if (ret)
xmlGenericError(xmlGenericErrorContext,
@@ -2248,6 +2468,22 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) {
cur += toconv;
} while (ret == -2);
#endif
+#ifdef LIBXML_ICU_ENABLED
+ } else if (handler->uconv_out != NULL) {
+ do {
+ toconv = in->end - cur;
+ written = 32000;
+ ret = xmlUconvWrapper(handler->uconv_out, 0, &convbuf[0],
+ &written, cur, &toconv);
+ if (ret < 0) {
+ if (written > 0)
+ ret = -2;
+ else
+ return(-1);
+ }
+ unused += written;
+ cur += toconv;
+ } while (ret == -2);
} else {
/* could not find a converter */
return(-1);
@@ -2259,8 +2495,9 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) {
}
return(in->consumed + (in->cur - in->base));
}
+#endif
-#ifndef LIBXML_ICONV_ENABLED
+#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED)
#ifdef LIBXML_ISO8859X_ENABLED
/**
diff --git a/third_party/libxml/include/libxml/encoding.h b/third_party/libxml/include/libxml/encoding.h
index c74b25f..b5f8b48 100644
--- a/third_party/libxml/include/libxml/encoding.h
+++ b/third_party/libxml/include/libxml/encoding.h
@@ -26,6 +26,24 @@
#ifdef LIBXML_ICONV_ENABLED
#include <iconv.h>
+#else
+#ifdef LIBXML_ICU_ENABLED
+#include <unicode/ucnv.h>
+#if 0
+/* Forward-declare UConverter here rather than pulling in <unicode/ucnv.h>
+ * to prevent unwanted ICU symbols being exposed to users of libxml2.
+ * One particular case is Qt4 conflicting on UChar32.
+ */
+#include <stdint.h>
+struct UConverter;
+typedef struct UConverter UConverter;
+#ifdef _MSC_VER
+typedef wchar_t UChar;
+#else
+typedef uint16_t UChar;
+#endif
+#endif
+#endif
#endif
#ifdef __cplusplus
extern "C" {
@@ -125,6 +143,13 @@ typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
* Block defining the handlers for non UTF-8 encodings.
* If iconv is supported, there are two extra fields.
*/
+#ifdef LIBXML_ICU_ENABLED
+struct _uconv_t {
+ UConverter *uconv; /* for conversion between an encoding and UTF-16 */
+ UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
+};
+typedef struct _uconv_t uconv_t;
+#endif
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
@@ -136,6 +161,10 @@ struct _xmlCharEncodingHandler {
iconv_t iconv_in;
iconv_t iconv_out;
#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ uconv_t *uconv_in;
+ uconv_t *uconv_out;
+#endif /* LIBXML_ICU_ENABLED */
};
#ifdef __cplusplus
diff --git a/third_party/libxml/include/libxml/parser.h b/third_party/libxml/include/libxml/parser.h
index dd79c42..3580b63 100644
--- a/third_party/libxml/include/libxml/parser.h
+++ b/third_party/libxml/include/libxml/parser.h
@@ -1222,6 +1222,7 @@ typedef enum {
XML_WITH_DEBUG_MEM = 29,
XML_WITH_DEBUG_RUN = 30,
XML_WITH_ZLIB = 31,
+ XML_WITH_ICU = 32,
XML_WITH_NONE = 99999 /* just to be sure of allocation size */
} xmlFeature;
diff --git a/third_party/libxml/include/libxml/xmlversion.h.in b/third_party/libxml/include/libxml/xmlversion.h.in
index 4739f3a..de310ab 100644
--- a/third_party/libxml/include/libxml/xmlversion.h.in
+++ b/third_party/libxml/include/libxml/xmlversion.h.in
@@ -269,6 +269,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_ICU_ENABLED:
+ *
+ * Whether icu support is available
+ */
+#if @WITH_ICU@
+#define LIBXML_ICU_ENABLED
+#endif
+
+/**
* LIBXML_ISO8859X_ENABLED:
*
* Whether ISO-8859-* support is made available in case iconv is not
diff --git a/third_party/libxml/parser.c b/third_party/libxml/parser.c
index 85e7599..3ba2a06 100644
--- a/third_party/libxml/parser.c
+++ b/third_party/libxml/parser.c
@@ -954,6 +954,12 @@ xmlHasFeature(xmlFeature feature)
#else
return(0);
#endif
+ case XML_WITH_ICU:
+#ifdef LIBXML_ICU_ENABLED
+ return(1);
+#else
+ return(0);
+#endif
default:
break;
}

View File

@ -0,0 +1,28 @@
Modifications to configure.in:
- set the WITH_ICU flag unconditionally
- only output files we use
Index: libxml/configure.in
===================================================================
--- libxml.orig/configure.in 2010-07-09 15:00:21.600113911 -0700
+++ libxml/configure.in 2010-07-09 15:02:50.299108047 -0700
@@ -1229,6 +1229,9 @@
fi
AC_SUBST(WITH_OUTPUT)
+WITH_ICU=1
+AC_SUBST(WITH_ICU)
+
WITH_ICONV=0
if test "$with_iconv" = "no" ; then
echo Disabling ICONV support
@@ -1456,7 +1459,7 @@
ln -s Copyright COPYING
# keep on one line for cygwin c.f. #130896
-AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py)
+AC_OUTPUT(include/libxml/xmlversion.h xml2-config)
-chmod +x xml2-config python/setup.py
+chmod +x xml2-config
echo Done configuring

68
third_party/libxml/patches/icu-win32 vendored Normal file
View File

@ -0,0 +1,68 @@
diff --git a/third_party/libxml/win32/Makefile.msvc b/third_party/libxml/win32/Makefile.msvc
index 2409905..253c46e 100644
--- a/third_party/libxml/win32/Makefile.msvc
+++ b/third_party/libxml/win32/Makefile.msvc
@@ -71,6 +71,9 @@ LIBS = $(LIBS) wsock32.lib ws2_32.lib
!if "$(WITH_ICONV)" == "1"
LIBS = $(LIBS) iconv.lib
!endif
+!if "$(WITH_ICU)" == "1"
+LIBS = $(LIBS) icu.lib
+!endif
!if "$(WITH_ZLIB)" == "1"
LIBS = $(LIBS) zdll.lib
!endif
diff --git a/third_party/libxml/win32/configure.js b/third_party/libxml/win32/configure.js
index e71d2af..75def3f 100644
--- a/third_party/libxml/win32/configure.js
+++ b/third_party/libxml/win32/configure.js
@@ -40,6 +40,7 @@ var withXpath = true;
var withXptr = true;
var withXinclude = true;
var withIconv = true;
+var withIcu = false;
var withIso8859x = false;
var withZlib = false;
var withDebug = true;
@@ -124,6 +125,7 @@ function usage()
txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n";
txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n";
txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n";
+ txt += " icu: Enable icu support (" + (withIcu? "yes" : "no") + ")\n";
txt += " iso8859x: Enable ISO8859X support (" + (withIso8859x? "yes" : "no") + ")\n";
txt += " zlib: Enable zlib support (" + (withZlib? "yes" : "no") + ")\n";
txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n";
@@ -233,6 +235,7 @@ function discoverVersion()
vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0"));
vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0"));
vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0"));
+ vf.WriteLine("WITH_ICU=" + (withIcu? "1" : "0"));
vf.WriteLine("WITH_ISO8859X=" + (withIso8859x? "1" : "0"));
vf.WriteLine("WITH_ZLIB=" + (withZlib? "1" : "0"));
vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0"));
@@ -319,6 +322,8 @@ function configureLibxml()
of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0"));
} else if (s.search(/\@WITH_ICONV\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_ICONV\@/, withIconv? "1" : "0"));
+ } else if (s.search(/\@WITH_ICU\@/) != -1) {
+ of.WriteLine(s.replace(/\@WITH_ICU\@/, withIcu? "1" : "0"));
} else if (s.search(/\@WITH_ISO8859X\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_ISO8859X\@/, withIso8859x? "1" : "0"));
} else if (s.search(/\@WITH_ZLIB\@/) != -1) {
@@ -462,6 +467,8 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
withXinclude = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "iconv")
withIconv = strToBool(arg.substring(opt.length + 1, arg.length));
+ else if (opt == "icu")
+ withIcu = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "iso8859x")
withIso8859x = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "zlib")
@@ -646,6 +653,7 @@ txtOut += " XPath support: " + boolToStr(withXpath) + "\n";
txtOut += " XPointer support: " + boolToStr(withXptr) + "\n";
txtOut += " XInclude support: " + boolToStr(withXinclude) + "\n";
txtOut += " iconv support: " + boolToStr(withIconv) + "\n";
+txtOut += " icu support: " + boolToStr(withIcu) + "\n";
txtOut += " iso8859x support: " + boolToStr(withIso8859x) + "\n";
txtOut += " zlib support: " + boolToStr(withZlib) + "\n";
txtOut += " Debugging module: " + boolToStr(withDebug) + "\n";

View File

@ -0,0 +1,19 @@
Index: libxml/win32/configure.js
===================================================================
--- libxml.orig/win32/configure.js 2010-07-09 14:56:07.769093841 -0700
+++ libxml/win32/configure.js 2010-07-09 15:36:48.590268611 -0700
@@ -611,7 +611,13 @@
makefile = ".\\Makefile.mingw";
else if (compiler == "bcb")
makefile = ".\\Makefile.bcb";
-fso.CopyFile(makefile, ".\\Makefile", true);
+var new_makefile = ".\\Makefile";
+var f = fso.FileExists(new_makefile);
+if (f) {
+ var t = fso.GetFile(new_makefile);
+ t.Attributes = 0;
+}
+fso.CopyFile(makefile, new_makefile, true);
WScript.Echo("Created Makefile.");
// Create the config.h.
var confighsrc = "..\\include\\win32config.h";

View File

@ -0,0 +1,15 @@
Change bogus '(unsigned long)' cast to '(unsigned short)'
Index: libxml/xmlregexp.c
===================================================================
--- libxml.orig/xmlregexp.c 2010-07-09 14:16:36.990430641 -0700
+++ libxml/xmlregexp.c 2010-07-09 14:16:40.939742007 -0700
@@ -6470,7 +6470,7 @@
if (name != NULL) {
value += 30 * (*name);
while ((ch = *name++) != 0) {
- value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
+ value = value ^ ((value << 5) + (value >> 3) + (unsigned short)ch);
}
}
return (value);

5
third_party/libxml/src/AUTHORS vendored Normal file
View File

@ -0,0 +1,5 @@
Daniel Veillard <daniel@veillard.com>
Bjorn Reese <breese@users.sourceforge.net>
William Brack <wbrack@mmm.com.hk>
Igor Zlatkovic <igor@zlatkovic.com> for the Windows port
Aleksey Sanin <aleksey@aleksey.com>

19678
third_party/libxml/src/ChangeLog vendored Normal file

File diff suppressed because it is too large Load Diff

27
third_party/libxml/src/Copyright vendored Normal file
View File

@ -0,0 +1,27 @@
Except where otherwise noted in the source code (e.g. the files hash.c,
list.c and the trio files, which are covered by a similar licence but
with different Copyright notices) all the files are:
Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is fur-
nished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Daniel Veillard shall not
be used in advertising or otherwise to promote the sale, use or other deal-
ings in this Software without prior written authorization from him.

305
third_party/libxml/src/DOCBparser.c vendored Normal file
View File

@ -0,0 +1,305 @@
/*
* DOCBparser.c : an attempt to parse SGML Docbook documents
*
* This is deprecated !!!
* Code removed with release 2.6.0 it was broken.
* The doc are expect to be migrated to XML DocBook
*
* See Copyright for the status of this software.
*
* daniel@veillard.com
*/
#define IN_LIBXML
#include "libxml.h"
#ifdef LIBXML_DOCB_ENABLED
#include <libxml/xmlerror.h>
#include <libxml/DOCBparser.h>
/**
* docbEncodeEntities:
* @out: a pointer to an array of bytes to store the result
* @outlen: the length of @out
* @in: a pointer to an array of UTF-8 chars
* @inlen: the length of @in
* @quoteChar: the quote character to escape (' or ") or zero.
*
* Take a block of UTF-8 chars in and try to convert it to an ASCII
* plus SGML entities block of chars out.
*
* Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
* The value of @inlen after return is the number of octets consumed
* as the return value is positive, else unpredictable.
* The value of @outlen after return is the number of octets consumed.
*/
int
docbEncodeEntities(unsigned char *out ATTRIBUTE_UNUSED,
int *outlen ATTRIBUTE_UNUSED,
const unsigned char *in ATTRIBUTE_UNUSED,
int *inlen ATTRIBUTE_UNUSED,
int quoteChar ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbEncodeEntities() deprecated function reached\n");
deprecated = 1;
}
return(-1);
}
/**
* docbParseDocument:
* @ctxt: an SGML parser context
*
* parse an SGML document (and build a tree if using the standard SAX
* interface).
*
* Returns 0, -1 in case of error. the parser context is augmented
* as a result of the parsing.
*/
int
docbParseDocument(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbParseDocument() deprecated function reached\n");
deprecated = 1;
}
return (xmlParseDocument(ctxt));
}
/**
* docbFreeParserCtxt:
* @ctxt: an SGML parser context
*
* Free all the memory used by a parser context. However the parsed
* document in ctxt->myDoc is not freed.
*/
void
docbFreeParserCtxt(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbFreeParserCtxt() deprecated function reached\n");
deprecated = 1;
}
xmlFreeParserCtxt(ctxt);
}
/**
* docbParseChunk:
* @ctxt: an XML parser context
* @chunk: an char array
* @size: the size in byte of the chunk
* @terminate: last chunk indicator
*
* Parse a Chunk of memory
*
* Returns zero if no error, the xmlParserErrors otherwise.
*/
int
docbParseChunk(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
const char *chunk ATTRIBUTE_UNUSED,
int size ATTRIBUTE_UNUSED,
int terminate ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbParseChunk() deprecated function reached\n");
deprecated = 1;
}
return (xmlParseChunk(ctxt, chunk, size, terminate));
}
/**
* docbCreatePushParserCtxt:
* @sax: a SAX handler
* @user_data: The user data returned on SAX callbacks
* @chunk: a pointer to an array of chars
* @size: number of chars in the array
* @filename: an optional file name or URI
* @enc: an optional encoding
*
* Create a parser context for using the DocBook SGML parser in push mode
* To allow content encoding detection, @size should be >= 4
* The value of @filename is used for fetching external entities
* and error/warning reports.
*
* Returns the new parser context or NULL
*/
docbParserCtxtPtr
docbCreatePushParserCtxt(docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
void *user_data ATTRIBUTE_UNUSED,
const char *chunk ATTRIBUTE_UNUSED,
int size ATTRIBUTE_UNUSED,
const char *filename ATTRIBUTE_UNUSED,
xmlCharEncoding enc ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbParseChunk() deprecated function reached\n");
deprecated = 1;
}
return(xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename));
}
/**
* docbSAXParseDoc:
* @cur: a pointer to an array of xmlChar
* @encoding: a free form C string describing the SGML document encoding, or NULL
* @sax: the SAX handler block
* @userData: if using SAX, this pointer will be provided on callbacks.
*
* parse an SGML in-memory document and build a tree.
* It use the given SAX function block to handle the parsing callback.
* If sax is NULL, fallback to the default DOM tree building routines.
*
* Returns the resulting document tree
*/
docbDocPtr
docbSAXParseDoc(xmlChar * cur ATTRIBUTE_UNUSED,
const char *encoding ATTRIBUTE_UNUSED,
docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
void *userData ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbParseChunk() deprecated function reached\n");
deprecated = 1;
}
return (xmlSAXParseMemoryWithData(sax, (const char *)cur,
xmlStrlen((const xmlChar *) cur), 0, userData));
}
/**
* docbParseDoc:
* @cur: a pointer to an array of xmlChar
* @encoding: a free form C string describing the SGML document encoding, or NULL
*
* parse an SGML in-memory document and build a tree.
*
* Returns the resulting document tree
*/
docbDocPtr
docbParseDoc(xmlChar * cur ATTRIBUTE_UNUSED,
const char *encoding ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbParseChunk() deprecated function reached\n");
deprecated = 1;
}
return (xmlParseDoc(cur));
}
/**
* docbCreateFileParserCtxt:
* @filename: the filename
* @encoding: the SGML document encoding, or NULL
*
* Create a parser context for a file content.
* Automatic support for ZLIB/Compress compressed document is provided
* by default if found at compile-time.
*
* Returns the new parser context or NULL
*/
docbParserCtxtPtr
docbCreateFileParserCtxt(const char *filename ATTRIBUTE_UNUSED,
const char *encoding ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbCreateFileParserCtxt() deprecated function reached\n");
deprecated = 1;
}
return (xmlCreateFileParserCtxt(filename));
}
/**
* docbSAXParseFile:
* @filename: the filename
* @encoding: a free form C string describing the SGML document encoding, or NULL
* @sax: the SAX handler block
* @userData: if using SAX, this pointer will be provided on callbacks.
*
* parse an SGML file and build a tree. Automatic support for ZLIB/Compress
* compressed document is provided by default if found at compile-time.
* It use the given SAX function block to handle the parsing callback.
* If sax is NULL, fallback to the default DOM tree building routines.
*
* Returns the resulting document tree
*/
docbDocPtr
docbSAXParseFile(const char *filename ATTRIBUTE_UNUSED,
const char *encoding ATTRIBUTE_UNUSED,
docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
void *userData ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbSAXParseFile() deprecated function reached\n");
deprecated = 1;
}
return (xmlSAXParseFileWithData(sax, filename, 0, userData));
}
/**
* docbParseFile:
* @filename: the filename
* @encoding: a free form C string describing document encoding, or NULL
*
* parse a Docbook SGML file and build a tree. Automatic support for
* ZLIB/Compress compressed document is provided by default if found
* at compile-time.
*
* Returns the resulting document tree
*/
docbDocPtr
docbParseFile(const char *filename ATTRIBUTE_UNUSED,
const char *encoding ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"docbParseFile() deprecated function reached\n");
deprecated = 1;
}
return (xmlParseFile(filename));
}
#define bottom_DOCBparser
#include "elfgcchack.h"
#endif /* LIBXML_DOCB_ENABLED */

6939
third_party/libxml/src/HTMLparser.c vendored Normal file

File diff suppressed because it is too large Load Diff

1231
third_party/libxml/src/HTMLtree.c vendored Normal file

File diff suppressed because it is too large Load Diff

365
third_party/libxml/src/INSTALL vendored Normal file
View File

@ -0,0 +1,365 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

2006
third_party/libxml/src/NEWS vendored Normal file

File diff suppressed because it is too large Load Diff

39
third_party/libxml/src/README vendored Normal file
View File

@ -0,0 +1,39 @@
XML toolkit from the GNOME project
Full documentation is available on-line at
http://xmlsoft.org/
This code is released under the MIT Licence see the Copyright file.
To build on an Unixised setup:
./configure ; make ; make install
To build on Windows:
see instructions on win32/Readme.txt
To assert build quality:
on an Unixised setup:
run make tests
otherwise:
There is 3 standalone tools runtest.c runsuite.c testapi.c, which
should compile as part of the build or as any application would.
Launch them from this directory to get results, runtest checks
the proper functionning of libxml2 main APIs while testapi does
a full coverage check. Report failures to the list.
To report bugs, follow the instructions at:
http://xmlsoft.org/bugs.html
A mailing-list xml@gnome.org is available, to subscribe:
http://mail.gnome.org/mailman/listinfo/xml
The list archive is at:
http://mail.gnome.org/archives/xml/
All technical answers asked privately will be automatically answered on
the list and archived for public access unless pricacy is explicitely
required and justified.
Daniel Veillard
$Id$

30
third_party/libxml/src/README.tests vendored Normal file
View File

@ -0,0 +1,30 @@
README.tests
Instructions for standalone test regressions of libxml2
libxml2-tests-$version.tar.gz contains 3 standalone C programs as well
as a large amount of tests and results coming from libxml2 itself and
from W3C, NIST, Sun Microsystems, Microsoft and James Clark. Each C
program has a different testing purpose:
runtest.c : runs libxml2 basic internal regression tests
runsuite.c: runs libxml2 against external regression tests
testapi.c : exercises the library public entry points
testchar.c: exercise the check of character ranges and UTF-8 validation
The command:
make -f Makefile.tests check
should be sufficient on an Unix system to build and exercise the tests
for the version of the library installed on the system. Note however
that there isn't backward compatibility provided so if the installed
version is older to the testsuite one, failing to compile or run the tests
is likely. In any event this won't work with an installed libxml2 older
than 2.6.20.
Building on other platfroms should be a matter of compiling the C files
like any other program using libxml2, running the test should be done
simply by launching the resulting executables.
Daniel Veillard
Thu Jul 24 2008

180
third_party/libxml/src/SAX.c vendored Normal file
View File

@ -0,0 +1,180 @@
/*
* SAX.c : Old SAX v1 handlers to build a tree.
* Deprecated except for compatibility
*
* See Copyright for the status of this software.
*
* Daniel Veillard <daniel@veillard.com>
*/
#define IN_LIBXML
#include "libxml.h"
#include <stdlib.h>
#include <string.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 <libxml/xmlerror.h>
#include <libxml/debugXML.h>
#include <libxml/xmlIO.h>
#include <libxml/SAX.h>
#include <libxml/uri.h>
#include <libxml/valid.h>
#include <libxml/HTMLtree.h>
#include <libxml/globals.h>
#include <libxml/SAX2.h>
#ifdef LIBXML_LEGACY_ENABLED
#ifdef LIBXML_SAX1_ENABLED
/**
* initxmlDefaultSAXHandler:
* @hdlr: the SAX handler
* @warning: flag if non-zero sets the handler warning procedure
*
* Initialize the default XML SAX version 1 handler
* DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks
*/
void
initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)
{
if(hdlr->initialized == 1)
return;
hdlr->internalSubset = xmlSAX2InternalSubset;
hdlr->externalSubset = xmlSAX2ExternalSubset;
hdlr->isStandalone = xmlSAX2IsStandalone;
hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
hdlr->resolveEntity = xmlSAX2ResolveEntity;
hdlr->getEntity = xmlSAX2GetEntity;
hdlr->getParameterEntity = xmlSAX2GetParameterEntity;
hdlr->entityDecl = xmlSAX2EntityDecl;
hdlr->attributeDecl = xmlSAX2AttributeDecl;
hdlr->elementDecl = xmlSAX2ElementDecl;
hdlr->notationDecl = xmlSAX2NotationDecl;
hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl;
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
hdlr->startDocument = xmlSAX2StartDocument;
hdlr->endDocument = xmlSAX2EndDocument;
hdlr->startElement = xmlSAX2StartElement;
hdlr->endElement = xmlSAX2EndElement;
hdlr->reference = xmlSAX2Reference;
hdlr->characters = xmlSAX2Characters;
hdlr->cdataBlock = xmlSAX2CDataBlock;
hdlr->ignorableWhitespace = xmlSAX2Characters;
hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
if (warning == 0)
hdlr->warning = NULL;
else
hdlr->warning = xmlParserWarning;
hdlr->error = xmlParserError;
hdlr->fatalError = xmlParserError;
hdlr->initialized = 1;
}
#ifdef LIBXML_HTML_ENABLED
/**
* inithtmlDefaultSAXHandler:
* @hdlr: the SAX handler
*
* Initialize the default HTML SAX version 1 handler
* DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks
*/
void
inithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
{
if(hdlr->initialized == 1)
return;
hdlr->internalSubset = xmlSAX2InternalSubset;
hdlr->externalSubset = NULL;
hdlr->isStandalone = NULL;
hdlr->hasInternalSubset = NULL;
hdlr->hasExternalSubset = NULL;
hdlr->resolveEntity = NULL;
hdlr->getEntity = xmlSAX2GetEntity;
hdlr->getParameterEntity = NULL;
hdlr->entityDecl = NULL;
hdlr->attributeDecl = NULL;
hdlr->elementDecl = NULL;
hdlr->notationDecl = NULL;
hdlr->unparsedEntityDecl = NULL;
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
hdlr->startDocument = xmlSAX2StartDocument;
hdlr->endDocument = xmlSAX2EndDocument;
hdlr->startElement = xmlSAX2StartElement;
hdlr->endElement = xmlSAX2EndElement;
hdlr->reference = NULL;
hdlr->characters = xmlSAX2Characters;
hdlr->cdataBlock = xmlSAX2CDataBlock;
hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
hdlr->comment = xmlSAX2Comment;
hdlr->warning = xmlParserWarning;
hdlr->error = xmlParserError;
hdlr->fatalError = xmlParserError;
hdlr->initialized = 1;
}
#endif /* LIBXML_HTML_ENABLED */
#ifdef LIBXML_DOCB_ENABLED
/**
* initdocbDefaultSAXHandler:
* @hdlr: the SAX handler
*
* Initialize the default DocBook SAX version 1 handler
* DEPRECATED: use xmlSAX2InitDocbDefaultSAXHandler() for the new SAX2 blocks
*/
void
initdocbDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
{
if(hdlr->initialized == 1)
return;
hdlr->internalSubset = xmlSAX2InternalSubset;
hdlr->externalSubset = NULL;
hdlr->isStandalone = xmlSAX2IsStandalone;
hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
hdlr->resolveEntity = xmlSAX2ResolveEntity;
hdlr->getEntity = xmlSAX2GetEntity;
hdlr->getParameterEntity = NULL;
hdlr->entityDecl = xmlSAX2EntityDecl;
hdlr->attributeDecl = NULL;
hdlr->elementDecl = NULL;
hdlr->notationDecl = NULL;
hdlr->unparsedEntityDecl = NULL;
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
hdlr->startDocument = xmlSAX2StartDocument;
hdlr->endDocument = xmlSAX2EndDocument;
hdlr->startElement = xmlSAX2StartElement;
hdlr->endElement = xmlSAX2EndElement;
hdlr->reference = xmlSAX2Reference;
hdlr->characters = xmlSAX2Characters;
hdlr->cdataBlock = NULL;
hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
hdlr->processingInstruction = NULL;
hdlr->comment = xmlSAX2Comment;
hdlr->warning = xmlParserWarning;
hdlr->error = xmlParserError;
hdlr->fatalError = xmlParserError;
hdlr->initialized = 1;
}
#endif /* LIBXML_DOCB_ENABLED */
#endif /* LIBXML_SAX1_ENABLED */
#define bottom_SAX
#include "elfgcchack.h"
#endif /* LIBXML_LEGACY_ENABLED */

2945
third_party/libxml/src/SAX2.c vendored Normal file

File diff suppressed because it is too large Load Diff

278
third_party/libxml/src/TODO vendored Normal file
View File

@ -0,0 +1,278 @@
124907 HTML parse buffer problem when parsing larse in-memory docs
124110 DTD validation && wrong namespace
123564 xmllint --html --format
TODO for the XML parser and stuff:
==================================
$Id$
this tend to be outdated :-\ ...
DOCS:
=====
- use case of using XInclude to load for example a description.
order document + product base -(XSLT)-> quote with XIncludes
|
HTML output with description of parts <---(XSLT)--
TODO:
=====
- XInclude at the SAX level (libSRVG)
- fix the C code prototype to bring back doc/libxml-undocumented.txt
to a reasonable level
- Computation of base when HTTP redirect occurs, might affect HTTP
interfaces.
- Computation of base in XInclude. Relativization of URIs.
- listing all attributes in a node.
- Better checking of external parsed entities TAG 1234
- Go through erratas and do the cleanup.
http://www.w3.org/XML/xml-19980210-errata ... started ...
- jamesh suggestion: SAX like functions to save a document ie. call a
function to open a new element with given attributes, write character
data, close last element, etc
+ inversted SAX, initial patch in April 2002 archives.
- htmlParseDoc has parameter encoding which is not used.
Function htmlCreateDocParserCtxt ignore it.
- fix realloc() usage.
- Stricten the UTF8 conformance (Martin Duerst):
http://www.w3.org/2001/06/utf-8-test/.
The bad files are in http://www.w3.org/2001/06/utf-8-wrong/.
- xml:id normalized value
TODO:
=====
- move all string manipulation functions (xmlStrdup, xmlStrlen, etc.) to
global.c. Bjorn noted that the following files depends on parser.o solely
because of these string functions: entities.o, global.o, hash.o, tree.o,
xmlIO.o, and xpath.o.
- Optimization of tag strings allocation ?
- maintain coherency of namespace when doing cut'n paste operations
=> the functions are coded, but need testing
- function to rebuild the ID table
- functions to rebuild the DTD hash tables (after DTD changes).
EXTENSIONS:
===========
- Tools to produce man pages from the SGML docs.
- Add Xpointer recognition/API
- Add Xlink recognition/API
=> started adding an xlink.[ch] with a unified API for XML and HTML.
it's crap :-(
- Implement XSchemas
=> Really need to be done <grin/>
- datatype are complete, but structure support is very limited.
- extend the shell with:
- edit
- load/save
- mv (yum, yum, but it's harder because directories are ordered in
our case, mvup and mvdown would be required)
Done:
=====
- Add HTML validation using the XHTML DTD
- problem: do we want to keep and maintain the code for handling
DTD/System ID cache directly in libxml ?
=> not really done that way, but there are new APIs to check elements
or attributes. Otherwise XHTML validation directly ...
- XML Schemas datatypes except Base64 and BinHex
- Relax NG validation
- XmlTextReader streaming API + validation
- 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
Maybe this is better left to user apps
=> use a catalog instead , and xhtml1-dtd package
- Add output to XHTML
=> XML serializer automatically recognize the DTd and apply the specific
rules.
- Fix output of <tst val="x&#xA;y"/>
- compliance to XML-Namespace checking, see section 6 of
http://www.w3.org/TR/REC-xml-names/
- Correct standalone checking/emitting (hard)
2.9 Standalone Document Declaration
- Implement OASIS XML Catalog support
http://www.oasis-open.org/committees/entity/
- Get OASIS testsuite to a more friendly result, check all the results
once stable. the check-xml-test-suite.py script does this
- Implement XSLT
=> libxslt
- Finish XPath
=> attributes addressing troubles
=> defaulted attributes handling
=> namespace axis ?
done as XSLT got debugged
- bug reported by Michael Meallin on validation problems
=> Actually means I need to add support (and warn) for non-deterministic
content model.
- Handle undefined namespaces in entity contents better ... at least
issue a warning
- DOM needs
int xmlPruneProp(xmlNodePtr node, xmlAtttrPtr attr);
=> done it's actually xmlRemoveProp xmlUnsetProp xmlUnsetNsProp
- HTML: handling of Script and style data elements, need special code in
the parser and saving functions (handling of < > " ' ...):
http://www.w3.org/TR/html4/types.html#type-script
Attributes are no problems since entities are accepted.
- DOM needs
xmlAttrPtr xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value)
- problem when parsing hrefs with & with the HTML parser (IRC ac)
- If the internal encoding is not UTF8 saving to a given encoding doesn't
work => fix to force UTF8 encoding ...
done, added documentation too
- Add an ASCII I/O encoder (asciiToUTF8 and UTF8Toascii)
- Issue warning when using non-absolute namespaces URI.
- the html parser should add <head> and <body> if they don't exist
started, not finished.
Done, the automatic closing is added and 3 testcases were inserted
- Command to force the parser to stop parsing and ignore the rest of the file.
xmlStopParser() should allow this, mostly untested
- support for HTML empty attributes like <hr noshade>
- plugged iconv() in for support of a large set of encodings.
- xmlSwitchToEncoding() rewrite done
- URI checkings (no fragments) rfc2396.txt
- Added a clean mechanism for overload or added input methods:
xmlRegisterInputCallbacks()
- 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,
order is preserved as well as comments and PIs
- Wrote a notice of changes requires to go from 1.x to 2.x
- make sure that all SAX callbacks are disabled if a WF error is detected
- checking/handling of newline normalization
http://localhost/www.xml.com/axml/target.html#sec-line-ends
- correct checking of '&' '%' on entities content.
- checking of PE/Nesting on entities declaration
- checking/handling of xml:space
- checking done.
- handling done, not well tested
- Language identification code, productions [33] to [38]
=> done, the check has been added and report WFness errors
- Conditional sections in DTDs [61] to [65]
=> should this crap be really implemented ???
=> Yep OASIS testsuite uses them
- Allow parsed entities defined in the internal subset to override
the ones defined in the external subset (DtD customization).
=> This mean that the entity content should be computed only at
use time, i.e. keep the orig string only at parse time and expand
only when referenced from the external subset :-(
Needed for complete use of most DTD from Eve Maler
- Add regression tests for all WFC errors
=> did some in test/WFC
=> added OASIS testsuite routines
http://xmlsoft.org/conf/result.html
- I18N: http://wap.trondheim.com/vaer/index.phtml is not XML and accepted
by the XML parser, UTF-8 should be checked when there is no "encoding"
declared !
- Support for UTF-8 and UTF-16 encoding
=> added some convertion routines provided by Martin Durst
patched them, got fixes from @@@
I plan to keep everything internally as UTF-8 (or ISO-Latin-X)
this is slightly more costly but more compact, and recent processors
efficiency is cache related. The key for good performances is keeping
the data set small, so will I.
=> the new progressive reading routines call the detection code
is enabled, tested the ISO->UTF-8 stuff
- External entities loading:
- allow override by client code
- make sure it is alled for all external entities referenced
Done, client code should use xmlSetExternalEntityLoader() to set
the default loading routine. It will be called each time an external
entity entity resolution is triggered.
- maintain ID coherency when removing/changing attributes
The function used to deallocate attributes now check for it being an
ID and removes it from the table.
- push mode parsing i.e. non-blocking state based parser
done, both for XML and HTML parsers. Use xmlCreatePushParserCtxt()
and xmlParseChunk() and html counterparts.
The tester program now has a --push option to select that parser
front-end. Douplicated tests to use both and check results are similar.
- Most of XPath, still see some troubles and occasionnal memleaks.
- an XML shell, allowing to traverse/manipulate an XML document with
a shell like interface, and using XPath for the anming syntax
- use of readline and history added when available
- the shell interface has been cleanly separated and moved to debugXML.c
- HTML parser, should be fairly stable now
- API to search the lang of an attribute
- Collect IDs at parsing and maintain a table.
PBM: maintain the table coherency
PBM: how to detect ID types in absence of DtD !
- Use it for XPath ID support
- Add validity checking
Should be finished now !
- Add regression tests with entity substitutions
- External Parsed entities, either XML or external Subset [78] and [79]
parsing the xmllang DtD now works, so it should be sufficient for
most cases !
- progressive reading. The entity support is a first step toward
asbtraction of an input stream. A large part of the context is still
located on the stack, moving to a state machine and putting everyting
in the parsing context should provide an adequate solution.
=> Rather than progressive parsing, give more power to the SAX-like
interface. Currently the DOM-like representation is built but
=> it should be possible to define that only as a set of SAX callbacks
and remove the tree creation from the parser code.
DONE
- DOM support, instead of using a proprietary in memory
format for the document representation, the parser should
call a DOM API to actually build the resulting document.
Then the parser becomes independent of the in-memory
representation of the document. Even better using RPC's
the parser can actually build the document in another
program.
=> Work started, now the internal representation is by default
very near a direct DOM implementation. The DOM glue is implemented
as a separate module. See the GNOME gdome module.
- C++ support : John Ehresman <jehresma@dsg.harvard.edu>
- Updated code to follow more recent specs, added compatibility flag
- Better error handling, use a dedicated, overridable error
handling function.
- Support for CDATA.
- Keep track of line numbers for better error reporting.
- Support for PI (SAX one).
- Support for Comments (bad, should be in ASAP, they are parsed
but not stored), should be configurable.
- Improve the support of entities on save (+SAX).

31
third_party/libxml/src/TODO_SCHEMAS vendored Normal file
View File

@ -0,0 +1,31 @@
- implement counted transitions at the automata level
- Unicode:
+ upgrade to 3.2
+ improve the python script to generate better test
expressions to check the list of ranges.
- Implement the interface at the SAX level
- Implement the missing parts in the Structure part
+ all content model
+ enumerations
+ countless others c.f. the TODO scattered in the code
- Complete the Built-In datatype collections and Facets implementations
- Regression tests based on
+ the primer:
http://www.w3.org/TR/xmlschema-0/
+ the Schemas Test Collection:
http://www.w3.org/2001/05/xmlschema-test-collection/
+ archives of the schemas-dev list
- Integrity constraints:
+ what's that ? How need to read about it
- "formal" checking, i.e. go through the full Structure spec and
bind code and associated parts of the Schemas spec
- go though the erratas
http://www.w3.org/2001/05/xmlschema-errata

16
third_party/libxml/src/acconfig.h vendored Normal file
View File

@ -0,0 +1,16 @@
#undef PACKAGE
#undef VERSION
#undef HAVE_LIBZ
#undef HAVE_LIBM
#undef HAVE_ISINF
#undef HAVE_ISNAN
#undef HAVE_LIBHISTORY
#undef HAVE_LIBREADLINE
#undef HAVE_LIBPTHREAD
#undef HAVE_PTHREAD_H
/* Define if IPV6 support is there */
#undef SUPPORT_IP6
/* Define if getaddrinfo is there */
#undef HAVE_GETADDRINFO

28
third_party/libxml/src/acinclude.m4 vendored Normal file
View File

@ -0,0 +1,28 @@
dnl Like AC_TRY_EVAL but also errors out if the compiler generates
dnl _any_ output. Some compilers might issue warnings which we want
dnl to catch.
AC_DEFUN([AC_TRY_EVAL2],
[{ (eval echo configure:__oline__: \"[$]$1\") 1>&AC_FD_CC; dnl
(eval [$]$1) 2>&AC_FD_CC; _out=`eval [$]$1 2>&1` && test "x$_out" = x; }])
dnl Like AC_TRY_COMPILE but calls AC_TRY_EVAL2 instead of AC_TRY_EVAL
AC_DEFUN([AC_TRY_COMPILE2],
[cat > conftest.$ac_ext <<EOF
[#]line __oline__ "configure"
#include "confdefs.h"
[$1]
int main(void) {
[$2]
; return 0; }
EOF
if AC_TRY_EVAL2(ac_compile); then
ifelse([$3], , :, [rm -rf conftest*
$3])
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$4], , , [ rm -rf conftest*
$4
])dnl
fi
rm -f conftest*])

8956
third_party/libxml/src/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

2235
third_party/libxml/src/c14n.c vendored Normal file

File diff suppressed because it is too large Load Diff

3824
third_party/libxml/src/catalog.c vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,394 @@
#!/usr/bin/python
import sys
import time
import os
import string
import StringIO
sys.path.insert(0, "python")
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
debug = 0
verbose = 0
quiet = 1
#
# the testsuite description
#
CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/OASIS/spectest.xml")
LOG="check-relaxng-test-suite.log"
RES="relaxng-test-results.xml"
log = open(LOG, "w")
nb_schemas_tests = 0
nb_schemas_success = 0
nb_schemas_failed = 0
nb_instances_tests = 0
nb_instances_success = 0
nb_instances_failed = 0
libxml2.lineNumbersDefault(1)
#
# Error and warnng callbacks
#
def callback(ctx, str):
global log
log.write("%s%s" % (ctx, str))
libxml2.registerErrorHandler(callback, "")
#
# Resolver callback
#
resources = {}
def resolver(URL, ID, ctxt):
global resources
if string.find(URL, '#') != -1:
URL = URL[0:string.find(URL, '#')]
if resources.has_key(URL):
return(StringIO.StringIO(resources[URL]))
log.write("Resolver failure: asked %s\n" % (URL))
log.write("resources: %s\n" % (resources))
return None
#
# Load the previous results
#
#results = {}
#previous = {}
#
#try:
# res = libxml2.parseFile(RES)
#except:
# log.write("Could not parse %s" % (RES))
#
# handle a valid instance
#
def handle_valid(node, schema):
global log
global nb_instances_success
global nb_instances_failed
instance = ""
child = node.children
while child != None:
if child.type != 'text':
instance = instance + child.serialize()
child = child.next
try:
doc = libxml2.parseDoc(instance)
except:
doc = None
if doc == None:
log.write("\nFailed to parse correct instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
return
try:
ctxt = schema.relaxNGNewValidCtxt()
ret = doc.relaxNGValidateDoc(ctxt)
except:
ret = -1
if ret != 0:
log.write("\nFailed to validate correct instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
else:
nb_instances_success = nb_instances_success + 1
doc.freeDoc()
#
# handle an invalid instance
#
def handle_invalid(node, schema):
global log
global nb_instances_success
global nb_instances_failed
instance = ""
child = node.children
while child != None:
if child.type != 'text':
instance = instance + child.serialize()
child = child.next
try:
doc = libxml2.parseDoc(instance)
except:
doc = None
if doc == None:
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
return
try:
ctxt = schema.relaxNGNewValidCtxt()
ret = doc.relaxNGValidateDoc(ctxt)
except:
ret = -1
if ret == 0:
log.write("\nFailed to detect validation problem in instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
else:
nb_instances_success = nb_instances_success + 1
doc.freeDoc()
#
# handle an incorrect test
#
def handle_correct(node):
global log
global nb_schemas_success
global nb_schemas_failed
schema = ""
child = node.children
while child != None:
if child.type != 'text':
schema = schema + child.serialize()
child = child.next
try:
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs == None:
log.write("\nFailed to compile correct schema:\n-----\n")
log.write(schema)
log.write("\n-----\n")
nb_schemas_failed = nb_schemas_failed + 1
else:
nb_schemas_success = nb_schemas_success + 1
return rngs
def handle_incorrect(node):
global log
global nb_schemas_success
global nb_schemas_failed
schema = ""
child = node.children
while child != None:
if child.type != 'text':
schema = schema + child.serialize()
child = child.next
try:
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs != None:
log.write("\nFailed to detect schema error in:\n-----\n")
log.write(schema)
log.write("\n-----\n")
nb_schemas_failed = nb_schemas_failed + 1
else:
# log.write("\nSuccess detecting schema error in:\n-----\n")
# log.write(schema)
# log.write("\n-----\n")
nb_schemas_success = nb_schemas_success + 1
return None
#
# resource handling: keep a dictionary of URL->string mappings
#
def handle_resource(node, dir):
global resources
try:
name = node.prop('name')
except:
name = None
if name == None or name == '':
log.write("resource has no name")
return;
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
res = ""
child = node.children
while child != None:
if child.type != 'text':
res = res + child.serialize()
child = child.next
resources[name] = res
#
# dir handling: pseudo directory resources
#
def handle_dir(node, dir):
try:
name = node.prop('name')
except:
name = None
if name == None or name == '':
log.write("resource has no name")
return;
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
dirs = node.xpathEval('dir')
for dir in dirs:
handle_dir(dir, name)
res = node.xpathEval('resource')
for r in res:
handle_resource(r, name)
#
# handle a testCase element
#
def handle_testCase(node):
global nb_schemas_tests
global nb_instances_tests
global resources
sections = node.xpathEval('string(section)')
log.write("\n ======== test %d line %d section %s ==========\n" % (
nb_schemas_tests, node.lineNo(), sections))
resources = {}
if debug:
print "test %d line %d" % (nb_schemas_tests, node.lineNo())
dirs = node.xpathEval('dir')
for dir in dirs:
handle_dir(dir, None)
res = node.xpathEval('resource')
for r in res:
handle_resource(r, None)
tsts = node.xpathEval('incorrect')
if tsts != []:
if len(tsts) != 1:
print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
schema = handle_incorrect(tsts[0])
else:
tsts = node.xpathEval('correct')
if tsts != []:
if len(tsts) != 1:
print "warning test line %d has more than one <correct> example"% (node.lineNo())
schema = handle_correct(tsts[0])
else:
print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
nb_schemas_tests = nb_schemas_tests + 1;
valids = node.xpathEval('valid')
invalids = node.xpathEval('invalid')
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
if schema != None:
for valid in valids:
handle_valid(valid, schema)
for invalid in invalids:
handle_invalid(invalid, schema)
#
# handle a testSuite element
#
def handle_testSuite(node, level = 0):
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
global nb_instances_tests, nb_instances_success, nb_instances_failed
global quiet
if level >= 1:
old_schemas_tests = nb_schemas_tests
old_schemas_success = nb_schemas_success
old_schemas_failed = nb_schemas_failed
old_instances_tests = nb_instances_tests
old_instances_success = nb_instances_success
old_instances_failed = nb_instances_failed
docs = node.xpathEval('documentation')
authors = node.xpathEval('author')
if docs != []:
msg = ""
for doc in docs:
msg = msg + doc.content + " "
if authors != []:
msg = msg + "written by "
for author in authors:
msg = msg + author.content + " "
if quiet == 0:
print msg
sections = node.xpathEval('section')
if sections != [] and level <= 0:
msg = ""
for section in sections:
msg = msg + section.content + " "
if quiet == 0:
print "Tests for section %s" % (msg)
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
handle_testSuite(test, level + 1)
if verbose and level >= 1 and sections != []:
msg = ""
for section in sections:
msg = msg + section.content + " "
print "Result of tests for section %s" % (msg)
if nb_schemas_tests != old_schemas_tests:
print "found %d test schemas: %d success %d failures" % (
nb_schemas_tests - old_schemas_tests,
nb_schemas_success - old_schemas_success,
nb_schemas_failed - old_schemas_failed)
if nb_instances_tests != old_instances_tests:
print "found %d test instances: %d success %d failures" % (
nb_instances_tests - old_instances_tests,
nb_instances_success - old_instances_success,
nb_instances_failed - old_instances_failed)
#
# Parse the conf file
#
libxml2.substituteEntitiesDefault(1);
testsuite = libxml2.parseFile(CONF)
libxml2.setEntityLoader(resolver)
root = testsuite.getRootElement()
if root.name != 'testSuite':
print "%s doesn't start with a testSuite element, aborting" % (CONF)
sys.exit(1)
if quiet == 0:
print "Running Relax NG testsuite"
handle_testSuite(root)
if quiet == 0:
print "\nTOTAL:\n"
if quiet == 0 or nb_schemas_failed != 0:
print "found %d test schemas: %d success %d failures" % (
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
if quiet == 0 or nb_instances_failed != 0:
print "found %d test instances: %d success %d failures" % (
nb_instances_tests, nb_instances_success, nb_instances_failed)
testsuite.freeDoc()
# Memory debug specific
libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
if quiet == 0:
print "OK"
else:
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
libxml2.dumpMemory()

View File

@ -0,0 +1,418 @@
#!/usr/bin/python
import sys
import time
import os
import string
import StringIO
sys.path.insert(0, "python")
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
debug = 0
quiet = 1
#
# the testsuite description
#
CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/testsuite.xml")
LOG="check-relaxng-test-suite2.log"
log = open(LOG, "w")
nb_schemas_tests = 0
nb_schemas_success = 0
nb_schemas_failed = 0
nb_instances_tests = 0
nb_instances_success = 0
nb_instances_failed = 0
libxml2.lineNumbersDefault(1)
#
# Resolver callback
#
resources = {}
def resolver(URL, ID, ctxt):
global resources
if resources.has_key(URL):
return(StringIO.StringIO(resources[URL]))
log.write("Resolver failure: asked %s\n" % (URL))
log.write("resources: %s\n" % (resources))
return None
#
# Load the previous results
#
#results = {}
#previous = {}
#
#try:
# res = libxml2.parseFile(RES)
#except:
# log.write("Could not parse %s" % (RES))
#
# handle a valid instance
#
def handle_valid(node, schema):
global log
global nb_instances_success
global nb_instances_failed
instance = node.prop("dtd")
if instance == None:
instance = ""
child = node.children
while child != None:
if child.type != 'text':
instance = instance + child.serialize()
child = child.next
# mem = libxml2.debugMemory(1);
try:
doc = libxml2.parseDoc(instance)
except:
doc = None
if doc == None:
log.write("\nFailed to parse correct instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
return
if debug:
print "instance line %d" % (node.lineNo())
try:
ctxt = schema.relaxNGNewValidCtxt()
ret = doc.relaxNGValidateDoc(ctxt)
del ctxt
except:
ret = -1
doc.freeDoc()
# if mem != libxml2.debugMemory(1):
# print "validating instance %d line %d leaks" % (
# nb_instances_tests, node.lineNo())
if ret != 0:
log.write("\nFailed to validate correct instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
else:
nb_instances_success = nb_instances_success + 1
#
# handle an invalid instance
#
def handle_invalid(node, schema):
global log
global nb_instances_success
global nb_instances_failed
instance = node.prop("dtd")
if instance == None:
instance = ""
child = node.children
while child != None:
if child.type != 'text':
instance = instance + child.serialize()
child = child.next
# mem = libxml2.debugMemory(1);
try:
doc = libxml2.parseDoc(instance)
except:
doc = None
if doc == None:
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
return
if debug:
print "instance line %d" % (node.lineNo())
try:
ctxt = schema.relaxNGNewValidCtxt()
ret = doc.relaxNGValidateDoc(ctxt)
del ctxt
except:
ret = -1
doc.freeDoc()
# mem2 = libxml2.debugMemory(1)
# if mem != mem2:
# print "validating instance %d line %d leaks %d bytes" % (
# nb_instances_tests, node.lineNo(), mem2 - mem)
if ret == 0:
log.write("\nFailed to detect validation problem in instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
else:
nb_instances_success = nb_instances_success + 1
#
# handle an incorrect test
#
def handle_correct(node):
global log
global nb_schemas_success
global nb_schemas_failed
schema = ""
child = node.children
while child != None:
if child.type != 'text':
schema = schema + child.serialize()
child = child.next
try:
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs == None:
log.write("\nFailed to compile correct schema:\n-----\n")
log.write(schema)
log.write("\n-----\n")
nb_schemas_failed = nb_schemas_failed + 1
else:
nb_schemas_success = nb_schemas_success + 1
return rngs
def handle_incorrect(node):
global log
global nb_schemas_success
global nb_schemas_failed
schema = ""
child = node.children
while child != None:
if child.type != 'text':
schema = schema + child.serialize()
child = child.next
try:
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs != None:
log.write("\nFailed to detect schema error in:\n-----\n")
log.write(schema)
log.write("\n-----\n")
nb_schemas_failed = nb_schemas_failed + 1
else:
# log.write("\nSuccess detecting schema error in:\n-----\n")
# log.write(schema)
# log.write("\n-----\n")
nb_schemas_success = nb_schemas_success + 1
return None
#
# resource handling: keep a dictionary of URL->string mappings
#
def handle_resource(node, dir):
global resources
try:
name = node.prop('name')
except:
name = None
if name == None or name == '':
log.write("resource has no name")
return;
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
res = ""
child = node.children
while child != None:
if child.type != 'text':
res = res + child.serialize()
child = child.next
resources[name] = res
#
# dir handling: pseudo directory resources
#
def handle_dir(node, dir):
try:
name = node.prop('name')
except:
name = None
if name == None or name == '':
log.write("resource has no name")
return;
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
dirs = node.xpathEval('dir')
for dir in dirs:
handle_dir(dir, name)
res = node.xpathEval('resource')
for r in res:
handle_resource(r, name)
#
# handle a testCase element
#
def handle_testCase(node):
global nb_schemas_tests
global nb_instances_tests
global resources
sections = node.xpathEval('string(section)')
log.write("\n ======== test %d line %d section %s ==========\n" % (
nb_schemas_tests, node.lineNo(), sections))
resources = {}
if debug:
print "test %d line %d" % (nb_schemas_tests, node.lineNo())
dirs = node.xpathEval('dir')
for dir in dirs:
handle_dir(dir, None)
res = node.xpathEval('resource')
for r in res:
handle_resource(r, None)
tsts = node.xpathEval('incorrect')
if tsts != []:
if len(tsts) != 1:
print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
schema = handle_incorrect(tsts[0])
else:
tsts = node.xpathEval('correct')
if tsts != []:
if len(tsts) != 1:
print "warning test line %d has more than one <correct> example"% (node.lineNo())
schema = handle_correct(tsts[0])
else:
print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
nb_schemas_tests = nb_schemas_tests + 1;
valids = node.xpathEval('valid')
invalids = node.xpathEval('invalid')
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
if schema != None:
for valid in valids:
handle_valid(valid, schema)
for invalid in invalids:
handle_invalid(invalid, schema)
#
# handle a testSuite element
#
def handle_testSuite(node, level = 0):
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
global nb_instances_tests, nb_instances_success, nb_instances_failed
if level >= 1:
old_schemas_tests = nb_schemas_tests
old_schemas_success = nb_schemas_success
old_schemas_failed = nb_schemas_failed
old_instances_tests = nb_instances_tests
old_instances_success = nb_instances_success
old_instances_failed = nb_instances_failed
docs = node.xpathEval('documentation')
authors = node.xpathEval('author')
if docs != []:
msg = ""
for doc in docs:
msg = msg + doc.content + " "
if authors != []:
msg = msg + "written by "
for author in authors:
msg = msg + author.content + " "
if quiet == 0:
print msg
sections = node.xpathEval('section')
if sections != [] and level <= 0:
msg = ""
for section in sections:
msg = msg + section.content + " "
if quiet == 0:
print "Tests for section %s" % (msg)
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
handle_testSuite(test, level + 1)
if level >= 1 and sections != []:
msg = ""
for section in sections:
msg = msg + section.content + " "
print "Result of tests for section %s" % (msg)
if nb_schemas_tests != old_schemas_tests:
print "found %d test schemas: %d success %d failures" % (
nb_schemas_tests - old_schemas_tests,
nb_schemas_success - old_schemas_success,
nb_schemas_failed - old_schemas_failed)
if nb_instances_tests != old_instances_tests:
print "found %d test instances: %d success %d failures" % (
nb_instances_tests - old_instances_tests,
nb_instances_success - old_instances_success,
nb_instances_failed - old_instances_failed)
#
# Parse the conf file
#
libxml2.substituteEntitiesDefault(1);
testsuite = libxml2.parseFile(CONF)
#
# Error and warnng callbacks
#
def callback(ctx, str):
global log
log.write("%s%s" % (ctx, str))
libxml2.registerErrorHandler(callback, "")
libxml2.setEntityLoader(resolver)
root = testsuite.getRootElement()
if root.name != 'testSuite':
print "%s doesn't start with a testSuite element, aborting" % (CONF)
sys.exit(1)
if quiet == 0:
print "Running Relax NG testsuite"
handle_testSuite(root)
if quiet == 0:
print "\nTOTAL:\n"
if quiet == 0 or nb_schemas_failed != 0:
print "found %d test schemas: %d success %d failures" % (
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
if quiet == 0 or nb_instances_failed != 0:
print "found %d test instances: %d success %d failures" % (
nb_instances_tests, nb_instances_success, nb_instances_failed)
testsuite.freeDoc()
# Memory debug specific
libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
if quiet == 0:
print "OK"
else:
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
libxml2.dumpMemory()

View File

@ -0,0 +1,221 @@
#!/usr/bin/python
import sys
import time
import os
import string
sys.path.insert(0, "python")
import libxml2
#
# the testsuite description
#
DIR="xinclude-test-suite"
CONF="testdescr.xml"
LOG="check-xinclude-test-suite.log"
log = open(LOG, "w")
os.chdir(DIR)
test_nr = 0
test_succeed = 0
test_failed = 0
test_error = 0
#
# Error and warning handlers
#
error_nr = 0
error_msg = ''
def errorHandler(ctx, str):
global error_nr
global error_msg
if string.find(str, "error:") >= 0:
error_nr = error_nr + 1
if len(error_msg) < 300:
if len(error_msg) == 0 or error_msg[-1] == '\n':
error_msg = error_msg + " >>" + str
else:
error_msg = error_msg + str
libxml2.registerErrorHandler(errorHandler, None)
def testXInclude(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
print "testXInclude(%s, %s)" % (filename, id)
return 1
def runTest(test, basedir):
global test_nr
global test_failed
global test_error
global test_succeed
global error_msg
global log
fatal_error = 0
uri = test.prop('href')
id = test.prop('id')
type = test.prop('type')
if uri == None:
print "Test without ID:", uri
return -1
if id == None:
print "Test without URI:", id
return -1
if type == None:
print "Test without URI:", id
return -1
if basedir != None:
URI = basedir + "/" + uri
else:
URI = uri
if os.access(URI, os.R_OK) == 0:
print "Test %s missing: base %s uri %s" % (URI, basedir, uri)
return -1
expected = None
outputfile = None
diff = None
if type != 'error':
output = test.xpathEval('string(output)')
if output == 'No output file.':
output = None
if output == '':
output = None
if output != None:
if basedir != None:
output = basedir + "/" + output
if os.access(output, os.R_OK) == 0:
print "Result for %s missing: %s" % (id, output)
output = None
else:
try:
f = open(output)
expected = f.read()
outputfile = output
except:
print "Result for %s unreadable: %s" % (id, output)
try:
# print "testing %s" % (URI)
doc = libxml2.parseFile(URI)
except:
doc = None
if doc != None:
res = doc.xincludeProcess()
if res >= 0 and expected != None:
result = doc.serialize()
if result != expected:
print "Result for %s differs" % (id)
open("xinclude.res", "w").write(result)
diff = os.popen("diff %s xinclude.res" % outputfile).read()
doc.freeDoc()
else:
print "Failed to parse %s" % (URI)
res = -1
test_nr = test_nr + 1
if type == 'success':
if res > 0:
test_succeed = test_succeed + 1
elif res == 0:
test_failed = test_failed + 1
print "Test %s: no substitution done ???" % (id)
elif res < 0:
test_error = test_error + 1
print "Test %s: failed valid XInclude processing" % (id)
elif type == 'error':
if res > 0:
test_error = test_error + 1
print "Test %s: failed to detect invalid XInclude processing" % (id)
elif res == 0:
test_failed = test_failed + 1
print "Test %s: Invalid but no substitution done" % (id)
elif res < 0:
test_succeed = test_succeed + 1
elif type == 'optional':
if res > 0:
test_succeed = test_succeed + 1
else:
print "Test %s: failed optional test" % (id)
# Log the ontext
if res != 1:
log.write("Test ID %s\n" % (id))
log.write(" File: %s\n" % (URI))
content = string.strip(test.content)
while content[-1] == '\n':
content = content[0:-1]
log.write(" %s:%s\n\n" % (type, content))
if error_msg != '':
log.write(" ----\n%s ----\n" % (error_msg))
error_msg = ''
log.write("\n")
if diff != None:
log.write("diff from test %s:\n" %(id))
log.write(" -----------\n%s\n -----------\n" % (diff));
return 0
def runTestCases(case):
creator = case.prop('creator')
if creator != None:
print "=>", creator
base = case.getBase(None)
basedir = case.prop('basedir')
if basedir != None:
base = libxml2.buildURI(basedir, base)
test = case.children
while test != None:
if test.name == 'testcase':
runTest(test, base)
if test.name == 'testcases':
runTestCases(test)
test = test.next
conf = libxml2.parseFile(CONF)
if conf == None:
print "Unable to load %s" % CONF
sys.exit(1)
testsuite = conf.getRootElement()
if testsuite.name != 'testsuite':
print "Expecting TESTSUITE root element: aborting"
sys.exit(1)
profile = testsuite.prop('PROFILE')
if profile != None:
print profile
start = time.time()
case = testsuite.children
while case != None:
if case.name == 'testcases':
old_test_nr = test_nr
old_test_succeed = test_succeed
old_test_failed = test_failed
old_test_error = test_error
runTestCases(case)
print " Ran %d tests: %d suceeded, %d failed and %d generated an error" % (
test_nr - old_test_nr, test_succeed - old_test_succeed,
test_failed - old_test_failed, test_error - old_test_error)
case = case.next
conf.freeDoc()
log.close()
print "Ran %d tests: %d suceeded, %d failed and %d generated an error in %.2f s." % (
test_nr, test_succeed, test_failed, test_error, time.time() - start)

409
third_party/libxml/src/check-xml-test-suite.py vendored Executable file
View File

@ -0,0 +1,409 @@
#!/usr/bin/python
import sys
import time
import os
import string
sys.path.insert(0, "python")
import libxml2
test_nr = 0
test_succeed = 0
test_failed = 0
test_error = 0
#
# the testsuite description
#
CONF="xml-test-suite/xmlconf/xmlconf.xml"
LOG="check-xml-test-suite.log"
log = open(LOG, "w")
#
# Error and warning handlers
#
error_nr = 0
error_msg = ''
def errorHandler(ctx, str):
global error_nr
global error_msg
error_nr = error_nr + 1
if len(error_msg) < 300:
if len(error_msg) == 0 or error_msg[-1] == '\n':
error_msg = error_msg + " >>" + str
else:
error_msg = error_msg + str
libxml2.registerErrorHandler(errorHandler, None)
#warning_nr = 0
#warning = ''
#def warningHandler(ctx, str):
# global warning_nr
# global warning
#
# warning_nr = warning_nr + 1
# warning = warning + str
#
#libxml2.registerWarningHandler(warningHandler, None)
#
# Used to load the XML testsuite description
#
def loadNoentDoc(filename):
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
return None
ctxt.replaceEntities(1)
ctxt.parseDocument()
try:
doc = ctxt.doc()
except:
doc = None
if ctxt.wellFormed() != 1:
doc.freeDoc()
return None
return doc
#
# The conformance testing routines
#
def testNotWf(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
return -1
ret = ctxt.parseDocument()
try:
doc = ctxt.doc()
except:
doc = None
if doc != None:
doc.freeDoc()
if ret == 0 or ctxt.wellFormed() != 0:
print "%s: error: Well Formedness error not detected" % (id)
log.write("%s: error: Well Formedness error not detected\n" % (id))
return 0
return 1
def testNotWfEnt(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
return -1
ctxt.replaceEntities(1)
ret = ctxt.parseDocument()
try:
doc = ctxt.doc()
except:
doc = None
if doc != None:
doc.freeDoc()
if ret == 0 or ctxt.wellFormed() != 0:
print "%s: error: Well Formedness error not detected" % (id)
log.write("%s: error: Well Formedness error not detected\n" % (id))
return 0
return 1
def testNotWfEntDtd(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
return -1
ctxt.replaceEntities(1)
ctxt.loadSubset(1)
ret = ctxt.parseDocument()
try:
doc = ctxt.doc()
except:
doc = None
if doc != None:
doc.freeDoc()
if ret == 0 or ctxt.wellFormed() != 0:
print "%s: error: Well Formedness error not detected" % (id)
log.write("%s: error: Well Formedness error not detected\n" % (id))
return 0
return 1
def testWfEntDtd(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
return -1
ctxt.replaceEntities(1)
ctxt.loadSubset(1)
ret = ctxt.parseDocument()
try:
doc = ctxt.doc()
except:
doc = None
if doc == None or ret != 0 or ctxt.wellFormed() == 0:
print "%s: error: wrongly failed to parse the document" % (id)
log.write("%s: error: wrongly failed to parse the document\n" % (id))
if doc != None:
doc.freeDoc()
return 0
if error_nr != 0:
print "%s: warning: WF document generated an error msg" % (id)
log.write("%s: error: WF document generated an error msg\n" % (id))
doc.freeDoc()
return 2
doc.freeDoc()
return 1
def testError(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
return -1
ctxt.replaceEntities(1)
ctxt.loadSubset(1)
ret = ctxt.parseDocument()
try:
doc = ctxt.doc()
except:
doc = None
if doc != None:
doc.freeDoc()
if ctxt.wellFormed() == 0:
print "%s: warning: failed to parse the document but accepted" % (id)
log.write("%s: warning: failed to parse the document but accepte\n" % (id))
return 2
if error_nr != 0:
print "%s: warning: WF document generated an error msg" % (id)
log.write("%s: error: WF document generated an error msg\n" % (id))
return 2
return 1
def testInvalid(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
return -1
ctxt.validate(1)
ret = ctxt.parseDocument()
try:
doc = ctxt.doc()
except:
doc = None
valid = ctxt.isValid()
if doc == None:
print "%s: error: wrongly failed to parse the document" % (id)
log.write("%s: error: wrongly failed to parse the document\n" % (id))
return 0
if valid == 1:
print "%s: error: Validity error not detected" % (id)
log.write("%s: error: Validity error not detected\n" % (id))
doc.freeDoc()
return 0
if error_nr == 0:
print "%s: warning: Validity error not reported" % (id)
log.write("%s: warning: Validity error not reported\n" % (id))
doc.freeDoc()
return 2
doc.freeDoc()
return 1
def testValid(filename, id):
global error_nr
global error_msg
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
return -1
ctxt.validate(1)
ctxt.parseDocument()
try:
doc = ctxt.doc()
except:
doc = None
valid = ctxt.isValid()
if doc == None:
print "%s: error: wrongly failed to parse the document" % (id)
log.write("%s: error: wrongly failed to parse the document\n" % (id))
return 0
if valid != 1:
print "%s: error: Validity check failed" % (id)
log.write("%s: error: Validity check failed\n" % (id))
doc.freeDoc()
return 0
if error_nr != 0 or valid != 1:
print "%s: warning: valid document reported an error" % (id)
log.write("%s: warning: valid document reported an error\n" % (id))
doc.freeDoc()
return 2
doc.freeDoc()
return 1
def runTest(test):
global test_nr
global test_succeed
global test_failed
global error_msg
global log
uri = test.prop('URI')
id = test.prop('ID')
if uri == None:
print "Test without ID:", uri
return -1
if id == None:
print "Test without URI:", id
return -1
base = test.getBase(None)
URI = libxml2.buildURI(uri, base)
if os.access(URI, os.R_OK) == 0:
print "Test %s missing: base %s uri %s" % (URI, base, uri)
return -1
type = test.prop('TYPE')
if type == None:
print "Test %s missing TYPE" % (id)
return -1
extra = None
if type == "invalid":
res = testInvalid(URI, id)
elif type == "valid":
res = testValid(URI, id)
elif type == "not-wf":
extra = test.prop('ENTITIES')
# print URI
#if extra == None:
# res = testNotWfEntDtd(URI, id)
#elif extra == 'none':
# res = testNotWf(URI, id)
#elif extra == 'general':
# res = testNotWfEnt(URI, id)
#elif extra == 'both' or extra == 'parameter':
res = testNotWfEntDtd(URI, id)
#else:
# print "Unknow value %s for an ENTITIES test value" % (extra)
# return -1
elif type == "error":
res = testError(URI, id)
else:
# TODO skipped for now
return -1
test_nr = test_nr + 1
if res > 0:
test_succeed = test_succeed + 1
elif res == 0:
test_failed = test_failed + 1
elif res < 0:
test_error = test_error + 1
# Log the ontext
if res != 1:
log.write(" File: %s\n" % (URI))
content = string.strip(test.content)
while content[-1] == '\n':
content = content[0:-1]
if extra != None:
log.write(" %s:%s:%s\n" % (type, extra, content))
else:
log.write(" %s:%s\n\n" % (type, content))
if error_msg != '':
log.write(" ----\n%s ----\n" % (error_msg))
error_msg = ''
log.write("\n")
return 0
def runTestCases(case):
profile = case.prop('PROFILE')
if profile != None and \
string.find(profile, "IBM XML Conformance Test Suite - Production") < 0:
print "=>", profile
test = case.children
while test != None:
if test.name == 'TEST':
runTest(test)
if test.name == 'TESTCASES':
runTestCases(test)
test = test.next
conf = loadNoentDoc(CONF)
if conf == None:
print "Unable to load %s" % CONF
sys.exit(1)
testsuite = conf.getRootElement()
if testsuite.name != 'TESTSUITE':
print "Expecting TESTSUITE root element: aborting"
sys.exit(1)
profile = testsuite.prop('PROFILE')
if profile != None:
print profile
start = time.time()
case = testsuite.children
while case != None:
if case.name == 'TESTCASES':
old_test_nr = test_nr
old_test_succeed = test_succeed
old_test_failed = test_failed
old_test_error = test_error
runTestCases(case)
print " Ran %d tests: %d suceeded, %d failed and %d generated an error" % (
test_nr - old_test_nr, test_succeed - old_test_succeed,
test_failed - old_test_failed, test_error - old_test_error)
case = case.next
conf.freeDoc()
log.close()
print "Ran %d tests: %d suceeded, %d failed and %d generated an error in %.2f s." % (
test_nr, test_succeed, test_failed, test_error, time.time() - start)

View File

@ -0,0 +1,420 @@
#!/usr/bin/python
import sys
import time
import os
import string
import StringIO
sys.path.insert(0, "python")
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
debug = 0
verbose = 0
quiet = 1
#
# the testsuite description
#
CONF=os.path.join(os.path.dirname(__file__), "test/xsdtest/xsdtestsuite.xml")
LOG="check-xsddata-test-suite.log"
log = open(LOG, "w")
nb_schemas_tests = 0
nb_schemas_success = 0
nb_schemas_failed = 0
nb_instances_tests = 0
nb_instances_success = 0
nb_instances_failed = 0
libxml2.lineNumbersDefault(1)
#
# Error and warnng callbacks
#
def callback(ctx, str):
global log
log.write("%s%s" % (ctx, str))
libxml2.registerErrorHandler(callback, "")
#
# Resolver callback
#
resources = {}
def resolver(URL, ID, ctxt):
global resources
if resources.has_key(URL):
return(StringIO.StringIO(resources[URL]))
log.write("Resolver failure: asked %s\n" % (URL))
log.write("resources: %s\n" % (resources))
return None
#
# handle a valid instance
#
def handle_valid(node, schema):
global log
global nb_instances_success
global nb_instances_failed
instance = node.prop("dtd")
if instance == None:
instance = ""
child = node.children
while child != None:
if child.type != 'text':
instance = instance + child.serialize()
child = child.next
mem = libxml2.debugMemory(1);
try:
doc = libxml2.parseDoc(instance)
except:
doc = None
if doc == None:
log.write("\nFailed to parse correct instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
return
if debug:
print "instance line %d" % (node.lineNo())
try:
ctxt = schema.relaxNGNewValidCtxt()
ret = doc.relaxNGValidateDoc(ctxt)
del ctxt
except:
ret = -1
doc.freeDoc()
if mem != libxml2.debugMemory(1):
print "validating instance %d line %d leaks" % (
nb_instances_tests, node.lineNo())
if ret != 0:
log.write("\nFailed to validate correct instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
else:
nb_instances_success = nb_instances_success + 1
#
# handle an invalid instance
#
def handle_invalid(node, schema):
global log
global nb_instances_success
global nb_instances_failed
instance = node.prop("dtd")
if instance == None:
instance = ""
child = node.children
while child != None:
if child.type != 'text':
instance = instance + child.serialize()
child = child.next
# mem = libxml2.debugMemory(1);
try:
doc = libxml2.parseDoc(instance)
except:
doc = None
if doc == None:
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
return
if debug:
print "instance line %d" % (node.lineNo())
try:
ctxt = schema.relaxNGNewValidCtxt()
ret = doc.relaxNGValidateDoc(ctxt)
del ctxt
except:
ret = -1
doc.freeDoc()
# if mem != libxml2.debugMemory(1):
# print "validating instance %d line %d leaks" % (
# nb_instances_tests, node.lineNo())
if ret == 0:
log.write("\nFailed to detect validation problem in instance:\n-----\n")
log.write(instance)
log.write("\n-----\n")
nb_instances_failed = nb_instances_failed + 1
else:
nb_instances_success = nb_instances_success + 1
#
# handle an incorrect test
#
def handle_correct(node):
global log
global nb_schemas_success
global nb_schemas_failed
schema = ""
child = node.children
while child != None:
if child.type != 'text':
schema = schema + child.serialize()
child = child.next
try:
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs == None:
log.write("\nFailed to compile correct schema:\n-----\n")
log.write(schema)
log.write("\n-----\n")
nb_schemas_failed = nb_schemas_failed + 1
else:
nb_schemas_success = nb_schemas_success + 1
return rngs
def handle_incorrect(node):
global log
global nb_schemas_success
global nb_schemas_failed
schema = ""
child = node.children
while child != None:
if child.type != 'text':
schema = schema + child.serialize()
child = child.next
try:
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs != None:
log.write("\nFailed to detect schema error in:\n-----\n")
log.write(schema)
log.write("\n-----\n")
nb_schemas_failed = nb_schemas_failed + 1
else:
# log.write("\nSuccess detecting schema error in:\n-----\n")
# log.write(schema)
# log.write("\n-----\n")
nb_schemas_success = nb_schemas_success + 1
return None
#
# resource handling: keep a dictionary of URL->string mappings
#
def handle_resource(node, dir):
global resources
try:
name = node.prop('name')
except:
name = None
if name == None or name == '':
log.write("resource has no name")
return;
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
res = ""
child = node.children
while child != None:
if child.type != 'text':
res = res + child.serialize()
child = child.next
resources[name] = res
#
# dir handling: pseudo directory resources
#
def handle_dir(node, dir):
try:
name = node.prop('name')
except:
name = None
if name == None or name == '':
log.write("resource has no name")
return;
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
dirs = node.xpathEval('dir')
for dir in dirs:
handle_dir(dir, name)
res = node.xpathEval('resource')
for r in res:
handle_resource(r, name)
#
# handle a testCase element
#
def handle_testCase(node):
global nb_schemas_tests
global nb_instances_tests
global resources
sections = node.xpathEval('string(section)')
log.write("\n ======== test %d line %d section %s ==========\n" % (
nb_schemas_tests, node.lineNo(), sections))
resources = {}
if debug:
print "test %d line %d" % (nb_schemas_tests, node.lineNo())
dirs = node.xpathEval('dir')
for dir in dirs:
handle_dir(dir, None)
res = node.xpathEval('resource')
for r in res:
handle_resource(r, None)
tsts = node.xpathEval('incorrect')
if tsts != []:
if len(tsts) != 1:
print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
schema = handle_incorrect(tsts[0])
else:
tsts = node.xpathEval('correct')
if tsts != []:
if len(tsts) != 1:
print "warning test line %d has more than one <correct> example"% (node.lineNo())
schema = handle_correct(tsts[0])
else:
print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
nb_schemas_tests = nb_schemas_tests + 1;
valids = node.xpathEval('valid')
invalids = node.xpathEval('invalid')
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
if schema != None:
for valid in valids:
handle_valid(valid, schema)
for invalid in invalids:
handle_invalid(invalid, schema)
#
# handle a testSuite element
#
def handle_testSuite(node, level = 0):
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
global nb_instances_tests, nb_instances_success, nb_instances_failed
if verbose and level >= 0:
old_schemas_tests = nb_schemas_tests
old_schemas_success = nb_schemas_success
old_schemas_failed = nb_schemas_failed
old_instances_tests = nb_instances_tests
old_instances_success = nb_instances_success
old_instances_failed = nb_instances_failed
docs = node.xpathEval('documentation')
authors = node.xpathEval('author')
if docs != []:
msg = ""
for doc in docs:
msg = msg + doc.content + " "
if authors != []:
msg = msg + "written by "
for author in authors:
msg = msg + author.content + " "
if quiet == 0:
print msg
sections = node.xpathEval('section')
if verbose and sections != [] and level <= 0:
msg = ""
for section in sections:
msg = msg + section.content + " "
if quiet == 0:
print "Tests for section %s" % (msg)
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
handle_testSuite(test, level + 1)
if verbose and level >= 0 :
if sections != []:
msg = ""
for section in sections:
msg = msg + section.content + " "
print "Result of tests for section %s" % (msg)
elif docs != []:
msg = ""
for doc in docs:
msg = msg + doc.content + " "
print "Result of tests for %s" % (msg)
if nb_schemas_tests != old_schemas_tests:
print "found %d test schemas: %d success %d failures" % (
nb_schemas_tests - old_schemas_tests,
nb_schemas_success - old_schemas_success,
nb_schemas_failed - old_schemas_failed)
if nb_instances_tests != old_instances_tests:
print "found %d test instances: %d success %d failures" % (
nb_instances_tests - old_instances_tests,
nb_instances_success - old_instances_success,
nb_instances_failed - old_instances_failed)
#
# Parse the conf file
#
libxml2.substituteEntitiesDefault(1);
testsuite = libxml2.parseFile(CONF)
#
# Error and warnng callbacks
#
def callback(ctx, str):
global log
log.write("%s%s" % (ctx, str))
libxml2.registerErrorHandler(callback, "")
libxml2.setEntityLoader(resolver)
root = testsuite.getRootElement()
if root.name != 'testSuite':
print "%s doesn't start with a testSuite element, aborting" % (CONF)
sys.exit(1)
if quiet == 0:
print "Running Relax NG testsuite"
handle_testSuite(root)
if quiet == 0 or nb_schemas_failed != 0:
print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
if quiet == 0 or nb_instances_failed != 0:
print "found %d test instances: %d success %d failures" % (
nb_instances_tests, nb_instances_success, nb_instances_failed)
testsuite.freeDoc()
# Memory debug specific
libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
if quiet == 0:
print "OK"
else:
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
libxml2.dumpMemory()

336
third_party/libxml/src/chvalid.c vendored Normal file
View File

@ -0,0 +1,336 @@
/*
* chvalid.c: this module implements the character range
* validation APIs
*
* This file is automatically generated from the cvs source
* definition files using the genChRanges.py Python script
*
* Generation date: Mon Mar 27 11:09:48 2006
* Sources: chvalid.def
* William Brack <wbrack@mmm.com.hk>
*/
#define IN_LIBXML
#include "libxml.h"
#include <libxml/chvalid.h>
/*
* The initial tables ({func_name}_tab) are used to validate whether a
* single-byte character is within the specified group. Each table
* contains 256 bytes, with each byte representing one of the 256
* possible characters. If the table byte is set, the character is
* allowed.
*
*/
const unsigned char xmlIsPubidChar_tab[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131},
{0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3},
{0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8},
{0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c},
{0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da},
{0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3},
{0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481},
{0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb},
{0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559},
{0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a},
{0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce},
{0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939},
{0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990},
{0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9},
{0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a},
{0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33},
{0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e},
{0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91},
{0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9},
{0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10},
{0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39},
{0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a},
{0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c},
{0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5},
{0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
{0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c},
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
{0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
{0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e},
{0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82},
{0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d},
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5},
{0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0},
{0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47},
{0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100},
{0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c},
{0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140},
{0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155},
{0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165},
{0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173},
{0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab},
{0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2},
{0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b},
{0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
{0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b},
{0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc},
{0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3},
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
{0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182},
{0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
const xmlChRangeGroup xmlIsBaseCharGroup =
{197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0};
static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff},
{0xe000, 0xfffd}};
static const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}};
const xmlChRangeGroup xmlIsCharGroup =
{2, 1, xmlIsChar_srng, xmlIsChar_lrng};
static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
{0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
{0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4},
{0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df},
{0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903},
{0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954},
{0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be},
{0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd},
{0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c},
{0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48},
{0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc},
{0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03},
{0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d},
{0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
{0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44},
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83},
{0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6},
{0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d},
{0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e},
{0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd},
{0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39},
{0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b},
{0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
{0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
{0x3099, 0x3099}, {0x309a, 0x309a}};
const xmlChRangeGroup xmlIsCombiningGroup =
{95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0};
static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669},
{0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f},
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
{0xf20, 0xf29}};
const xmlChRangeGroup xmlIsDigitGroup =
{14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0};
static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0},
{0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46},
{0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e},
{0x30fc, 0x30fe}};
const xmlChRangeGroup xmlIsExtenderGroup =
{10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0};
static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007},
{0x3021, 0x3029}, {0x4e00, 0x9fa5}};
const xmlChRangeGroup xmlIsIdeographicGroup =
{3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0};
/**
* xmlCharInRange:
* @val: character to be validated
* @rptr: pointer to range to be used to validate
*
* Does a binary search of the range table to determine if char
* is valid
*
* Returns: true if character valid, false otherwise
*/
int
xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
int low, high, mid;
const xmlChSRange *sptr;
const xmlChLRange *lptr;
if (rptr == NULL) return(0);
if (val < 0x10000) { /* is val in 'short' or 'long' array? */
if (rptr->nbShortRange == 0)
return 0;
low = 0;
high = rptr->nbShortRange - 1;
sptr = rptr->shortRange;
while (low <= high) {
mid = (low + high) / 2;
if ((unsigned short) val < sptr[mid].low) {
high = mid - 1;
} else {
if ((unsigned short) val > sptr[mid].high) {
low = mid + 1;
} else {
return 1;
}
}
}
} else {
if (rptr->nbLongRange == 0) {
return 0;
}
low = 0;
high = rptr->nbLongRange - 1;
lptr = rptr->longRange;
while (low <= high) {
mid = (low + high) / 2;
if (val < lptr[mid].low) {
high = mid - 1;
} else {
if (val > lptr[mid].high) {
low = mid + 1;
} else {
return 1;
}
}
}
}
return 0;
}
/**
* xmlIsBaseChar:
* @ch: character to validate
*
* This function is DEPRECATED.
* Use xmlIsBaseChar_ch or xmlIsBaseCharQ instead
*
* Returns true if argument valid, false otherwise
*/
int
xmlIsBaseChar(unsigned int ch) {
return(xmlIsBaseCharQ(ch));
}
/**
* xmlIsBlank:
* @ch: character to validate
*
* This function is DEPRECATED.
* Use xmlIsBlank_ch or xmlIsBlankQ instead
*
* Returns true if argument valid, false otherwise
*/
int
xmlIsBlank(unsigned int ch) {
return(xmlIsBlankQ(ch));
}
/**
* xmlIsChar:
* @ch: character to validate
*
* This function is DEPRECATED.
* Use xmlIsChar_ch or xmlIsCharQ instead
*
* Returns true if argument valid, false otherwise
*/
int
xmlIsChar(unsigned int ch) {
return(xmlIsCharQ(ch));
}
/**
* xmlIsCombining:
* @ch: character to validate
*
* This function is DEPRECATED.
* Use xmlIsCombiningQ instead
*
* Returns true if argument valid, false otherwise
*/
int
xmlIsCombining(unsigned int ch) {
return(xmlIsCombiningQ(ch));
}
/**
* xmlIsDigit:
* @ch: character to validate
*
* This function is DEPRECATED.
* Use xmlIsDigit_ch or xmlIsDigitQ instead
*
* Returns true if argument valid, false otherwise
*/
int
xmlIsDigit(unsigned int ch) {
return(xmlIsDigitQ(ch));
}
/**
* xmlIsExtender:
* @ch: character to validate
*
* This function is DEPRECATED.
* Use xmlIsExtender_ch or xmlIsExtenderQ instead
*
* Returns true if argument valid, false otherwise
*/
int
xmlIsExtender(unsigned int ch) {
return(xmlIsExtenderQ(ch));
}
/**
* xmlIsIdeographic:
* @ch: character to validate
*
* This function is DEPRECATED.
* Use xmlIsIdeographicQ instead
*
* Returns true if argument valid, false otherwise
*/
int
xmlIsIdeographic(unsigned int ch) {
return(xmlIsIdeographicQ(ch));
}
/**
* xmlIsPubidChar:
* @ch: character to validate
*
* This function is DEPRECATED.
* Use xmlIsPubidChar_ch or xmlIsPubidCharQ instead
*
* Returns true if argument valid, false otherwise
*/
int
xmlIsPubidChar(unsigned int ch) {
return(xmlIsPubidCharQ(ch));
}
#define bottom_chvalid
#include "elfgcchack.h"

1501
third_party/libxml/src/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

311
third_party/libxml/src/config.h.in vendored Normal file
View File

@ -0,0 +1,311 @@
/* config.h.in. Generated from configure.in by autoheader. */
#undef PACKAGE
#undef VERSION
#undef HAVE_LIBZ
#undef HAVE_LIBM
#undef HAVE_ISINF
#undef HAVE_ISNAN
#undef HAVE_LIBHISTORY
#undef HAVE_LIBREADLINE
#undef HAVE_LIBPTHREAD
#undef HAVE_PTHREAD_H
/* Define if IPV6 support is there */
#undef SUPPORT_IP6
/* Define if getaddrinfo is there */
#undef HAVE_GETADDRINFO
/* Define to 1 if you have the <ansidecl.h> header file. */
#undef HAVE_ANSIDECL_H
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#undef HAVE_ARPA_NAMESER_H
/* Whether struct sockaddr::__ss_family exists */
#undef HAVE_BROKEN_SS_FAMILY
/* Define to 1 if you have the `class' function. */
#undef HAVE_CLASS
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Have dlopen based dso */
#undef HAVE_DLOPEN
/* Define to 1 if you have the <dl.h> header file. */
#undef HAVE_DL_H
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `finite' function. */
#undef HAVE_FINITE
/* Define to 1 if you have the <float.h> header file. */
#undef HAVE_FLOAT_H
/* Define to 1 if you have the `fpclass' function. */
#undef HAVE_FPCLASS
/* Define to 1 if you have the `fprintf' function. */
#undef HAVE_FPRINTF
/* Define to 1 if you have the `fp_class' function. */
#undef HAVE_FP_CLASS
/* Define to 1 if you have the <fp_class.h> header file. */
#undef HAVE_FP_CLASS_H
/* Define to 1 if you have the `ftime' function. */
#undef HAVE_FTIME
/* Define if getaddrinfo is there */
#undef HAVE_GETADDRINFO
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <ieeefp.h> header file. */
#undef HAVE_IEEEFP_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <inttypes.h.h> header file. */
#undef HAVE_INTTYPES_H_H
/* Define if isinf is there */
#undef HAVE_ISINF
/* Define if isnan is there */
#undef HAVE_ISNAN
/* Define to 1 if you have the `isnand' function. */
#undef HAVE_ISNAND
/* Define if history library is there (-lhistory) */
#undef HAVE_LIBHISTORY
/* Define if pthread library is there (-lpthread) */
#undef HAVE_LIBPTHREAD
/* Define if readline library is there (-lreadline) */
#undef HAVE_LIBREADLINE
/* Have compression library */
#undef HAVE_LIBZ
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the `localtime' function. */
#undef HAVE_LOCALTIME
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <math.h> header file. */
#undef HAVE_MATH_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <nan.h> header file. */
#undef HAVE_NAN_H
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define to 1 if you have the `printf' function. */
#undef HAVE_PRINTF
/* Define if <pthread.h> is there */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the <resolv.h> header file. */
#undef HAVE_RESOLV_H
/* Have shl_load based dso */
#undef HAVE_SHLLOAD
/* Define to 1 if you have the `signal' function. */
#undef HAVE_SIGNAL
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the `sprintf' function. */
#undef HAVE_SPRINTF
/* Define to 1 if you have the `sscanf' function. */
#undef HAVE_SSCANF
/* Define to 1 if you have the `stat' function. */
#undef HAVE_STAT
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/timeb.h> header file. */
#undef HAVE_SYS_TIMEB_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Whether va_copy() is available */
#undef HAVE_VA_COPY
/* Define to 1 if you have the `vfprintf' function. */
#undef HAVE_VFPRINTF
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the `vsprintf' function. */
#undef HAVE_VSPRINTF
/* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H
/* Define to 1 if you have the `_stat' function. */
#undef HAVE__STAT
/* Whether __va_copy() is available */
#undef HAVE___VA_COPY
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if the C compiler supports function prototypes. */
#undef PROTOTYPES
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Support for IPv6 */
#undef SUPPORT_IP6
/* Version number of package */
#undef VERSION
/* Determine what socket length (socklen_t) data type is */
#undef XML_SOCKLEN_T
/* Using the Win32 Socket implementation */
#undef _WINSOCKAPI_
/* Define like PROTOTYPES; this can be used by system headers. */
#undef __PROTOTYPES
/* Win32 Std C name mangling work-around */
#undef snprintf
/* ss_family is not defined here, use __ss_family instead */
#undef ss_family
/* Win32 Std C name mangling work-around */
#undef vsnprintf

1705
third_party/libxml/src/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

16827
third_party/libxml/src/configure vendored Executable file

File diff suppressed because it is too large Load Diff

1462
third_party/libxml/src/configure.in vendored Normal file

File diff suppressed because it is too large Load Diff

43
third_party/libxml/src/dbgen.pl vendored Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/perl
$size = shift;
if ($size eq "")
{
die "usage: dbgen.pl [size]\n";
}
@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood",
"George", "Hank", "Inki", "James");
@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman",
"Franklin", "Grice", "Haverford", "Ilvedson", "Jones");
@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
"SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");
print "<?xml version=\"1.0\"?>\n";
print "\n";
print "<table>\n";
for ($i=0; $i<$size; $i++)
{
$first = $firstnames [$i % 10];
$last = $lastnames [($i / 10) % 10];
$state = $states [($i / 100) % 50];
$zip = 22000 + $i / 5000;
printf " <row>\n";
printf " <id>%04d</id>\n", $i;
printf " <firstname>$first</firstname>\n", $i;
printf " <lastname>$last</lastname>\n", $i;
printf " <street>%d Any St.</street>\n", ($i % 100) + 1;
printf " <city>Anytown</city>\n";
printf " <state>$state</state>\n";
printf " <zip>%d</zip>\n", $zip;
printf " </row>\n";
}
print "</table>\n";

42
third_party/libxml/src/dbgenattr.pl vendored Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/perl
$size = shift;
if ($size eq "")
{
die "usage: dbgen.pl [size]\n";
}
@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood",
"George", "Hank", "Inki", "James");
@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman",
"Franklin", "Grice", "Haverford", "Ilvedson", "Jones");
@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
"SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");
print "<?xml version=\"1.0\"?>\n";
print "\n";
print "<table>\n";
for ($i=0; $i<$size; $i++)
{
$first = $firstnames [$i % 10];
$last = $lastnames [($i / 10) % 10];
$state = $states [($i / 100) % 50];
$zip = 22000 + $i / 5000;
printf " <row\n";
printf " id='%04d'\n", $i;
printf " firstname='$first'\n", $i;
printf " lastname='$last'\n", $i;
printf " street='%d Any St.'\n", ($i % 100) + 1;
printf " city='Anytown'\n";
printf " state='$state'\n";
printf " zip='%d'/>\n", $zip;
}
print "</table>\n";

3262
third_party/libxml/src/debugXML.c vendored Normal file

File diff suppressed because it is too large Load Diff

630
third_party/libxml/src/depcomp vendored Executable file
View File

@ -0,0 +1,630 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

1100
third_party/libxml/src/dict.c vendored Normal file

File diff suppressed because it is too large Load Diff

17610
third_party/libxml/src/elfgcchack.h vendored Normal file

File diff suppressed because it is too large Load Diff

3572
third_party/libxml/src/encoding.c vendored Normal file

File diff suppressed because it is too large Load Diff

1022
third_party/libxml/src/entities.c vendored Normal file

File diff suppressed because it is too large Load Diff

989
third_party/libxml/src/error.c vendored Normal file
View File

@ -0,0 +1,989 @@
/*
* error.c: module displaying/handling XML parser errors
*
* See Copyright for the status of this software.
*
* Daniel Veillard <daniel@veillard.com>
*/
#define IN_LIBXML
#include "libxml.h"
#include <string.h>
#include <stdarg.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
const char *msg,
...);
#define XML_GET_VAR_STR(msg, str) { \
int size, prev_size = -1; \
int chars; \
char *larger; \
va_list ap; \
\
str = (char *) xmlMalloc(150); \
if (str != NULL) { \
\
size = 150; \
\
while (size < 64000) { \
va_start(ap, msg); \
chars = vsnprintf(str, size, msg, ap); \
va_end(ap); \
if ((chars > -1) && (chars < size)) { \
if (prev_size == chars) { \
break; \
} else { \
prev_size = chars; \
} \
} \
if (chars > -1) \
size += chars + 1; \
else \
size += 100; \
if ((larger = (char *) xmlRealloc(str, size)) == NULL) {\
break; \
} \
str = larger; \
}} \
}
/************************************************************************
* *
* Handling of out of context errors *
* *
************************************************************************/
/**
* xmlGenericErrorDefaultFunc:
* @ctx: an error context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Default handler for out of context error messages.
*/
void XMLCDECL
xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
va_list args;
if (xmlGenericErrorContext == NULL)
xmlGenericErrorContext = (void *) stderr;
va_start(args, msg);
vfprintf((FILE *)xmlGenericErrorContext, msg, args);
va_end(args);
}
/**
* initGenericErrorDefaultFunc:
* @handler: the handler
*
* Set or reset (if NULL) the default handler for generic errors
* to the builtin error function.
*/
void
initGenericErrorDefaultFunc(xmlGenericErrorFunc * handler)
{
if (handler == NULL)
xmlGenericError = xmlGenericErrorDefaultFunc;
else
xmlGenericError = (*handler);
}
/**
* xmlSetGenericErrorFunc:
* @ctx: the new error handling context
* @handler: the new handler function
*
* Function to reset the handler and the error context for out of
* context error messages.
* This simply means that @handler will be called for subsequent
* error messages while not parsing nor validating. And @ctx will
* be passed as first argument to @handler
* One can simply force messages to be emitted to another FILE * than
* stderr by setting @ctx to this file handle and @handler to NULL.
* For multi-threaded applications, this must be set separately for each thread.
*/
void
xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
xmlGenericErrorContext = ctx;
if (handler != NULL)
xmlGenericError = handler;
else
xmlGenericError = xmlGenericErrorDefaultFunc;
}
/**
* xmlSetStructuredErrorFunc:
* @ctx: the new error handling context
* @handler: the new handler function
*
* Function to reset the handler and the error context for out of
* context structured error messages.
* This simply means that @handler will be called for subsequent
* error messages while not parsing nor validating. And @ctx will
* be passed as first argument to @handler
* For multi-threaded applications, this must be set separately for each thread.
*/
void
xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
xmlStructuredErrorContext = ctx;
xmlStructuredError = handler;
}
/************************************************************************
* *
* Handling of parsing errors *
* *
************************************************************************/
/**
* xmlParserPrintFileInfo:
* @input: an xmlParserInputPtr input
*
* Displays the associated file and line informations for the current input
*/
void
xmlParserPrintFileInfo(xmlParserInputPtr input) {
if (input != NULL) {
if (input->filename)
xmlGenericError(xmlGenericErrorContext,
"%s:%d: ", input->filename,
input->line);
else
xmlGenericError(xmlGenericErrorContext,
"Entity: line %d: ", input->line);
}
}
/**
* xmlParserPrintFileContext:
* @input: an xmlParserInputPtr input
*
* Displays current context within the input content for error tracking
*/
static void
xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
xmlGenericErrorFunc channel, void *data ) {
const xmlChar *cur, *base;
unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */
xmlChar content[81]; /* space for 80 chars + line terminator */
xmlChar *ctnt;
if (input == NULL) return;
cur = input->cur;
base = input->base;
/* skip backwards over any end-of-lines */
while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) {
cur--;
}
n = 0;
/* search backwards for beginning-of-line (to max buff size) */
while ((n++ < (sizeof(content)-1)) && (cur > base) &&
(*(cur) != '\n') && (*(cur) != '\r'))
cur--;
if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
/* calculate the error position in terms of the current position */
col = input->cur - cur;
/* search forward for end-of-line (to max buff size) */
n = 0;
ctnt = content;
/* copy selected text to our buffer */
while ((*cur != 0) && (*(cur) != '\n') &&
(*(cur) != '\r') && (n < sizeof(content)-1)) {
*ctnt++ = *cur++;
n++;
}
*ctnt = 0;
/* print out the selected text */
channel(data ,"%s\n", content);
/* create blank line with problem pointer */
n = 0;
ctnt = content;
/* (leave buffer space for pointer + line terminator) */
while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) {
if (*(ctnt) != '\t')
*(ctnt) = ' ';
ctnt++;
}
*ctnt++ = '^';
*ctnt = 0;
channel(data ,"%s\n", content);
}
/**
* xmlParserPrintFileContext:
* @input: an xmlParserInputPtr input
*
* Displays current context within the input content for error tracking
*/
void
xmlParserPrintFileContext(xmlParserInputPtr input) {
xmlParserPrintFileContextInternal(input, xmlGenericError,
xmlGenericErrorContext);
}
/**
* xmlReportError:
* @err: the error
* @ctx: the parser context or NULL
* @str: the formatted error message
*
* Report an erro with its context, replace the 4 old error/warning
* routines.
*/
static void
xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str,
xmlGenericErrorFunc channel, void *data)
{
char *file = NULL;
int line = 0;
int code = -1;
int domain;
const xmlChar *name = NULL;
xmlNodePtr node;
xmlErrorLevel level;
xmlParserInputPtr input = NULL;
xmlParserInputPtr cur = NULL;
if (err == NULL)
return;
if (channel == NULL) {
channel = xmlGenericError;
data = xmlGenericErrorContext;
}
file = err->file;
line = err->line;
code = err->code;
domain = err->domain;
level = err->level;
node = err->node;
if (code == XML_ERR_OK)
return;
if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
name = node->name;
/*
* Maintain the compatibility with the legacy error handling
*/
if (ctxt != NULL) {
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) &&
(ctxt->inputNr > 1)) {
cur = input;
input = ctxt->inputTab[ctxt->inputNr - 2];
}
if (input != NULL) {
if (input->filename)
channel(data, "%s:%d: ", input->filename, input->line);
else if ((line != 0) && (domain == XML_FROM_PARSER))
channel(data, "Entity: line %d: ", input->line);
}
} else {
if (file != NULL)
channel(data, "%s:%d: ", file, line);
else if ((line != 0) && (domain == XML_FROM_PARSER))
channel(data, "Entity: line %d: ", line);
}
if (name != NULL) {
channel(data, "element %s: ", name);
}
switch (domain) {
case XML_FROM_PARSER:
channel(data, "parser ");
break;
case XML_FROM_NAMESPACE:
channel(data, "namespace ");
break;
case XML_FROM_DTD:
case XML_FROM_VALID:
channel(data, "validity ");
break;
case XML_FROM_HTML:
channel(data, "HTML parser ");
break;
case XML_FROM_MEMORY:
channel(data, "memory ");
break;
case XML_FROM_OUTPUT:
channel(data, "output ");
break;
case XML_FROM_IO:
channel(data, "I/O ");
break;
case XML_FROM_XINCLUDE:
channel(data, "XInclude ");
break;
case XML_FROM_XPATH:
channel(data, "XPath ");
break;
case XML_FROM_XPOINTER:
channel(data, "parser ");
break;
case XML_FROM_REGEXP:
channel(data, "regexp ");
break;
case XML_FROM_MODULE:
channel(data, "module ");
break;
case XML_FROM_SCHEMASV:
channel(data, "Schemas validity ");
break;
case XML_FROM_SCHEMASP:
channel(data, "Schemas parser ");
break;
case XML_FROM_RELAXNGP:
channel(data, "Relax-NG parser ");
break;
case XML_FROM_RELAXNGV:
channel(data, "Relax-NG validity ");
break;
case XML_FROM_CATALOG:
channel(data, "Catalog ");
break;
case XML_FROM_C14N:
channel(data, "C14N ");
break;
case XML_FROM_XSLT:
channel(data, "XSLT ");
break;
case XML_FROM_I18N:
channel(data, "encoding ");
break;
default:
break;
}
switch (level) {
case XML_ERR_NONE:
channel(data, ": ");
break;
case XML_ERR_WARNING:
channel(data, "warning : ");
break;
case XML_ERR_ERROR:
channel(data, "error : ");
break;
case XML_ERR_FATAL:
channel(data, "error : ");
break;
}
if (str != NULL) {
int len;
len = xmlStrlen((const xmlChar *)str);
if ((len > 0) && (str[len - 1] != '\n'))
channel(data, "%s\n", str);
else
channel(data, "%s", str);
} else {
channel(data, "%s\n", "out of memory error");
}
if (ctxt != NULL) {
xmlParserPrintFileContextInternal(input, channel, data);
if (cur != NULL) {
if (cur->filename)
channel(data, "%s:%d: \n", cur->filename, cur->line);
else if ((line != 0) && (domain == XML_FROM_PARSER))
channel(data, "Entity: line %d: \n", cur->line);
xmlParserPrintFileContextInternal(cur, channel, data);
}
}
if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) &&
(err->int1 < 100) &&
(err->int1 < xmlStrlen((const xmlChar *)err->str1))) {
xmlChar buf[150];
int i;
channel(data, "%s\n", err->str1);
for (i=0;i < err->int1;i++)
buf[i] = ' ';
buf[i++] = '^';
buf[i] = 0;
channel(data, "%s\n", buf);
}
}
/**
* __xmlRaiseError:
* @schannel: the structured callback channel
* @channel: the old callback channel
* @data: the callback data
* @ctx: the parser context or NULL
* @ctx: the parser context or NULL
* @domain: the domain for the error
* @code: the code for the error
* @level: the xmlErrorLevel for the error
* @file: the file source of the error (or NULL)
* @line: the line of the error or 0 if N/A
* @str1: extra string info
* @str2: extra string info
* @str3: extra string info
* @int1: extra int info
* @col: column number of the error or 0 if N/A
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Update the appropriate global or contextual error structure,
* then forward the error message down the parser or generic
* error callback handler
*/
void XMLCDECL
__xmlRaiseError(xmlStructuredErrorFunc schannel,
xmlGenericErrorFunc channel, void *data, void *ctx,
void *nod, int domain, int code, xmlErrorLevel level,
const char *file, int line, const char *str1,
const char *str2, const char *str3, int int1, int col,
const char *msg, ...)
{
xmlParserCtxtPtr ctxt = NULL;
xmlNodePtr node = (xmlNodePtr) nod;
char *str = NULL;
xmlParserInputPtr input = NULL;
xmlErrorPtr to = &xmlLastError;
xmlNodePtr baseptr = NULL;
if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING))
return;
if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
(domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
(domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
ctxt = (xmlParserCtxtPtr) ctx;
if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
(ctxt->sax->initialized == XML_SAX2_MAGIC))
schannel = ctxt->sax->serror;
}
/*
* Check if structured error handler set
*/
if (schannel == NULL) {
schannel = xmlStructuredError;
/*
* if user has defined handler, change data ptr to user's choice
*/
if (schannel != NULL)
data = xmlStructuredErrorContext;
}
if ((domain == XML_FROM_VALID) &&
((channel == xmlParserValidityError) ||
(channel == xmlParserValidityWarning))) {
ctxt = (xmlParserCtxtPtr) ctx;
if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
(ctxt->sax->initialized == XML_SAX2_MAGIC))
schannel = ctxt->sax->serror;
}
if (code == XML_ERR_OK)
return;
/*
* Formatting the message
*/
if (msg == NULL) {
str = (char *) xmlStrdup(BAD_CAST "No error message provided");
} else {
XML_GET_VAR_STR(msg, str);
}
/*
* specific processing if a parser context is provided
*/
if (ctxt != NULL) {
if (file == NULL) {
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) &&
(ctxt->inputNr > 1)) {
input = ctxt->inputTab[ctxt->inputNr - 2];
}
if (input != NULL) {
file = input->filename;
line = input->line;
col = input->col;
}
}
to = &ctxt->lastError;
} else if ((node != NULL) && (file == NULL)) {
int i;
if ((node->doc != NULL) && (node->doc->URL != NULL)) {
baseptr = node;
/* file = (const char *) node->doc->URL; */
}
for (i = 0;
((i < 10) && (node != NULL) && (node->type != XML_ELEMENT_NODE));
i++)
node = node->parent;
if ((baseptr == NULL) && (node != NULL) &&
(node->doc != NULL) && (node->doc->URL != NULL))
baseptr = node;
if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
line = node->line;
}
/*
* Save the information about the error
*/
xmlResetError(to);
to->domain = domain;
to->code = code;
to->message = str;
to->level = level;
if (file != NULL)
to->file = (char *) xmlStrdup((const xmlChar *) file);
else if (baseptr != NULL) {
#ifdef LIBXML_XINCLUDE_ENABLED
/*
* We check if the error is within an XInclude section and,
* if so, attempt to print out the href of the XInclude instead
* of the usual "base" (doc->URL) for the node (bug 152623).
*/
xmlNodePtr prev = baseptr;
int inclcount = 0;
while (prev != NULL) {
if (prev->prev == NULL)
prev = prev->parent;
else {
prev = prev->prev;
if (prev->type == XML_XINCLUDE_START) {
if (--inclcount < 0)
break;
} else if (prev->type == XML_XINCLUDE_END)
inclcount++;
}
}
if (prev != NULL) {
if (prev->type == XML_XINCLUDE_START) {
prev->type = XML_ELEMENT_NODE;
to->file = (char *) xmlGetProp(prev, BAD_CAST "href");
prev->type = XML_XINCLUDE_START;
} else {
to->file = (char *) xmlGetProp(prev, BAD_CAST "href");
}
} else
#endif
to->file = (char *) xmlStrdup(baseptr->doc->URL);
if ((to->file == NULL) && (node != NULL) && (node->doc != NULL)) {
to->file = (char *) xmlStrdup(node->doc->URL);
}
}
to->line = line;
if (str1 != NULL)
to->str1 = (char *) xmlStrdup((const xmlChar *) str1);
if (str2 != NULL)
to->str2 = (char *) xmlStrdup((const xmlChar *) str2);
if (str3 != NULL)
to->str3 = (char *) xmlStrdup((const xmlChar *) str3);
to->int1 = int1;
to->int2 = col;
to->node = node;
to->ctxt = ctx;
if (to != &xmlLastError)
xmlCopyError(to,&xmlLastError);
/*
* Find the callback channel if channel param is NULL
*/
if ((ctxt != NULL) && (channel == NULL) &&
(xmlStructuredError == NULL) && (ctxt->sax != NULL)) {
if (level == XML_ERR_WARNING)
channel = ctxt->sax->warning;
else
channel = ctxt->sax->error;
data = ctxt->userData;
} else if (channel == NULL) {
if ((schannel == NULL) && (xmlStructuredError != NULL)) {
schannel = xmlStructuredError;
data = xmlStructuredErrorContext;
} else {
channel = xmlGenericError;
if (!data) {
data = xmlGenericErrorContext;
}
}
}
if (schannel != NULL) {
schannel(data, to);
return;
}
if (channel == NULL)
return;
if ((channel == xmlParserError) ||
(channel == xmlParserWarning) ||
(channel == xmlParserValidityError) ||
(channel == xmlParserValidityWarning))
xmlReportError(to, ctxt, str, NULL, NULL);
else if ((channel == (xmlGenericErrorFunc) fprintf) ||
(channel == xmlGenericErrorDefaultFunc))
xmlReportError(to, ctxt, str, channel, data);
else
channel(data, "%s", str);
}
/**
* __xmlSimpleError:
* @domain: where the error comes from
* @code: the error code
* @node: the context node
* @extra: extra informations
*
* Handle an out of memory condition
*/
void
__xmlSimpleError(int domain, int code, xmlNodePtr node,
const char *msg, const char *extra)
{
if (code == XML_ERR_NO_MEMORY) {
if (extra)
__xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra,
NULL, NULL, 0, 0,
"Memory allocation failed : %s\n", extra);
else
__xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL,
NULL, NULL, 0, 0, "Memory allocation failed\n");
} else {
__xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
code, XML_ERR_ERROR, NULL, 0, extra,
NULL, NULL, 0, 0, msg, extra);
}
}
/**
* xmlParserError:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format an error messages, gives file, line, position and
* extra parameters.
*/
void XMLCDECL
xmlParserError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input = NULL;
xmlParserInputPtr cur = NULL;
char * str;
if (ctxt != NULL) {
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) &&
(ctxt->inputNr > 1)) {
cur = input;
input = ctxt->inputTab[ctxt->inputNr - 2];
}
xmlParserPrintFileInfo(input);
}
xmlGenericError(xmlGenericErrorContext, "error: ");
XML_GET_VAR_STR(msg, str);
xmlGenericError(xmlGenericErrorContext, "%s", str);
if (str != NULL)
xmlFree(str);
if (ctxt != NULL) {
xmlParserPrintFileContext(input);
if (cur != NULL) {
xmlParserPrintFileInfo(cur);
xmlGenericError(xmlGenericErrorContext, "\n");
xmlParserPrintFileContext(cur);
}
}
}
/**
* xmlParserWarning:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format a warning messages, gives file, line, position and
* extra parameters.
*/
void XMLCDECL
xmlParserWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input = NULL;
xmlParserInputPtr cur = NULL;
char * str;
if (ctxt != NULL) {
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) &&
(ctxt->inputNr > 1)) {
cur = input;
input = ctxt->inputTab[ctxt->inputNr - 2];
}
xmlParserPrintFileInfo(input);
}
xmlGenericError(xmlGenericErrorContext, "warning: ");
XML_GET_VAR_STR(msg, str);
xmlGenericError(xmlGenericErrorContext, "%s", str);
if (str != NULL)
xmlFree(str);
if (ctxt != NULL) {
xmlParserPrintFileContext(input);
if (cur != NULL) {
xmlParserPrintFileInfo(cur);
xmlGenericError(xmlGenericErrorContext, "\n");
xmlParserPrintFileContext(cur);
}
}
}
/************************************************************************
* *
* Handling of validation errors *
* *
************************************************************************/
/**
* xmlParserValidityError:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format an validity error messages, gives file,
* line, position and extra parameters.
*/
void XMLCDECL
xmlParserValidityError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input = NULL;
char * str;
int len = xmlStrlen((const xmlChar *) msg);
static int had_info = 0;
if ((len > 1) && (msg[len - 2] != ':')) {
if (ctxt != NULL) {
input = ctxt->input;
if ((input->filename == NULL) && (ctxt->inputNr > 1))
input = ctxt->inputTab[ctxt->inputNr - 2];
if (had_info == 0) {
xmlParserPrintFileInfo(input);
}
}
xmlGenericError(xmlGenericErrorContext, "validity error: ");
had_info = 0;
} else {
had_info = 1;
}
XML_GET_VAR_STR(msg, str);
xmlGenericError(xmlGenericErrorContext, "%s", str);
if (str != NULL)
xmlFree(str);
if ((ctxt != NULL) && (input != NULL)) {
xmlParserPrintFileContext(input);
}
}
/**
* xmlParserValidityWarning:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format a validity warning messages, gives file, line,
* position and extra parameters.
*/
void XMLCDECL
xmlParserValidityWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input = NULL;
char * str;
int len = xmlStrlen((const xmlChar *) msg);
if ((ctxt != NULL) && (len != 0) && (msg[len - 1] != ':')) {
input = ctxt->input;
if ((input->filename == NULL) && (ctxt->inputNr > 1))
input = ctxt->inputTab[ctxt->inputNr - 2];
xmlParserPrintFileInfo(input);
}
xmlGenericError(xmlGenericErrorContext, "validity warning: ");
XML_GET_VAR_STR(msg, str);
xmlGenericError(xmlGenericErrorContext, "%s", str);
if (str != NULL)
xmlFree(str);
if (ctxt != NULL) {
xmlParserPrintFileContext(input);
}
}
/************************************************************************
* *
* Extended Error Handling *
* *
************************************************************************/
/**
* xmlGetLastError:
*
* Get the last global error registered. This is per thread if compiled
* with thread support.
*
* Returns NULL if no error occured or a pointer to the error
*/
xmlErrorPtr
xmlGetLastError(void)
{
if (xmlLastError.code == XML_ERR_OK)
return (NULL);
return (&xmlLastError);
}
/**
* xmlResetError:
* @err: pointer to the error.
*
* Cleanup the error.
*/
void
xmlResetError(xmlErrorPtr err)
{
if (err == NULL)
return;
if (err->code == XML_ERR_OK)
return;
if (err->message != NULL)
xmlFree(err->message);
if (err->file != NULL)
xmlFree(err->file);
if (err->str1 != NULL)
xmlFree(err->str1);
if (err->str2 != NULL)
xmlFree(err->str2);
if (err->str3 != NULL)
xmlFree(err->str3);
memset(err, 0, sizeof(xmlError));
err->code = XML_ERR_OK;
}
/**
* xmlResetLastError:
*
* Cleanup the last global error registered. For parsing error
* this does not change the well-formedness result.
*/
void
xmlResetLastError(void)
{
if (xmlLastError.code == XML_ERR_OK)
return;
xmlResetError(&xmlLastError);
}
/**
* xmlCtxtGetLastError:
* @ctx: an XML parser context
*
* Get the last parsing error registered.
*
* Returns NULL if no error occured or a pointer to the error
*/
xmlErrorPtr
xmlCtxtGetLastError(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt == NULL)
return (NULL);
if (ctxt->lastError.code == XML_ERR_OK)
return (NULL);
return (&ctxt->lastError);
}
/**
* xmlCtxtResetLastError:
* @ctx: an XML parser context
*
* Cleanup the last global error registered. For parsing error
* this does not change the well-formedness result.
*/
void
xmlCtxtResetLastError(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt == NULL)
return;
ctxt->errNo = XML_ERR_OK;
if (ctxt->lastError.code == XML_ERR_OK)
return;
xmlResetError(&ctxt->lastError);
}
/**
* xmlCopyError:
* @from: a source error
* @to: a target error
*
* Save the original error to the new place.
*
* Returns 0 in case of success and -1 in case of error.
*/
int
xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) {
char *message, *file, *str1, *str2, *str3;
if ((from == NULL) || (to == NULL))
return(-1);
message = (char *) xmlStrdup((xmlChar *) from->message);
file = (char *) xmlStrdup ((xmlChar *) from->file);
str1 = (char *) xmlStrdup ((xmlChar *) from->str1);
str2 = (char *) xmlStrdup ((xmlChar *) from->str2);
str3 = (char *) xmlStrdup ((xmlChar *) from->str3);
if (to->message != NULL)
xmlFree(to->message);
if (to->file != NULL)
xmlFree(to->file);
if (to->str1 != NULL)
xmlFree(to->str1);
if (to->str2 != NULL)
xmlFree(to->str2);
if (to->str3 != NULL)
xmlFree(to->str3);
to->domain = from->domain;
to->code = from->code;
to->level = from->level;
to->line = from->line;
to->node = from->node;
to->int1 = from->int1;
to->int2 = from->int2;
to->node = from->node;
to->ctxt = from->ctxt;
to->message = message;
to->file = file;
to->str1 = str1;
to->str2 = str2;
to->str3 = str3;
return 0;
}
#define bottom_error
#include "elfgcchack.h"

478
third_party/libxml/src/genUnicode.py vendored Executable file
View File

@ -0,0 +1,478 @@
#!/usr/bin/python -u
#
# Original script modified in November 2003 to take advantage of
# the character-validation range routines, and updated to the
# current Unicode information (Version 4.0.1)
#
# NOTE: there is an 'alias' facility for blocks which are not present in
# the current release, but are needed for ABI compatibility. This
# must be accomplished MANUALLY! Please see the comments below under
# 'blockAliases'
#
import sys
import string
import time
webpage = "http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html"
sources = "Blocks-4.0.1.txt UnicodeData-4.0.1.txt"
#
# blockAliases is a small hack - it is used for mapping block names which
# were were used in the 3.1 release, but are missing or changed in the current
# release. The format is "OldBlockName:NewBlockName1[,NewBlockName2[,...]]"
blockAliases = []
blockAliases.append("CombiningMarksforSymbols:CombiningDiacriticalMarksforSymbols")
blockAliases.append("Greek:GreekandCoptic")
blockAliases.append("PrivateUse:PrivateUseArea,SupplementaryPrivateUseArea-A," +
"SupplementaryPrivateUseArea-B")
# minTableSize gives the minimum number of ranges which must be present
# before a range table is produced. If there are less than this
# number, inline comparisons are generated
minTableSize = 8
(blockfile, catfile) = string.split(sources)
#
# Now process the "blocks" file, reducing it to a dictionary
# indexed by blockname, containing a tuple with the applicable
# block range
#
BlockNames = {}
try:
blocks = open(blockfile, "r")
except:
print "Missing %s, aborting ..." % blockfile
sys.exit(1)
for line in blocks.readlines():
if line[0] == '#':
continue
line = string.strip(line)
if line == '':
continue
try:
fields = string.split(line, ';')
range = string.strip(fields[0])
(start, end) = string.split(range, "..")
name = string.strip(fields[1])
name = string.replace(name, ' ', '')
except:
print "Failed to process line: %s" % (line)
continue
start = "0x" + start
end = "0x" + end
try:
BlockNames[name].append((start, end))
except:
BlockNames[name] = [(start, end)]
blocks.close()
print "Parsed %d blocks descriptions" % (len(BlockNames.keys()))
for block in blockAliases:
alias = string.split(block,':')
alist = string.split(alias[1],',')
for comp in alist:
if BlockNames.has_key(comp):
if alias[0] not in BlockNames:
BlockNames[alias[0]] = []
for r in BlockNames[comp]:
BlockNames[alias[0]].append(r)
else:
print "Alias %s: %s not in Blocks" % (alias[0], comp)
continue
#
# Next process the Categories file. This is more complex, since
# the file is in code sequence, and we need to invert it. We use
# a dictionary with index category-name, with each entry containing
# all the ranges (codepoints) of that category. Note that category
# names comprise two parts - the general category, and the "subclass"
# within that category. Therefore, both "general category" (which is
# the first character of the 2-character category-name) and the full
# (2-character) name are entered into this dictionary.
#
try:
data = open(catfile, "r")
except:
print "Missing %s, aborting ..." % catfile
sys.exit(1)
nbchar = 0;
Categories = {}
for line in data.readlines():
if line[0] == '#':
continue
line = string.strip(line)
if line == '':
continue
try:
fields = string.split(line, ';')
point = string.strip(fields[0])
value = 0
while point != '':
value = value * 16
if point[0] >= '0' and point[0] <= '9':
value = value + ord(point[0]) - ord('0')
elif point[0] >= 'A' and point[0] <= 'F':
value = value + 10 + ord(point[0]) - ord('A')
elif point[0] >= 'a' and point[0] <= 'f':
value = value + 10 + ord(point[0]) - ord('a')
point = point[1:]
name = fields[2]
except:
print "Failed to process line: %s" % (line)
continue
nbchar = nbchar + 1
# update entry for "full name"
try:
Categories[name].append(value)
except:
try:
Categories[name] = [value]
except:
print "Failed to process line: %s" % (line)
# update "general category" name
try:
Categories[name[0]].append(value)
except:
try:
Categories[name[0]] = [value]
except:
print "Failed to process line: %s" % (line)
blocks.close()
print "Parsed %d char generating %d categories" % (nbchar, len(Categories.keys()))
#
# The data is now all read. Time to process it into a more useful form.
#
# reduce the number list into ranges
for cat in Categories.keys():
list = Categories[cat]
start = -1
prev = -1
end = -1
ranges = []
for val in list:
if start == -1:
start = val
prev = val
continue
elif val == prev + 1:
prev = val
continue
elif prev == start:
ranges.append((prev, prev))
start = val
prev = val
continue
else:
ranges.append((start, prev))
start = val
prev = val
continue
if prev == start:
ranges.append((prev, prev))
else:
ranges.append((start, prev))
Categories[cat] = ranges
#
# Assure all data is in alphabetic order, since we will be doing binary
# searches on the tables.
#
bkeys = BlockNames.keys()
bkeys.sort()
ckeys = Categories.keys()
ckeys.sort()
#
# Generate the resulting files
#
try:
header = open("include/libxml/xmlunicode.h", "w")
except:
print "Failed to open include/libxml/xmlunicode.h"
sys.exit(1)
try:
output = open("xmlunicode.c", "w")
except:
print "Failed to open xmlunicode.c"
sys.exit(1)
date = time.asctime(time.localtime(time.time()))
header.write(
"""/*
* Summary: Unicode character APIs
* Description: API for the Unicode character APIs
*
* This file is automatically generated from the
* UCS description files of the Unicode Character Database
* %s
* using the genUnicode.py Python script.
*
* Generation date: %s
* Sources: %s
* Author: Daniel Veillard
*/
#ifndef __XML_UNICODE_H__
#define __XML_UNICODE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_UNICODE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
""" % (webpage, date, sources));
output.write(
"""/*
* xmlunicode.c: this module implements the Unicode character APIs
*
* This file is automatically generated from the
* UCS description files of the Unicode Character Database
* %s
* using the genUnicode.py Python script.
*
* Generation date: %s
* Sources: %s
* Daniel Veillard <veillard@redhat.com>
*/
#define IN_LIBXML
#include "libxml.h"
#ifdef LIBXML_UNICODE_ENABLED
#include <string.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlunicode.h>
#include <libxml/chvalid.h>
typedef int (xmlIntFunc)(int); /* just to keep one's mind untwisted */
typedef struct {
const char *rangename;
xmlIntFunc *func;
} xmlUnicodeRange;
typedef struct {
xmlUnicodeRange *table;
int numentries;
} xmlUnicodeNameTable;
static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname);
static xmlUnicodeRange xmlUnicodeBlocks[] = {
""" % (webpage, date, sources));
flag = 0
for block in bkeys:
name = string.replace(block, '-', '')
if flag:
output.write(',\n')
else:
flag = 1
output.write(' {"%s", xmlUCSIs%s}' % (block, name))
output.write('};\n\n')
output.write('static xmlUnicodeRange xmlUnicodeCats[] = {\n')
flag = 0;
for name in ckeys:
if flag:
output.write(',\n')
else:
flag = 1
output.write(' {"%s", xmlUCSIsCat%s}' % (name, name))
output.write('};\n\n')
#
# For any categories with more than minTableSize ranges we generate
# a range table suitable for xmlCharInRange
#
for name in ckeys:
if len(Categories[name]) > minTableSize:
numshort = 0
numlong = 0
ranges = Categories[name]
sptr = "NULL"
lptr = "NULL"
for range in ranges:
(low, high) = range
if high < 0x10000:
if numshort == 0:
pline = "static const xmlChSRange xml%sS[] = {" % name
sptr = "xml%sS" % name
else:
pline += ", "
numshort += 1
else:
if numlong == 0:
if numshort > 0:
output.write(pline + " };\n")
pline = "static const xmlChLRange xml%sL[] = {" % name
lptr = "xml%sL" % name
else:
pline += ", "
numlong += 1
if len(pline) > 60:
output.write(pline + "\n")
pline = " "
pline += "{%s, %s}" % (hex(low), hex(high))
output.write(pline + " };\nstatic xmlChRangeGroup xml%sG = {%s,%s,%s,%s};\n\n"
% (name, numshort, numlong, sptr, lptr))
output.write(
"""static xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s};
static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s};
/**
* xmlUnicodeLookup:
* @tptr: pointer to the name table
* @name: name to be found
*
* binary table lookup for user-supplied name
*
* Returns pointer to range function if found, otherwise NULL
*/
static xmlIntFunc
*xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname) {
int low, high, mid, cmp;
xmlUnicodeRange *sptr;
if ((tptr == NULL) || (tname == NULL)) return(NULL);
low = 0;
high = tptr->numentries - 1;
sptr = tptr->table;
while (low <= high) {
mid = (low + high) / 2;
if ((cmp=strcmp(tname, sptr[mid].rangename)) == 0)
return (sptr[mid].func);
if (cmp < 0)
high = mid - 1;
else
low = mid + 1;
}
return (NULL);
}
""" % (len(BlockNames), len(Categories)) )
for block in bkeys:
name = string.replace(block, '-', '')
header.write("XMLPUBFUN int XMLCALL xmlUCSIs%s\t(int code);\n" % name)
output.write("/**\n * xmlUCSIs%s:\n * @code: UCS code point\n" % (name))
output.write(" *\n * Check whether the character is part of %s UCS Block\n"%
(block))
output.write(" *\n * Returns 1 if true 0 otherwise\n */\n");
output.write("int\nxmlUCSIs%s(int code) {\n return(" % name)
flag = 0
for (start, end) in BlockNames[block]:
if flag:
output.write(" ||\n ")
else:
flag = 1
output.write("((code >= %s) && (code <= %s))" % (start, end))
output.write(");\n}\n\n")
header.write("\nXMLPUBFUN int XMLCALL xmlUCSIsBlock\t(int code, const char *block);\n\n")
output.write(
"""/**
* xmlUCSIsBlock:
* @code: UCS code point
* @block: UCS block name
*
* Check whether the character is part of the UCS Block
*
* Returns 1 if true, 0 if false and -1 on unknown block
*/
int
xmlUCSIsBlock(int code, const char *block) {
xmlIntFunc *func;
func = xmlUnicodeLookup(&xmlUnicodeBlockTbl, block);
if (func == NULL)
return (-1);
return (func(code));
}
""")
for name in ckeys:
ranges = Categories[name]
header.write("XMLPUBFUN int XMLCALL xmlUCSIsCat%s\t(int code);\n" % name)
output.write("/**\n * xmlUCSIsCat%s:\n * @code: UCS code point\n" % (name))
output.write(" *\n * Check whether the character is part of %s UCS Category\n"%
(name))
output.write(" *\n * Returns 1 if true 0 otherwise\n */\n");
output.write("int\nxmlUCSIsCat%s(int code) {\n" % name)
if len(Categories[name]) > minTableSize:
output.write(" return(xmlCharInRange((unsigned int)code, &xml%sG)"
% name)
else:
start = 1
for range in ranges:
(begin, end) = range;
if start:
output.write(" return(");
start = 0
else:
output.write(" ||\n ");
if (begin == end):
output.write("(code == %s)" % (hex(begin)))
else:
output.write("((code >= %s) && (code <= %s))" % (
hex(begin), hex(end)))
output.write(");\n}\n\n")
header.write("\nXMLPUBFUN int XMLCALL xmlUCSIsCat\t(int code, const char *cat);\n")
output.write(
"""/**
* xmlUCSIsCat:
* @code: UCS code point
* @cat: UCS Category name
*
* Check whether the character is part of the UCS Category
*
* Returns 1 if true, 0 if false and -1 on unknown category
*/
int
xmlUCSIsCat(int code, const char *cat) {
xmlIntFunc *func;
func = xmlUnicodeLookup(&xmlUnicodeCatTbl, cat);
if (func == NULL)
return (-1);
return (func(code));
}
#define bottom_xmlunicode
#include "elfgcchack.h"
#endif /* LIBXML_UNICODE_ENABLED */
""")
header.write("""
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_UNICODE_ENABLED */
#endif /* __XML_UNICODE_H__ */
""");
header.close()
output.close()

963
third_party/libxml/src/gentest.py vendored Executable file
View File

@ -0,0 +1,963 @@
#!/usr/bin/python -u
#
# generate a tester program for the API
#
import sys
import os
import string
try:
import libxml2
except:
print "libxml2 python bindings not available, skipping testapi.c generation"
sys.exit(0)
if len(sys.argv) > 1:
srcPref = sys.argv[1] + '/'
else:
srcPref = ''
#
# Modules we want to skip in API test
#
skipped_modules = [ "SAX", "xlink", "threads", "globals",
"xmlmemory", "xmlversion", "xmlexports",
#deprecated
"DOCBparser",
]
#
# defines for each module
#
modules_defines = {
"HTMLparser": "LIBXML_HTML_ENABLED",
"catalog": "LIBXML_CATALOG_ENABLED",
"xmlreader": "LIBXML_READER_ENABLED",
"relaxng": "LIBXML_SCHEMAS_ENABLED",
"schemasInternals": "LIBXML_SCHEMAS_ENABLED",
"xmlschemas": "LIBXML_SCHEMAS_ENABLED",
"xmlschemastypes": "LIBXML_SCHEMAS_ENABLED",
"xpath": "LIBXML_XPATH_ENABLED",
"xpathInternals": "LIBXML_XPATH_ENABLED",
"xinclude": "LIBXML_XINCLUDE_ENABLED",
"xpointer": "LIBXML_XPTR_ENABLED",
"xmlregexp" : "LIBXML_REGEXP_ENABLED",
"xmlautomata" : "LIBXML_AUTOMATA_ENABLED",
"xmlsave" : "LIBXML_OUTPUT_ENABLED",
"DOCBparser" : "LIBXML_DOCB_ENABLED",
"xmlmodule" : "LIBXML_MODULES_ENABLED",
"pattern" : "LIBXML_PATTERN_ENABLED",
"schematron" : "LIBXML_SCHEMATRON_ENABLED",
}
#
# defines for specific functions
#
function_defines = {
"htmlDefaultSAXHandlerInit": "LIBXML_HTML_ENABLED",
"xmlSAX2EndElement" : "LIBXML_SAX1_ENABLED",
"xmlSAX2StartElement" : "LIBXML_SAX1_ENABLED",
"xmlSAXDefaultVersion" : "LIBXML_SAX1_ENABLED",
"UTF8Toisolat1" : "LIBXML_OUTPUT_ENABLED",
"xmlCleanupPredefinedEntities": "LIBXML_LEGACY_ENABLED",
"xmlInitializePredefinedEntities": "LIBXML_LEGACY_ENABLED",
"xmlSetFeature": "LIBXML_LEGACY_ENABLED",
"xmlGetFeature": "LIBXML_LEGACY_ENABLED",
"xmlGetFeaturesList": "LIBXML_LEGACY_ENABLED",
"xmlIOParseDTD": "LIBXML_VALID_ENABLED",
"xmlParseDTD": "LIBXML_VALID_ENABLED",
"xmlParseDoc": "LIBXML_SAX1_ENABLED",
"xmlParseMemory": "LIBXML_SAX1_ENABLED",
"xmlRecoverDoc": "LIBXML_SAX1_ENABLED",
"xmlParseFile": "LIBXML_SAX1_ENABLED",
"xmlRecoverFile": "LIBXML_SAX1_ENABLED",
"xmlRecoverMemory": "LIBXML_SAX1_ENABLED",
"xmlSAXParseFileWithData": "LIBXML_SAX1_ENABLED",
"xmlSAXParseMemory": "LIBXML_SAX1_ENABLED",
"xmlSAXUserParseMemory": "LIBXML_SAX1_ENABLED",
"xmlSAXParseDoc": "LIBXML_SAX1_ENABLED",
"xmlSAXParseDTD": "LIBXML_SAX1_ENABLED",
"xmlSAXUserParseFile": "LIBXML_SAX1_ENABLED",
"xmlParseEntity": "LIBXML_SAX1_ENABLED",
"xmlParseExternalEntity": "LIBXML_SAX1_ENABLED",
"xmlSAXParseMemoryWithData": "LIBXML_SAX1_ENABLED",
"xmlParseBalancedChunkMemory": "LIBXML_SAX1_ENABLED",
"xmlParseBalancedChunkMemoryRecover": "LIBXML_SAX1_ENABLED",
"xmlSetupParserForBuffer": "LIBXML_SAX1_ENABLED",
"xmlStopParser": "LIBXML_PUSH_ENABLED",
"xmlAttrSerializeTxtContent": "LIBXML_OUTPUT_ENABLED",
"xmlSAXParseFile": "LIBXML_SAX1_ENABLED",
"xmlSAXParseEntity": "LIBXML_SAX1_ENABLED",
"xmlNewTextChild": "LIBXML_TREE_ENABLED",
"xmlNewDocRawNode": "LIBXML_TREE_ENABLED",
"xmlNewProp": "LIBXML_TREE_ENABLED",
"xmlReconciliateNs": "LIBXML_TREE_ENABLED",
"xmlValidateNCName": "LIBXML_TREE_ENABLED",
"xmlValidateNMToken": "LIBXML_TREE_ENABLED",
"xmlValidateName": "LIBXML_TREE_ENABLED",
"xmlNewChild": "LIBXML_TREE_ENABLED",
"xmlValidateQName": "LIBXML_TREE_ENABLED",
"xmlSprintfElementContent": "LIBXML_OUTPUT_ENABLED",
"xmlValidGetPotentialChildren" : "LIBXML_VALID_ENABLED",
"xmlValidGetValidElements" : "LIBXML_VALID_ENABLED",
"docbDefaultSAXHandlerInit" : "LIBXML_DOCB_ENABLED",
"xmlTextReaderPreservePattern" : "LIBXML_PATTERN_ENABLED",
}
#
# Some functions really need to be skipped for the tests.
#
skipped_functions = [
# block on I/O
"xmlFdRead", "xmlReadFd", "xmlCtxtReadFd",
"htmlFdRead", "htmlReadFd", "htmlCtxtReadFd",
"xmlReaderNewFd", "xmlReaderForFd",
"xmlIORead", "xmlReadIO", "xmlCtxtReadIO",
"htmlIORead", "htmlReadIO", "htmlCtxtReadIO",
"xmlReaderNewIO", "xmlBufferDump", "xmlNanoFTPConnect",
"xmlNanoFTPConnectTo", "xmlNanoHTTPMethod", "xmlNanoHTTPMethodRedir",
# Complex I/O APIs
"xmlCreateIOParserCtxt", "xmlParserInputBufferCreateIO",
"xmlRegisterInputCallbacks", "xmlReaderForIO",
"xmlOutputBufferCreateIO", "xmlRegisterOutputCallbacks",
"xmlSaveToIO", "xmlIOHTTPOpenW",
# library state cleanup, generate false leak informations and other
# troubles, heavillyb tested otherwise.
"xmlCleanupParser", "xmlRelaxNGCleanupTypes", "xmlSetListDoc",
"xmlSetTreeDoc", "xmlUnlinkNode",
# hard to avoid leaks in the tests
"xmlStrcat", "xmlStrncat", "xmlCatalogAddLocal", "xmlNewTextWriterDoc",
"xmlXPathNewValueTree", "xmlXPathWrapString",
# unimplemented
"xmlTextReaderReadInnerXml", "xmlTextReaderReadOuterXml",
"xmlTextReaderReadString",
# destructor
"xmlListDelete", "xmlOutputBufferClose", "xmlNanoFTPClose", "xmlNanoHTTPClose",
# deprecated
"xmlCatalogGetPublic", "xmlCatalogGetSystem", "xmlEncodeEntities",
"xmlNewGlobalNs", "xmlHandleEntity", "xmlNamespaceParseNCName",
"xmlNamespaceParseNSDef", "xmlNamespaceParseQName",
"xmlParseNamespace", "xmlParseQuotedString", "xmlParserHandleReference",
"xmlScanName",
"xmlDecodeEntities",
# allocators
"xmlMemFree",
# verbosity
"xmlCatalogSetDebug", "xmlShellPrintXPathError", "xmlShellPrintNode",
# Internal functions, no user space should really call them
"xmlParseAttribute", "xmlParseAttributeListDecl", "xmlParseName",
"xmlParseNmtoken", "xmlParseEntityValue", "xmlParseAttValue",
"xmlParseSystemLiteral", "xmlParsePubidLiteral", "xmlParseCharData",
"xmlParseExternalID", "xmlParseComment", "xmlParsePITarget", "xmlParsePI",
"xmlParseNotationDecl", "xmlParseEntityDecl", "xmlParseDefaultDecl",
"xmlParseNotationType", "xmlParseEnumerationType", "xmlParseEnumeratedType",
"xmlParseAttributeType", "xmlParseAttributeListDecl",
"xmlParseElementMixedContentDecl", "xmlParseElementChildrenContentDecl",
"xmlParseElementContentDecl", "xmlParseElementDecl", "xmlParseMarkupDecl",
"xmlParseCharRef", "xmlParseEntityRef", "xmlParseReference",
"xmlParsePEReference", "xmlParseDocTypeDecl", "xmlParseAttribute",
"xmlParseStartTag", "xmlParseEndTag", "xmlParseCDSect", "xmlParseContent",
"xmlParseElement", "xmlParseVersionNum", "xmlParseVersionInfo",
"xmlParseEncName", "xmlParseEncodingDecl", "xmlParseSDDecl",
"xmlParseXMLDecl", "xmlParseTextDecl", "xmlParseMisc",
"xmlParseExternalSubset", "xmlParserHandlePEReference",
"xmlSkipBlankChars",
]
#
# These functions have side effects on the global state
# and hence generate errors on memory allocation tests
#
skipped_memcheck = [ "xmlLoadCatalog", "xmlAddEncodingAlias",
"xmlSchemaInitTypes", "xmlNanoFTPProxy", "xmlNanoFTPScanProxy",
"xmlNanoHTTPScanProxy", "xmlResetLastError", "xmlCatalogConvert",
"xmlCatalogRemove", "xmlLoadCatalogs", "xmlCleanupCharEncodingHandlers",
"xmlInitCharEncodingHandlers", "xmlCatalogCleanup",
"xmlSchemaGetBuiltInType",
"htmlParseFile", "htmlCtxtReadFile", # loads the catalogs
"xmlTextReaderSchemaValidate", "xmlSchemaCleanupTypes", # initialize the schemas type system
"xmlCatalogResolve", "xmlIOParseDTD" # loads the catalogs
]
#
# Extra code needed for some test cases
#
extra_pre_call = {
"xmlSAXUserParseFile": """
#ifdef LIBXML_SAX1_ENABLED
if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
#endif
""",
"xmlSAXUserParseMemory": """
#ifdef LIBXML_SAX1_ENABLED
if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
#endif
""",
"xmlParseBalancedChunkMemory": """
#ifdef LIBXML_SAX1_ENABLED
if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
#endif
""",
"xmlParseBalancedChunkMemoryRecover": """
#ifdef LIBXML_SAX1_ENABLED
if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
#endif
""",
"xmlParserInputBufferCreateFd":
"if (fd >= 0) fd = -1;",
}
extra_post_call = {
"xmlAddChild":
"if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }",
"xmlAddEntity":
"if (ret_val != NULL) { xmlFreeNode(ret_val) ; ret_val = NULL; }",
"xmlAddChildList":
"if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }",
"xmlAddSibling":
"if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }",
"xmlAddNextSibling":
"if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }",
"xmlAddPrevSibling":
"if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }",
"xmlDocSetRootElement":
"if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }",
"xmlReplaceNode":
"""if (cur != NULL) {
xmlUnlinkNode(cur);
xmlFreeNode(cur) ; cur = NULL ; }
if (old != NULL) {
xmlUnlinkNode(old);
xmlFreeNode(old) ; old = NULL ; }
ret_val = NULL;""",
"xmlTextMerge":
"""if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
xmlUnlinkNode(second);
xmlFreeNode(second) ; second = NULL ; }""",
"xmlBuildQName":
"""if ((ret_val != NULL) && (ret_val != ncname) &&
(ret_val != prefix) && (ret_val != memory))
xmlFree(ret_val);
ret_val = NULL;""",
"xmlNewDocElementContent":
"""xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""",
"xmlDictReference": "xmlDictFree(dict);",
# Functions which deallocates one of their parameters
"xmlXPathConvertBoolean": """val = NULL;""",
"xmlXPathConvertNumber": """val = NULL;""",
"xmlXPathConvertString": """val = NULL;""",
"xmlSaveFileTo": """buf = NULL;""",
"xmlSaveFormatFileTo": """buf = NULL;""",
"xmlIOParseDTD": "input = NULL;",
"xmlRemoveProp": "cur = NULL;",
"xmlNewNs": "if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);",
"xmlCopyNamespace": "if (ret_val != NULL) xmlFreeNs(ret_val);",
"xmlCopyNamespaceList": "if (ret_val != NULL) xmlFreeNsList(ret_val);",
"xmlNewTextWriter": "if (ret_val != NULL) out = NULL;",
"xmlNewTextWriterPushParser": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;",
"xmlNewIOInputStream": "if (ret_val != NULL) input = NULL;",
"htmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}",
"htmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}",
"xmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}",
"xmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}",
"xmlParseExtParsedEnt": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}",
"xmlDOMWrapAdoptNode": "if ((node != NULL) && (node->parent == NULL)) {xmlUnlinkNode(node);xmlFreeNode(node);node = NULL;}",
"xmlBufferSetAllocationScheme": "if ((buf != NULL) && (scheme == XML_BUFFER_ALLOC_IMMUTABLE) && (buf->content != NULL) && (buf->content != static_buf_content)) { xmlFree(buf->content); buf->content = NULL;}"
}
modules = []
def is_skipped_module(name):
for mod in skipped_modules:
if mod == name:
return 1
return 0
def is_skipped_function(name):
for fun in skipped_functions:
if fun == name:
return 1
# Do not test destructors
if string.find(name, 'Free') != -1:
return 1
return 0
def is_skipped_memcheck(name):
for fun in skipped_memcheck:
if fun == name:
return 1
return 0
missing_types = {}
def add_missing_type(name, func):
try:
list = missing_types[name]
list.append(func)
except:
missing_types[name] = [func]
generated_param_types = []
def add_generated_param_type(name):
generated_param_types.append(name)
generated_return_types = []
def add_generated_return_type(name):
generated_return_types.append(name)
missing_functions = {}
missing_functions_nr = 0
def add_missing_functions(name, module):
global missing_functions_nr
missing_functions_nr = missing_functions_nr + 1
try:
list = missing_functions[module]
list.append(name)
except:
missing_functions[module] = [name]
#
# Provide the type generators and destructors for the parameters
#
def type_convert(str, name, info, module, function, pos):
# res = string.replace(str, " ", " ")
# res = string.replace(str, " ", " ")
# res = string.replace(str, " ", " ")
res = string.replace(str, " *", "_ptr")
# res = string.replace(str, "*", "_ptr")
res = string.replace(res, " ", "_")
if res == 'const_char_ptr':
if string.find(name, "file") != -1 or \
string.find(name, "uri") != -1 or \
string.find(name, "URI") != -1 or \
string.find(info, "filename") != -1 or \
string.find(info, "URI") != -1 or \
string.find(info, "URL") != -1:
if string.find(function, "Save") != -1 or \
string.find(function, "Create") != -1 or \
string.find(function, "Write") != -1 or \
string.find(function, "Fetch") != -1:
return('fileoutput')
return('filepath')
if res == 'void_ptr':
if module == 'nanoftp' and name == 'ctx':
return('xmlNanoFTPCtxtPtr')
if function == 'xmlNanoFTPNewCtxt' or \
function == 'xmlNanoFTPConnectTo' or \
function == 'xmlNanoFTPOpen':
return('xmlNanoFTPCtxtPtr')
if module == 'nanohttp' and name == 'ctx':
return('xmlNanoHTTPCtxtPtr')
if function == 'xmlNanoHTTPMethod' or \
function == 'xmlNanoHTTPMethodRedir' or \
function == 'xmlNanoHTTPOpen' or \
function == 'xmlNanoHTTPOpenRedir':
return('xmlNanoHTTPCtxtPtr');
if function == 'xmlIOHTTPOpen':
return('xmlNanoHTTPCtxtPtr')
if string.find(name, "data") != -1:
return('userdata')
if string.find(name, "user") != -1:
return('userdata')
if res == 'xmlDoc_ptr':
res = 'xmlDocPtr'
if res == 'xmlNode_ptr':
res = 'xmlNodePtr'
if res == 'xmlDict_ptr':
res = 'xmlDictPtr'
if res == 'xmlNodePtr' and pos != 0:
if (function == 'xmlAddChild' and pos == 2) or \
(function == 'xmlAddChildList' and pos == 2) or \
(function == 'xmlAddNextSibling' and pos == 2) or \
(function == 'xmlAddSibling' and pos == 2) or \
(function == 'xmlDocSetRootElement' and pos == 2) or \
(function == 'xmlReplaceNode' and pos == 2) or \
(function == 'xmlTextMerge') or \
(function == 'xmlAddPrevSibling' and pos == 2):
return('xmlNodePtr_in');
if res == 'const xmlBufferPtr':
res = 'xmlBufferPtr'
if res == 'xmlChar_ptr' and name == 'name' and \
string.find(function, "EatName") != -1:
return('eaten_name')
if res == 'void_ptr*':
res = 'void_ptr_ptr'
if res == 'char_ptr*':
res = 'char_ptr_ptr'
if res == 'xmlChar_ptr*':
res = 'xmlChar_ptr_ptr'
if res == 'const_xmlChar_ptr*':
res = 'const_xmlChar_ptr_ptr'
if res == 'const_char_ptr*':
res = 'const_char_ptr_ptr'
if res == 'FILE_ptr' and module == 'debugXML':
res = 'debug_FILE_ptr';
if res == 'int' and name == 'options':
if module == 'parser' or module == 'xmlreader':
res = 'parseroptions'
return res
known_param_types = []
def is_known_param_type(name, rtype):
global test
for type in known_param_types:
if type == name:
return 1
for type in generated_param_types:
if type == name:
return 1
if name[-3:] == 'Ptr' or name[-4:] == '_ptr':
if rtype[0:6] == 'const ':
crtype = rtype[6:]
else:
crtype = rtype
define = 0
if modules_defines.has_key(module):
test.write("#ifdef %s\n" % (modules_defines[module]))
define = 1
test.write("""
#define gen_nb_%s 1
static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
""" % (name, crtype, name, name, rtype))
if define == 1:
test.write("#endif\n\n")
add_generated_param_type(name)
return 1
return 0
#
# Provide the type destructors for the return values
#
known_return_types = []
def is_known_return_type(name):
for type in known_return_types:
if type == name:
return 1
return 0
#
# Copy the beginning of the C test program result
#
try:
input = open("testapi.c", "r")
except:
input = open(srcPref + "testapi.c", "r")
test = open('testapi.c.new', 'w')
def compare_and_save():
global test
test.close()
try:
input = open("testapi.c", "r").read()
except:
input = ''
test = open('testapi.c.new', "r").read()
if input != test:
try:
os.system("rm testapi.c; mv testapi.c.new testapi.c")
except:
os.system("mv testapi.c.new testapi.c")
print("Updated testapi.c")
else:
print("Generated testapi.c is identical")
line = input.readline()
while line != "":
if line == "/* CUT HERE: everything below that line is generated */\n":
break;
if line[0:15] == "#define gen_nb_":
type = string.split(line[15:])[0]
known_param_types.append(type)
if line[0:19] == "static void desret_":
type = string.split(line[19:], '(')[0]
known_return_types.append(type)
test.write(line)
line = input.readline()
input.close()
if line == "":
print "Could not find the CUT marker in testapi.c skipping generation"
test.close()
sys.exit(0)
print("Scanned testapi.c: found %d parameters types and %d return types\n" % (
len(known_param_types), len(known_return_types)))
test.write("/* CUT HERE: everything below that line is generated */\n")
#
# Open the input API description
#
doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0)
if doc == None:
print "Failed to load doc/libxml2-api.xml"
sys.exit(1)
ctxt = doc.xpathNewContext()
#
# Generate a list of all function parameters and select only
# those used in the api tests
#
argtypes = {}
args = ctxt.xpathEval("/api/symbols/function/arg")
for arg in args:
mod = arg.xpathEval('string(../@file)')
func = arg.xpathEval('string(../@name)')
if (mod not in skipped_modules) and (func not in skipped_functions):
type = arg.xpathEval('string(@type)')
if not argtypes.has_key(type):
argtypes[type] = func
# similarly for return types
rettypes = {}
rets = ctxt.xpathEval("/api/symbols/function/return")
for ret in rets:
mod = ret.xpathEval('string(../@file)')
func = ret.xpathEval('string(../@name)')
if (mod not in skipped_modules) and (func not in skipped_functions):
type = ret.xpathEval('string(@type)')
if not rettypes.has_key(type):
rettypes[type] = func
#
# Generate constructors and return type handling for all enums
# which are used as function parameters
#
enums = ctxt.xpathEval("/api/symbols/typedef[@type='enum']")
for enum in enums:
module = enum.xpathEval('string(@file)')
name = enum.xpathEval('string(@name)')
#
# Skip any enums which are not in our filtered lists
#
if (name == None) or ((name not in argtypes) and (name not in rettypes)):
continue;
define = 0
if argtypes.has_key(name) and is_known_param_type(name, name) == 0:
values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name)
i = 0
vals = []
for value in values:
vname = value.xpathEval('string(@name)')
if vname == None:
continue;
i = i + 1
if i >= 5:
break;
vals.append(vname)
if vals == []:
print "Didn't find any value for enum %s" % (name)
continue
if modules_defines.has_key(module):
test.write("#ifdef %s\n" % (modules_defines[module]))
define = 1
test.write("#define gen_nb_%s %d\n" % (name, len(vals)))
test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" %
(name, name))
i = 1
for value in vals:
test.write(" if (no == %d) return(%s);\n" % (i, value))
i = i + 1
test.write(""" return(0);
}
static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
""" % (name, name));
known_param_types.append(name)
if (is_known_return_type(name) == 0) and (name in rettypes):
if define == 0 and modules_defines.has_key(module):
test.write("#ifdef %s\n" % (modules_defines[module]))
define = 1
test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) {
}
""" % (name, name))
known_return_types.append(name)
if define == 1:
test.write("#endif\n\n")
#
# Load the interfaces
#
headers = ctxt.xpathEval("/api/files/file")
for file in headers:
name = file.xpathEval('string(@name)')
if (name == None) or (name == ''):
continue
#
# Some module may be skipped because they don't really consists
# of user callable APIs
#
if is_skipped_module(name):
continue
#
# do not test deprecated APIs
#
desc = file.xpathEval('string(description)')
if string.find(desc, 'DEPRECATED') != -1:
print "Skipping deprecated interface %s" % name
continue;
test.write("#include <libxml/%s.h>\n" % name)
modules.append(name)
#
# Generate the callers signatures
#
for module in modules:
test.write("static int test_%s(void);\n" % module);
#
# Generate the top caller
#
test.write("""
/**
* testlibxml2:
*
* Main entry point of the tester for the full libxml2 module,
* it calls all the tester entry point for each module.
*
* Returns the number of error found
*/
static int
testlibxml2(void)
{
int test_ret = 0;
""")
for module in modules:
test.write(" test_ret += test_%s();\n" % module)
test.write("""
printf("Total: %d functions, %d tests, %d errors\\n",
function_tests, call_tests, test_ret);
return(test_ret);
}
""")
#
# How to handle a function
#
nb_tests = 0
def generate_test(module, node):
global test
global nb_tests
nb_cond = 0
no_gen = 0
name = node.xpathEval('string(@name)')
if is_skipped_function(name):
return
#
# check we know how to handle the args and return values
# and store the informations for the generation
#
try:
args = node.xpathEval("arg")
except:
args = []
t_args = []
n = 0
for arg in args:
n = n + 1
rtype = arg.xpathEval("string(@type)")
if rtype == 'void':
break;
info = arg.xpathEval("string(@info)")
nam = arg.xpathEval("string(@name)")
type = type_convert(rtype, nam, info, module, name, n)
if is_known_param_type(type, rtype) == 0:
add_missing_type(type, name);
no_gen = 1
if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
rtype[0:6] == 'const ':
crtype = rtype[6:]
else:
crtype = rtype
t_args.append((nam, type, rtype, crtype, info))
try:
rets = node.xpathEval("return")
except:
rets = []
t_ret = None
for ret in rets:
rtype = ret.xpathEval("string(@type)")
info = ret.xpathEval("string(@info)")
type = type_convert(rtype, 'return', info, module, name, 0)
if rtype == 'void':
break
if is_known_return_type(type) == 0:
add_missing_type(type, name);
no_gen = 1
t_ret = (type, rtype, info)
break
test.write("""
static int
test_%s(void) {
int test_ret = 0;
""" % (name))
if no_gen == 1:
add_missing_functions(name, module)
test.write("""
/* missing type support */
return(test_ret);
}
""")
return
try:
conds = node.xpathEval("cond")
for cond in conds:
test.write("#if %s\n" % (cond.get_content()))
nb_cond = nb_cond + 1
except:
pass
define = 0
if function_defines.has_key(name):
test.write("#ifdef %s\n" % (function_defines[name]))
define = 1
# Declare the memory usage counter
no_mem = is_skipped_memcheck(name)
if no_mem == 0:
test.write(" int mem_base;\n");
# Declare the return value
if t_ret != None:
test.write(" %s ret_val;\n" % (t_ret[1]))
# Declare the arguments
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
# add declaration
test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
test.write(" int n_%s;\n" % (nam))
test.write("\n")
# Cascade loop on of each argument list of values
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
#
test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
nam, nam, type, nam))
# log the memory usage
if no_mem == 0:
test.write(" mem_base = xmlMemBlocks();\n");
# prepare the call
i = 0;
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
#
test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
i = i + 1;
# do the call, and clanup the result
if extra_pre_call.has_key(name):
test.write(" %s\n"% (extra_pre_call[name]))
if t_ret != None:
test.write("\n ret_val = %s(" % (name))
need = 0
for arg in t_args:
(nam, type, rtype, crtype, info) = arg
if need:
test.write(", ")
else:
need = 1
if rtype != crtype:
test.write("(%s)" % rtype)
test.write("%s" % nam);
test.write(");\n")
if extra_post_call.has_key(name):
test.write(" %s\n"% (extra_post_call[name]))
test.write(" desret_%s(ret_val);\n" % t_ret[0])
else:
test.write("\n %s(" % (name));
need = 0;
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
if need:
test.write(", ")
else:
need = 1
if rtype != crtype:
test.write("(%s)" % rtype)
test.write("%s" % nam)
test.write(");\n")
if extra_post_call.has_key(name):
test.write(" %s\n"% (extra_post_call[name]))
test.write(" call_tests++;\n");
# Free the arguments
i = 0;
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
# This is a hack to prevent generating a destructor for the
# 'input' argument in xmlTextReaderSetup. There should be
# a better, more generic way to do this!
if string.find(info, 'destroy') == -1:
test.write(" des_%s(n_%s, " % (type, nam))
if rtype != crtype:
test.write("(%s)" % rtype)
test.write("%s, %d);\n" % (nam, i))
i = i + 1;
test.write(" xmlResetLastError();\n");
# Check the memory usage
if no_mem == 0:
test.write(""" if (mem_base != xmlMemBlocks()) {
printf("Leak of %%d blocks found in %s",
xmlMemBlocks() - mem_base);
test_ret++;
""" % (name));
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
test.write(""" printf(" %%d", n_%s);\n""" % (nam))
test.write(""" printf("\\n");\n""")
test.write(" }\n")
for arg in t_args:
test.write(" }\n")
test.write(" function_tests++;\n")
#
# end of conditional
#
while nb_cond > 0:
test.write("#endif\n")
nb_cond = nb_cond -1
if define == 1:
test.write("#endif\n")
nb_tests = nb_tests + 1;
test.write("""
return(test_ret);
}
""")
#
# Generate all module callers
#
for module in modules:
# gather all the functions exported by that module
try:
functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module))
except:
print "Failed to gather functions from module %s" % (module)
continue;
# iterate over all functions in the module generating the test
i = 0
nb_tests_old = nb_tests
for function in functions:
i = i + 1
generate_test(module, function);
# header
test.write("""static int
test_%s(void) {
int test_ret = 0;
if (quiet == 0) printf("Testing %s : %d of %d functions ...\\n");
""" % (module, module, nb_tests - nb_tests_old, i))
# iterate over all functions in the module generating the call
for function in functions:
name = function.xpathEval('string(@name)')
if is_skipped_function(name):
continue
test.write(" test_ret += test_%s();\n" % (name))
# footer
test.write("""
if (test_ret != 0)
printf("Module %s: %%d errors\\n", test_ret);
return(test_ret);
}
""" % (module))
#
# Generate direct module caller
#
test.write("""static int
test_module(const char *module) {
""");
for module in modules:
test.write(""" if (!strcmp(module, "%s")) return(test_%s());\n""" % (
module, module))
test.write(""" return(0);
}
""");
print "Generated test for %d modules and %d functions" %(len(modules), nb_tests)
compare_and_save()
missing_list = []
for missing in missing_types.keys():
if missing == 'va_list' or missing == '...':
continue;
n = len(missing_types[missing])
missing_list.append((n, missing))
def compare_missing(a, b):
return b[0] - a[0]
missing_list.sort(compare_missing)
print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list))
lst = open("missing.lst", "w")
lst.write("Missing support for %d types" % (len(missing_list)))
lst.write("\n")
for miss in missing_list:
lst.write("%s: %d :" % (miss[1], miss[0]))
i = 0
for n in missing_types[miss[1]]:
i = i + 1
if i > 5:
lst.write(" ...")
break
lst.write(" %s" % (n))
lst.write("\n")
lst.write("\n")
lst.write("\n")
lst.write("Missing support per module");
for module in missing_functions.keys():
lst.write("module %s:\n %s\n" % (module, missing_functions[module]))
lst.close()

1133
third_party/libxml/src/globals.c vendored Normal file

File diff suppressed because it is too large Load Diff

1089
third_party/libxml/src/hash.c vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
/*
* Summary: old DocBook SGML parser
* Description: interface for a DocBook SGML non-verifying parser
* This code is DEPRECATED, and should not be used anymore.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DOCB_PARSER_H__
#define __DOCB_PARSER_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_DOCB_ENABLED
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#ifndef IN_LIBXML
#ifdef __GNUC__
#warning "The DOCBparser module has been deprecated in libxml2-2.6.0"
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Most of the back-end structures from XML and SGML are shared.
*/
typedef xmlParserCtxt docbParserCtxt;
typedef xmlParserCtxtPtr docbParserCtxtPtr;
typedef xmlSAXHandler docbSAXHandler;
typedef xmlSAXHandlerPtr docbSAXHandlerPtr;
typedef xmlParserInput docbParserInput;
typedef xmlParserInputPtr docbParserInputPtr;
typedef xmlDocPtr docbDocPtr;
/*
* There is only few public functions.
*/
XMLPUBFUN int XMLCALL
docbEncodeEntities(unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen, int quoteChar);
XMLPUBFUN docbDocPtr XMLCALL
docbSAXParseDoc (xmlChar *cur,
const char *encoding,
docbSAXHandlerPtr sax,
void *userData);
XMLPUBFUN docbDocPtr XMLCALL
docbParseDoc (xmlChar *cur,
const char *encoding);
XMLPUBFUN docbDocPtr XMLCALL
docbSAXParseFile (const char *filename,
const char *encoding,
docbSAXHandlerPtr sax,
void *userData);
XMLPUBFUN docbDocPtr XMLCALL
docbParseFile (const char *filename,
const char *encoding);
/**
* Interfaces for the Push mode.
*/
XMLPUBFUN void XMLCALL
docbFreeParserCtxt (docbParserCtxtPtr ctxt);
XMLPUBFUN docbParserCtxtPtr XMLCALL
docbCreatePushParserCtxt(docbSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
docbParseChunk (docbParserCtxtPtr ctxt,
const char *chunk,
int size,
int terminate);
XMLPUBFUN docbParserCtxtPtr XMLCALL
docbCreateFileParserCtxt(const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
docbParseDocument (docbParserCtxtPtr ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_DOCB_ENABLED */
#endif /* __DOCB_PARSER_H__ */

View File

@ -0,0 +1,304 @@
/*
* Summary: interface for an HTML 4.0 non-verifying parser
* Description: this module implements an HTML 4.0 non-verifying parser
* with API compatible with the XML parser ones. It should
* be able to parse "real world" HTML, even if severely
* broken from a specification point of view.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __HTML_PARSER_H__
#define __HTML_PARSER_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#ifdef LIBXML_HTML_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/*
* Most of the back-end structures from XML and HTML are shared.
*/
typedef xmlParserCtxt htmlParserCtxt;
typedef xmlParserCtxtPtr htmlParserCtxtPtr;
typedef xmlParserNodeInfo htmlParserNodeInfo;
typedef xmlSAXHandler htmlSAXHandler;
typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
typedef xmlParserInput htmlParserInput;
typedef xmlParserInputPtr htmlParserInputPtr;
typedef xmlDocPtr htmlDocPtr;
typedef xmlNodePtr htmlNodePtr;
/*
* Internal description of an HTML element, representing HTML 4.01
* and XHTML 1.0 (which share the same structure).
*/
typedef struct _htmlElemDesc htmlElemDesc;
typedef htmlElemDesc *htmlElemDescPtr;
struct _htmlElemDesc {
const char *name; /* The tag name */
char startTag; /* Whether the start tag can be implied */
char endTag; /* Whether the end tag can be implied */
char saveEndTag; /* Whether the end tag should be saved */
char empty; /* Is this an empty element ? */
char depr; /* Is this a deprecated element ? */
char dtd; /* 1: only in Loose DTD, 2: only Frameset one */
char isinline; /* is this a block 0 or inline 1 element */
const char *desc; /* the description */
/* NRK Jan.2003
* New fields encapsulating HTML structure
*
* Bugs:
* This is a very limited representation. It fails to tell us when
* an element *requires* subelements (we only have whether they're
* allowed or not), and it doesn't tell us where CDATA and PCDATA
* are allowed. Some element relationships are not fully represented:
* these are flagged with the word MODIFIER
*/
const char** subelts; /* allowed sub-elements of this element */
const char* defaultsubelt; /* subelement for suggested auto-repair
if necessary or NULL */
const char** attrs_opt; /* Optional Attributes */
const char** attrs_depr; /* Additional deprecated attributes */
const char** attrs_req; /* Required attributes */
};
/*
* Internal description of an HTML entity.
*/
typedef struct _htmlEntityDesc htmlEntityDesc;
typedef htmlEntityDesc *htmlEntityDescPtr;
struct _htmlEntityDesc {
unsigned int value; /* the UNICODE value for the character */
const char *name; /* The entity name */
const char *desc; /* the description */
};
/*
* There is only few public functions.
*/
XMLPUBFUN const htmlElemDesc * XMLCALL
htmlTagLookup (const xmlChar *tag);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlEntityLookup(const xmlChar *name);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlEntityValueLookup(unsigned int value);
XMLPUBFUN int XMLCALL
htmlIsAutoClosed(htmlDocPtr doc,
htmlNodePtr elem);
XMLPUBFUN int XMLCALL
htmlAutoCloseTag(htmlDocPtr doc,
const xmlChar *name,
htmlNodePtr elem);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlParseEntityRef(htmlParserCtxtPtr ctxt,
const xmlChar **str);
XMLPUBFUN int XMLCALL
htmlParseCharRef(htmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
htmlParseElement(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlNewParserCtxt(void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN int XMLCALL
htmlParseDocument(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseDoc (xmlChar *cur,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseDoc (xmlChar *cur,
const char *encoding);
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseFile(const char *filename,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseFile (const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
UTF8ToHtml (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
XMLPUBFUN int XMLCALL
htmlEncodeEntities(unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen, int quoteChar);
XMLPUBFUN int XMLCALL
htmlIsScriptAttribute(const xmlChar *name);
XMLPUBFUN int XMLCALL
htmlHandleOmittedElem(int val);
#ifdef LIBXML_PUSH_ENABLED
/**
* Interfaces for the Push mode.
*/
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
htmlParseChunk (htmlParserCtxtPtr ctxt,
const char *chunk,
int size,
int terminate);
#endif /* LIBXML_PUSH_ENABLED */
XMLPUBFUN void XMLCALL
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
/*
* New set of simpler/more flexible APIs
*/
/**
* xmlParserOption:
*
* This is the set of XML parser options that can be passed down
* to the xmlReadDoc() and similar calls.
*/
typedef enum {
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
HTML_PARSE_NONET = 1<<11,/* Forbid network access */
HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */
HTML_PARSE_COMPACT = 1<<16 /* compact small text nodes */
} htmlParserOption;
XMLPUBFUN void XMLCALL
htmlCtxtReset (htmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
htmlCtxtUseOptions (htmlParserCtxtPtr ctxt,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadDoc (const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadFile (const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadFile (xmlParserCtxtPtr ctxt,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadIO (xmlParserCtxtPtr ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/* NRK/Jan2003: further knowledge of HTML structure
*/
typedef enum {
HTML_NA = 0 , /* something we don't check at all */
HTML_INVALID = 0x1 ,
HTML_DEPRECATED = 0x2 ,
HTML_VALID = 0x4 ,
HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */
} htmlStatus ;
/* Using htmlElemDesc rather than name here, to emphasise the fact
that otherwise there's a lookup overhead
*/
XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ;
/**
* htmlDefaultSubelement:
* @elt: HTML element
*
* Returns the default subelement for this element
*/
#define htmlDefaultSubelement(elt) elt->defaultsubelt
/**
* htmlElementAllowedHereDesc:
* @parent: HTML parent element
* @elt: HTML element
*
* Checks whether an HTML element description may be a
* direct child of the specified element.
*
* Returns 1 if allowed; 0 otherwise.
*/
#define htmlElementAllowedHereDesc(parent,elt) \
htmlElementAllowedHere((parent), (elt)->name)
/**
* htmlRequiredAttrs:
* @elt: HTML element
*
* Returns the attributes required for the specified element.
*/
#define htmlRequiredAttrs(elt) (elt)->attrs_req
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTML_ENABLED */
#endif /* __HTML_PARSER_H__ */

View File

@ -0,0 +1,147 @@
/*
* Summary: specific APIs to process HTML tree, especially serialization
* Description: this module implements a few function needed to process
* tree in an HTML specific way.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __HTML_TREE_H__
#define __HTML_TREE_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/HTMLparser.h>
#ifdef LIBXML_HTML_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* HTML_TEXT_NODE:
*
* Macro. A text node in a HTML document is really implemented
* the same way as a text node in an XML document.
*/
#define HTML_TEXT_NODE XML_TEXT_NODE
/**
* HTML_ENTITY_REF_NODE:
*
* Macro. An entity reference in a HTML document is really implemented
* the same way as an entity reference in an XML document.
*/
#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE
/**
* HTML_COMMENT_NODE:
*
* Macro. A comment in a HTML document is really implemented
* the same way as a comment in an XML document.
*/
#define HTML_COMMENT_NODE XML_COMMENT_NODE
/**
* HTML_PRESERVE_NODE:
*
* Macro. A preserved node in a HTML document is really implemented
* the same way as a CDATA section in an XML document.
*/
#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE
/**
* HTML_PI_NODE:
*
* Macro. A processing instruction in a HTML document is really implemented
* the same way as a processing instruction in an XML document.
*/
#define HTML_PI_NODE XML_PI_NODE
XMLPUBFUN htmlDocPtr XMLCALL
htmlNewDoc (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN htmlDocPtr XMLCALL
htmlNewDocNoDtD (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN const xmlChar * XMLCALL
htmlGetMetaEncoding (htmlDocPtr doc);
XMLPUBFUN int XMLCALL
htmlSetMetaEncoding (htmlDocPtr doc,
const xmlChar *encoding);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
htmlDocDumpMemory (xmlDocPtr cur,
xmlChar **mem,
int *size);
XMLPUBFUN void XMLCALL
htmlDocDumpMemoryFormat (xmlDocPtr cur,
xmlChar **mem,
int *size,
int format);
XMLPUBFUN int XMLCALL
htmlDocDump (FILE *f,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
htmlSaveFile (const char *filename,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
htmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN void XMLCALL
htmlNodeDumpFile (FILE *out,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN int XMLCALL
htmlNodeDumpFileFormat (FILE *out,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding,
int format);
XMLPUBFUN int XMLCALL
htmlSaveFileEnc (const char *filename,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN int XMLCALL
htmlSaveFileFormat (const char *filename,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN void XMLCALL
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
htmlIsBooleanAttr (const xmlChar *name);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTML_ENABLED */
#endif /* __HTML_TREE_H__ */

View File

@ -0,0 +1,173 @@
/*
* Summary: Old SAX version 1 handler, deprecated
* Description: DEPRECATED set of SAX version 1 interfaces used to
* build the DOM tree.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SAX_H__
#define __XML_SAX_H__
#include <stdio.h>
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xlink.h>
#ifdef LIBXML_LEGACY_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN const xmlChar * XMLCALL
getPublicId (void *ctx);
XMLPUBFUN const xmlChar * XMLCALL
getSystemId (void *ctx);
XMLPUBFUN void XMLCALL
setDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc);
XMLPUBFUN int XMLCALL
getLineNumber (void *ctx);
XMLPUBFUN int XMLCALL
getColumnNumber (void *ctx);
XMLPUBFUN int XMLCALL
isStandalone (void *ctx);
XMLPUBFUN int XMLCALL
hasInternalSubset (void *ctx);
XMLPUBFUN int XMLCALL
hasExternalSubset (void *ctx);
XMLPUBFUN void XMLCALL
internalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN void XMLCALL
externalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlEntityPtr XMLCALL
getEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
getParameterEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlParserInputPtr XMLCALL
resolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
entityDecl (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
XMLPUBFUN void XMLCALL
attributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
XMLPUBFUN void XMLCALL
elementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
notationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
unparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
XMLPUBFUN void XMLCALL
startDocument (void *ctx);
XMLPUBFUN void XMLCALL
endDocument (void *ctx);
XMLPUBFUN void XMLCALL
attribute (void *ctx,
const xmlChar *fullname,
const xmlChar *value);
XMLPUBFUN void XMLCALL
startElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XMLPUBFUN void XMLCALL
endElement (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
reference (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
characters (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
ignorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
processingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XMLPUBFUN void XMLCALL
globalNamespace (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
setNamespace (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlNsPtr XMLCALL
getNamespace (void *ctx);
XMLPUBFUN int XMLCALL
checkNamespace (void *ctx,
xmlChar *nameSpace);
XMLPUBFUN void XMLCALL
namespaceDecl (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
comment (void *ctx,
const xmlChar *value);
XMLPUBFUN void XMLCALL
cdataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN void XMLCALL
initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN void XMLCALL
initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif
#endif /* LIBXML_SAX1_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_LEGACY_ENABLED */
#endif /* __XML_SAX_H__ */

View File

@ -0,0 +1,176 @@
/*
* Summary: SAX2 parser interface used to build the DOM tree
* Description: those are the default SAX2 interfaces used by
* the library when building DOM tree.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SAX2_H__
#define __XML_SAX2_H__
#include <stdio.h>
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xlink.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN const xmlChar * XMLCALL
xmlSAX2GetPublicId (void *ctx);
XMLPUBFUN const xmlChar * XMLCALL
xmlSAX2GetSystemId (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2SetDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc);
XMLPUBFUN int XMLCALL
xmlSAX2GetLineNumber (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2GetColumnNumber (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2IsStandalone (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2HasInternalSubset (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2HasExternalSubset (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2InternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN void XMLCALL
xmlSAX2ExternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlSAX2GetEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlSAX2GetParameterEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlSAX2ResolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
xmlSAX2EntityDecl (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
XMLPUBFUN void XMLCALL
xmlSAX2AttributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
XMLPUBFUN void XMLCALL
xmlSAX2ElementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlSAX2NotationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
xmlSAX2UnparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
XMLPUBFUN void XMLCALL
xmlSAX2StartDocument (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2EndDocument (void *ctx);
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
XMLPUBFUN void XMLCALL
xmlSAX2StartElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XMLPUBFUN void XMLCALL
xmlSAX2EndElement (void *ctx,
const xmlChar *name);
#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */
XMLPUBFUN void XMLCALL
xmlSAX2StartElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI,
int nb_namespaces,
const xmlChar **namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar **attributes);
XMLPUBFUN void XMLCALL
xmlSAX2EndElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI);
XMLPUBFUN void XMLCALL
xmlSAX2Reference (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlSAX2Characters (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
xmlSAX2IgnorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
xmlSAX2ProcessingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XMLPUBFUN void XMLCALL
xmlSAX2Comment (void *ctx,
const xmlChar *value);
XMLPUBFUN void XMLCALL
xmlSAX2CDataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
xmlSAXDefaultVersion (int version);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int XMLCALL
xmlSAXVersion (xmlSAXHandler *hdlr,
int version);
XMLPUBFUN void XMLCALL
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
XMLPUBFUN void XMLCALL
htmlDefaultSAXHandlerInit (void);
#endif
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN void XMLCALL
xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr);
XMLPUBFUN void XMLCALL
docbDefaultSAXHandlerInit (void);
#endif
XMLPUBFUN void XMLCALL
xmlDefaultSAXHandlerInit (void);
#ifdef __cplusplus
}
#endif
#endif /* __XML_SAX2_H__ */

View File

@ -0,0 +1,126 @@
/*
* Summary: Provide Canonical XML and Exclusive XML Canonicalization
* Description: the c14n modules provides a
*
* "Canonical XML" implementation
* http://www.w3.org/TR/xml-c14n
*
* and an
*
* "Exclusive XML Canonicalization" implementation
* http://www.w3.org/TR/xml-exc-c14n
* Copy: See Copyright for the status of this software.
*
* Author: Aleksey Sanin <aleksey@aleksey.com>
*/
#ifndef __XML_C14N_H__
#define __XML_C14N_H__
#ifdef LIBXML_C14N_ENABLED
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
/*
* XML Canonicazation
* http://www.w3.org/TR/xml-c14n
*
* Exclusive XML Canonicazation
* http://www.w3.org/TR/xml-exc-c14n
*
* Canonical form of an XML document could be created if and only if
* a) default attributes (if any) are added to all nodes
* b) all character and parsed entity references are resolved
* In order to achive this in libxml2 the document MUST be loaded with
* following global setings:
*
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
* xmlSubstituteEntitiesDefault(1);
*
* or corresponding parser context setting:
* xmlParserCtxtPtr ctxt;
*
* ...
* ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
* ctxt->replaceEntities = 1;
* ...
*/
/*
* xmlC14NMode:
*
* Predefined values for C14N modes
*
*/
typedef enum {
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
XML_C14N_1_1 = 2 /* C14N 1.1 spec */
} xmlC14NMode;
XMLPUBFUN int XMLCALL
xmlC14NDocSaveTo (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf);
XMLPUBFUN int XMLCALL
xmlC14NDocDumpMemory (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlChar **doc_txt_ptr);
XMLPUBFUN int XMLCALL
xmlC14NDocSave (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
const char* filename,
int compression);
/**
* This is the core C14N function
*/
/**
* xmlC14NIsVisibleCallback:
* @user_data: user data
* @node: the curent node
* @parent: the parent node
*
* Signature for a C14N callback on visible nodes
*
* Returns 1 if the node should be included
*/
typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
xmlNodePtr node,
xmlNodePtr parent);
XMLPUBFUN int XMLCALL
xmlC14NExecute (xmlDocPtr doc,
xmlC14NIsVisibleCallback is_visible_callback,
void* user_data,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* LIBXML_C14N_ENABLED */
#endif /* __XML_C14N_H__ */

View File

@ -0,0 +1,182 @@
/**
* Summary: interfaces to the Catalog handling system
* Description: the catalog module implements the support for
* XML Catalogs and SGML catalogs
*
* SGML Open Technical Resolution TR9401:1997.
* http://www.jclark.com/sp/catalog.htm
*
* XML Catalogs Working Draft 06 August 2001
* http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_CATALOG_H__
#define __XML_CATALOG_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#include <libxml/tree.h>
#ifdef LIBXML_CATALOG_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* XML_CATALOGS_NAMESPACE:
*
* The namespace for the XML Catalogs elements.
*/
#define XML_CATALOGS_NAMESPACE \
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
/**
* XML_CATALOG_PI:
*
* The specific XML Catalog Processing Instuction name.
*/
#define XML_CATALOG_PI \
(const xmlChar *) "oasis-xml-catalog"
/*
* The API is voluntarily limited to general cataloging.
*/
typedef enum {
XML_CATA_PREFER_NONE = 0,
XML_CATA_PREFER_PUBLIC = 1,
XML_CATA_PREFER_SYSTEM
} xmlCatalogPrefer;
typedef enum {
XML_CATA_ALLOW_NONE = 0,
XML_CATA_ALLOW_GLOBAL = 1,
XML_CATA_ALLOW_DOCUMENT = 2,
XML_CATA_ALLOW_ALL = 3
} xmlCatalogAllow;
typedef struct _xmlCatalog xmlCatalog;
typedef xmlCatalog *xmlCatalogPtr;
/*
* Operations on a given catalog.
*/
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlNewCatalog (int sgml);
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlLoadACatalog (const char *filename);
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlLoadSGMLSuperCatalog (const char *filename);
XMLPUBFUN int XMLCALL
xmlConvertSGMLCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
xmlACatalogAdd (xmlCatalogPtr catal,
const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int XMLCALL
xmlACatalogRemove (xmlCatalogPtr catal,
const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolve (xmlCatalogPtr catal,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveSystem(xmlCatalogPtr catal,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolvePublic(xmlCatalogPtr catal,
const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveURI (xmlCatalogPtr catal,
const xmlChar *URI);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlACatalogDump (xmlCatalogPtr catal,
FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
xmlCatalogIsEmpty (xmlCatalogPtr catal);
/*
* Global operations.
*/
XMLPUBFUN void XMLCALL
xmlInitializeCatalog (void);
XMLPUBFUN int XMLCALL
xmlLoadCatalog (const char *filename);
XMLPUBFUN void XMLCALL
xmlLoadCatalogs (const char *paths);
XMLPUBFUN void XMLCALL
xmlCatalogCleanup (void);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlCatalogDump (FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolve (const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolveSystem (const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolvePublic (const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolveURI (const xmlChar *URI);
XMLPUBFUN int XMLCALL
xmlCatalogAdd (const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int XMLCALL
xmlCatalogRemove (const xmlChar *value);
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseCatalogFile (const char *filename);
XMLPUBFUN int XMLCALL
xmlCatalogConvert (void);
/*
* Strictly minimal interfaces for per-document catalogs used
* by the parser.
*/
XMLPUBFUN void XMLCALL
xmlCatalogFreeLocal (void *catalogs);
XMLPUBFUN void * XMLCALL
xmlCatalogAddLocal (void *catalogs,
const xmlChar *URL);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogLocalResolve (void *catalogs,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogLocalResolveURI(void *catalogs,
const xmlChar *URI);
/*
* Preference settings.
*/
XMLPUBFUN int XMLCALL
xmlCatalogSetDebug (int level);
XMLPUBFUN xmlCatalogPrefer XMLCALL
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
XMLPUBFUN void XMLCALL
xmlCatalogSetDefaults (xmlCatalogAllow allow);
XMLPUBFUN xmlCatalogAllow XMLCALL
xmlCatalogGetDefaults (void);
/* DEPRECATED interfaces */
XMLPUBFUN const xmlChar * XMLCALL
xmlCatalogGetSystem (const xmlChar *sysID);
XMLPUBFUN const xmlChar * XMLCALL
xmlCatalogGetPublic (const xmlChar *pubID);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_CATALOG_ENABLED */
#endif /* __XML_CATALOG_H__ */

View File

@ -0,0 +1,230 @@
/*
* Summary: Unicode character range checking
* Description: this module exports interfaces for the character
* range validation APIs
*
* This file is automatically generated from the cvs source
* definition files using the genChRanges.py Python script
*
* Generation date: Mon Mar 27 11:09:48 2006
* Sources: chvalid.def
* Author: William Brack <wbrack@mmm.com.hk>
*/
#ifndef __XML_CHVALID_H__
#define __XML_CHVALID_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define our typedefs and structures
*
*/
typedef struct _xmlChSRange xmlChSRange;
typedef xmlChSRange *xmlChSRangePtr;
struct _xmlChSRange {
unsigned short low;
unsigned short high;
};
typedef struct _xmlChLRange xmlChLRange;
typedef xmlChLRange *xmlChLRangePtr;
struct _xmlChLRange {
unsigned int low;
unsigned int high;
};
typedef struct _xmlChRangeGroup xmlChRangeGroup;
typedef xmlChRangeGroup *xmlChRangeGroupPtr;
struct _xmlChRangeGroup {
int nbShortRange;
int nbLongRange;
const xmlChSRange *shortRange; /* points to an array of ranges */
const xmlChLRange *longRange;
};
/**
* Range checking routine
*/
XMLPUBFUN int XMLCALL
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
/**
* xmlIsBaseChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a)) || \
((0xc0 <= (c)) && ((c) <= 0xd6)) || \
((0xd8 <= (c)) && ((c) <= 0xf6)) || \
(0xf8 <= (c)))
/**
* xmlIsBaseCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
xmlIsBaseChar_ch((c)) : \
xmlCharInRange((c), &xmlIsBaseCharGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
/**
* xmlIsBlank_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBlank_ch(c) (((c) == 0x20) || \
((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd))
/**
* xmlIsBlankQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBlankQ(c) (((c) < 0x100) ? \
xmlIsBlank_ch((c)) : 0)
/**
* xmlIsChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd) || \
(0x20 <= (c)))
/**
* xmlIsCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsCharQ(c) (((c) < 0x100) ? \
xmlIsChar_ch((c)) :\
(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
((0x10000 <= (c)) && ((c) <= 0x10ffff))))
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
/**
* xmlIsCombiningQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsCombiningQ(c) (((c) < 0x100) ? \
0 : \
xmlCharInRange((c), &xmlIsCombiningGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
/**
* xmlIsDigit_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
/**
* xmlIsDigitQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsDigitQ(c) (((c) < 0x100) ? \
xmlIsDigit_ch((c)) : \
xmlCharInRange((c), &xmlIsDigitGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
/**
* xmlIsExtender_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsExtender_ch(c) (((c) == 0xb7))
/**
* xmlIsExtenderQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsExtenderQ(c) (((c) < 0x100) ? \
xmlIsExtender_ch((c)) : \
xmlCharInRange((c), &xmlIsExtenderGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
/**
* xmlIsIdeographicQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
0 :\
(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
((c) == 0x3007) || \
((0x3021 <= (c)) && ((c) <= 0x3029))))
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
/**
* xmlIsPubidChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
/**
* xmlIsPubidCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
xmlIsPubidChar_ch((c)) : 0)
XMLPUBFUN int XMLCALL
xmlIsBaseChar(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsBlank(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsChar(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsCombining(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsDigit(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsExtender(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsIdeographic(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsPubidChar(unsigned int ch);
#ifdef __cplusplus
}
#endif
#endif /* __XML_CHVALID_H__ */

View File

@ -0,0 +1,217 @@
/*
* Summary: Tree debugging APIs
* Description: Interfaces to a set of routines used for debugging the tree
* produced by the XML parser.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DEBUG_XML__
#define __DEBUG_XML__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_DEBUG_ENABLED
#include <libxml/xpath.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The standard Dump routines.
*/
XMLPUBFUN void XMLCALL
xmlDebugDumpString (FILE *output,
const xmlChar *str);
XMLPUBFUN void XMLCALL
xmlDebugDumpAttr (FILE *output,
xmlAttrPtr attr,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpAttrList (FILE *output,
xmlAttrPtr attr,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpOneNode (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpNode (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpNodeList (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpDocumentHead(FILE *output,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlDebugDumpDocument (FILE *output,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlDebugDumpDTD (FILE *output,
xmlDtdPtr dtd);
XMLPUBFUN void XMLCALL
xmlDebugDumpEntities (FILE *output,
xmlDocPtr doc);
/****************************************************************
* *
* Checking routines *
* *
****************************************************************/
XMLPUBFUN int XMLCALL
xmlDebugCheckDocument (FILE * output,
xmlDocPtr doc);
/****************************************************************
* *
* XML shell helpers *
* *
****************************************************************/
XMLPUBFUN void XMLCALL
xmlLsOneNode (FILE *output, xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlLsCountNode (xmlNodePtr node);
XMLPUBFUN const char * XMLCALL
xmlBoolToText (int boolval);
/****************************************************************
* *
* The XML shell related structures and functions *
* *
****************************************************************/
#ifdef LIBXML_XPATH_ENABLED
/**
* xmlShellReadlineFunc:
* @prompt: a string prompt
*
* This is a generic signature for the XML shell input function.
*
* Returns a string which will be freed by the Shell.
*/
typedef char * (* xmlShellReadlineFunc)(char *prompt);
/**
* xmlShellCtxt:
*
* A debugging shell context.
* TODO: add the defined function tables.
*/
typedef struct _xmlShellCtxt xmlShellCtxt;
typedef xmlShellCtxt *xmlShellCtxtPtr;
struct _xmlShellCtxt {
char *filename;
xmlDocPtr doc;
xmlNodePtr node;
xmlXPathContextPtr pctxt;
int loaded;
FILE *output;
xmlShellReadlineFunc input;
};
/**
* xmlShellCmd:
* @ctxt: a shell context
* @arg: a string argument
* @node: a first node
* @node2: a second node
*
* This is a generic signature for the XML shell functions.
*
* Returns an int, negative returns indicating errors.
*/
typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN void XMLCALL
xmlShellPrintXPathError (int errorType,
const char *arg);
XMLPUBFUN void XMLCALL
xmlShellPrintXPathResult(xmlXPathObjectPtr list);
XMLPUBFUN int XMLCALL
xmlShellList (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellBase (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellDir (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellLoad (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlShellPrintNode (xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlShellCat (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellWrite (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellSave (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int XMLCALL
xmlShellValidate (xmlShellCtxtPtr ctxt,
char *dtd,
xmlNodePtr node,
xmlNodePtr node2);
#endif /* LIBXML_VALID_ENABLED */
XMLPUBFUN int XMLCALL
xmlShellDu (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr tree,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellPwd (xmlShellCtxtPtr ctxt,
char *buffer,
xmlNodePtr node,
xmlNodePtr node2);
/*
* The Shell interface.
*/
XMLPUBFUN void XMLCALL
xmlShell (xmlDocPtr doc,
char *filename,
xmlShellReadlineFunc input,
FILE *output);
#endif /* LIBXML_XPATH_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_DEBUG_ENABLED */
#endif /* __DEBUG_XML__ */

View File

@ -0,0 +1,69 @@
/*
* Summary: string dictionnary
* Description: dictionary of reusable strings, just used to avoid allocation
* and freeing operations.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_DICT_H__
#define __XML_DICT_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The dictionnary.
*/
typedef struct _xmlDict xmlDict;
typedef xmlDict *xmlDictPtr;
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlDictPtr XMLCALL
xmlDictCreate (void);
XMLPUBFUN xmlDictPtr XMLCALL
xmlDictCreateSub(xmlDictPtr sub);
XMLPUBFUN int XMLCALL
xmlDictReference(xmlDictPtr dict);
XMLPUBFUN void XMLCALL
xmlDictFree (xmlDictPtr dict);
/*
* Lookup of entry in the dictionnary.
*/
XMLPUBFUN const xmlChar * XMLCALL
xmlDictLookup (xmlDictPtr dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlDictExists (xmlDictPtr dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlDictQLookup (xmlDictPtr dict,
const xmlChar *prefix,
const xmlChar *name);
XMLPUBFUN int XMLCALL
xmlDictOwns (xmlDictPtr dict,
const xmlChar *str);
XMLPUBFUN int XMLCALL
xmlDictSize (xmlDictPtr dict);
/*
* Cleanup function
*/
XMLPUBFUN void XMLCALL
xmlDictCleanup (void);
#ifdef __cplusplus
}
#endif
#endif /* ! __XML_DICT_H__ */

View File

@ -0,0 +1,255 @@
/*
* Summary: interface for the encoding conversion functions
* Description: interface for the encoding conversion functions needed for
* XML basic encoding and iconv() support.
*
* Related specs are
* rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies
* [ISO-10646] UTF-8 and UTF-16 in Annexes
* [ISO-8859-1] ISO Latin-1 characters codes.
* [UNICODE] The Unicode Consortium, "The Unicode Standard --
* Worldwide Character Encoding -- Version 1.0", Addison-
* Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is
* described in Unicode Technical Report #4.
* [US-ASCII] Coded Character Set--7-bit American Standard Code for
* Information Interchange, ANSI X3.4-1986.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_CHAR_ENCODING_H__
#define __XML_CHAR_ENCODING_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_ICONV_ENABLED
#include <iconv.h>
#else
#ifdef LIBXML_ICU_ENABLED
#include <unicode/ucnv.h>
#if 0
/* Forward-declare UConverter here rather than pulling in <unicode/ucnv.h>
* to prevent unwanted ICU symbols being exposed to users of libxml2.
* One particular case is Qt4 conflicting on UChar32.
*/
#include <stdint.h>
struct UConverter;
typedef struct UConverter UConverter;
#ifdef _MSC_VER
typedef wchar_t UChar;
#else
typedef uint16_t UChar;
#endif
#endif
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* xmlCharEncoding:
*
* Predefined values for some standard encodings.
* Libxml does not do beforehand translation on UTF8 and ISOLatinX.
* It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
*
* Anything else would have to be translated to UTF8 before being
* given to the parser itself. The BOM for UTF16 and the encoding
* declaration are looked at and a converter is looked for at that
* point. If not found the parser stops here as asked by the XML REC. A
* converter can be registered by the user using xmlRegisterCharEncodingHandler
* but the current form doesn't allow stateful transcoding (a serious
* problem agreed !). If iconv has been found it will be used
* automatically and allow stateful transcoding, the simplest is then
* to be sure to enable iconv and to provide iconv libs for the encoding
* support needed.
*
* Note that the generic "UTF-16" is not a predefined value. Instead, only
* the specific UTF-16LE and UTF-16BE are present.
*/
typedef enum {
XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
} xmlCharEncoding;
/**
* xmlCharEncodingInputFunc:
* @out: a pointer to an array of bytes to store the UTF-8 result
* @outlen: the length of @out
* @in: a pointer to an array of chars in the original encoding
* @inlen: the length of @in
*
* Take a block of chars in the original encoding and try to convert
* it to an UTF-8 block of chars out.
*
* Returns the number of bytes written, -1 if lack of space, or -2
* if the transcoding failed.
* The value of @inlen after return is the number of octets consumed
* if the return value is positive, else unpredictiable.
* The value of @outlen after return is the number of octets consumed.
*/
typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen);
/**
* xmlCharEncodingOutputFunc:
* @out: a pointer to an array of bytes to store the result
* @outlen: the length of @out
* @in: a pointer to an array of UTF-8 chars
* @inlen: the length of @in
*
* Take a block of UTF-8 chars in and try to convert it to another
* encoding.
* Note: a first call designed to produce heading info is called with
* in = NULL. If stateful this should also initialize the encoder state.
*
* Returns the number of bytes written, -1 if lack of space, or -2
* if the transcoding failed.
* The value of @inlen after return is the number of octets consumed
* if the return value is positive, else unpredictiable.
* The value of @outlen after return is the number of octets produced.
*/
typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen);
/*
* Block defining the handlers for non UTF-8 encodings.
* If iconv is supported, there are two extra fields.
*/
#ifdef LIBXML_ICU_ENABLED
struct _uconv_t {
UConverter *uconv; /* for conversion between an encoding and UTF-16 */
UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
};
typedef struct _uconv_t uconv_t;
#endif
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
struct _xmlCharEncodingHandler {
char *name;
xmlCharEncodingInputFunc input;
xmlCharEncodingOutputFunc output;
#ifdef LIBXML_ICONV_ENABLED
iconv_t iconv_in;
iconv_t iconv_out;
#endif /* LIBXML_ICONV_ENABLED */
#ifdef LIBXML_ICU_ENABLED
uconv_t *uconv_in;
uconv_t *uconv_out;
#endif /* LIBXML_ICU_ENABLED */
};
#ifdef __cplusplus
}
#endif
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Interfaces for encoding handlers.
*/
XMLPUBFUN void XMLCALL
xmlInitCharEncodingHandlers (void);
XMLPUBFUN void XMLCALL
xmlCleanupCharEncodingHandlers (void);
XMLPUBFUN void XMLCALL
xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlGetCharEncodingHandler (xmlCharEncoding enc);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlFindCharEncodingHandler (const char *name);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlNewCharEncodingHandler (const char *name,
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output);
/*
* Interfaces for encoding names and aliases.
*/
XMLPUBFUN int XMLCALL
xmlAddEncodingAlias (const char *name,
const char *alias);
XMLPUBFUN int XMLCALL
xmlDelEncodingAlias (const char *alias);
XMLPUBFUN const char * XMLCALL
xmlGetEncodingAlias (const char *alias);
XMLPUBFUN void XMLCALL
xmlCleanupEncodingAliases (void);
XMLPUBFUN xmlCharEncoding XMLCALL
xmlParseCharEncoding (const char *name);
XMLPUBFUN const char * XMLCALL
xmlGetCharEncodingName (xmlCharEncoding enc);
/*
* Interfaces directly used by the parsers.
*/
XMLPUBFUN xmlCharEncoding XMLCALL
xmlDetectCharEncoding (const unsigned char *in,
int len);
XMLPUBFUN int XMLCALL
xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncInFunc (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
/*
* Export a few useful functions
*/
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
UTF8Toisolat1 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
isolat1ToUTF8 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#ifdef __cplusplus
}
#endif
#endif /* __XML_CHAR_ENCODING_H__ */

View File

@ -0,0 +1,150 @@
/*
* Summary: interface for the XML entities handling
* Description: this module provides some of the entity API needed
* for the parser and applications.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_ENTITIES_H__
#define __XML_ENTITIES_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The different valid entity types.
*/
typedef enum {
XML_INTERNAL_GENERAL_ENTITY = 1,
XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
XML_INTERNAL_PARAMETER_ENTITY = 4,
XML_EXTERNAL_PARAMETER_ENTITY = 5,
XML_INTERNAL_PREDEFINED_ENTITY = 6
} xmlEntityType;
/*
* An unit of storage for an entity, contains the string, the value
* and the linkind data needed for the linking in the hash table.
*/
struct _xmlEntity {
void *_private; /* application data */
xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
const xmlChar *name; /* Entity name */
struct _xmlNode *children; /* First child link */
struct _xmlNode *last; /* Last child link */
struct _xmlDtd *parent; /* -> DTD */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
xmlChar *orig; /* content without ref substitution */
xmlChar *content; /* content or ndata if unparsed */
int length; /* the content length */
xmlEntityType etype; /* The entity type */
const xmlChar *ExternalID; /* External identifier for PUBLIC */
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
struct _xmlEntity *nexte; /* unused */
const xmlChar *URI; /* the full URI as computed */
int owner; /* does the entity own the childrens */
int checked; /* was the entity content checked */
/* this is also used to count entites
* references done from that entity */
};
/*
* All entities are stored in an hash table.
* There is 2 separate hash tables for global and parameter entities.
*/
typedef struct _xmlHashTable xmlEntitiesTable;
typedef xmlEntitiesTable *xmlEntitiesTablePtr;
/*
* External functions:
*/
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN void XMLCALL
xmlInitializePredefinedEntities (void);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlEntityPtr XMLCALL
xmlNewEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlAddDocEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlAddDtdEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetPredefinedEntity (const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetDocEntity (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetDtdEntity (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetParameterEntity (xmlDocPtr doc,
const xmlChar *name);
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN const xmlChar * XMLCALL
xmlEncodeEntities (xmlDocPtr doc,
const xmlChar *input);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
xmlEncodeEntitiesReentrant(xmlDocPtr doc,
const xmlChar *input);
XMLPUBFUN xmlChar * XMLCALL
xmlEncodeSpecialChars (xmlDocPtr doc,
const xmlChar *input);
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
xmlCreateEntitiesTable (void);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpEntitiesTable (xmlBufferPtr buf,
xmlEntitiesTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpEntityDecl (xmlBufferPtr buf,
xmlEntityPtr ent);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN void XMLCALL
xmlCleanupPredefinedEntities(void);
#endif /* LIBXML_LEGACY_ENABLED */
#ifdef __cplusplus
}
#endif
# endif /* __XML_ENTITIES_H__ */

View File

@ -0,0 +1,502 @@
/*
* Summary: interface for all global variables of the library
* Description: all the global variables and thread handling for
* those variables is handled by this module.
*
* The bottom of this file is automatically generated by build_glob.py
* based on the description file global.data
*
* Copy: See Copyright for the status of this software.
*
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>, Daniel Veillard
*/
#ifndef __XML_GLOBALS_H
#define __XML_GLOBALS_H
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/SAX.h>
#include <libxml/SAX2.h>
#include <libxml/xmlmemory.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL xmlInitGlobals(void);
XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
/**
* xmlParserInputBufferCreateFilenameFunc:
* @URI: the URI to read from
* @enc: the requested source encoding
*
* Signature for the function doing the lookup for a suitable input method
* corresponding to an URI.
*
* Returns the new xmlParserInputBufferPtr in case of success or NULL if no
* method was found.
*/
typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc);
/**
* xmlOutputBufferCreateFilenameFunc:
* @URI: the URI to write to
* @enc: the requested target encoding
*
* Signature for the function doing the lookup for a suitable output method
* corresponding to an URI.
*
* Returns the new xmlOutputBufferPtr in case of success or NULL if no
* method was found.
*/
typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
/*
* Externally global symbols which need to be protected for backwards
* compatibility support.
*/
#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
#undef xmlDefaultBufferSize
#undef xmlDefaultSAXHandler
#undef xmlDefaultSAXLocator
#undef xmlDoValidityCheckingDefaultValue
#undef xmlFree
#undef xmlGenericError
#undef xmlStructuredError
#undef xmlGenericErrorContext
#undef xmlStructuredErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlTreeIndentString
#undef xmlKeepBlanksDefaultValue
#undef xmlLineNumbersDefaultValue
#undef xmlLoadExtDtdDefaultValue
#undef xmlMalloc
#undef xmlMallocAtomic
#undef xmlMemStrdup
#undef xmlParserDebugEntities
#undef xmlParserVersion
#undef xmlPedanticParserDefaultValue
#undef xmlRealloc
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
#undef xmlLastError
#undef xmlParserInputBufferCreateFilenameValue
#undef xmlOutputBufferCreateFilenameValue
/**
* xmlRegisterNodeFunc:
* @node: the current node
*
* Signature for the registration callback of a created node
*/
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
/**
* xmlDeregisterNodeFunc:
* @node: the current node
*
* Signature for the deregistration callback of a discarded node
*/
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr;
struct _xmlGlobalState
{
const char *xmlParserVersion;
xmlSAXLocator xmlDefaultSAXLocator;
xmlSAXHandlerV1 xmlDefaultSAXHandler;
xmlSAXHandlerV1 docbDefaultSAXHandler;
xmlSAXHandlerV1 htmlDefaultSAXHandler;
xmlFreeFunc xmlFree;
xmlMallocFunc xmlMalloc;
xmlStrdupFunc xmlMemStrdup;
xmlReallocFunc xmlRealloc;
xmlGenericErrorFunc xmlGenericError;
xmlStructuredErrorFunc xmlStructuredError;
void *xmlGenericErrorContext;
int oldXMLWDcompatibility;
xmlBufferAllocationScheme xmlBufferAllocScheme;
int xmlDefaultBufferSize;
int xmlSubstituteEntitiesDefaultValue;
int xmlDoValidityCheckingDefaultValue;
int xmlGetWarningsDefaultValue;
int xmlKeepBlanksDefaultValue;
int xmlLineNumbersDefaultValue;
int xmlLoadExtDtdDefaultValue;
int xmlParserDebugEntities;
int xmlPedanticParserDefaultValue;
int xmlSaveNoEmptyTags;
int xmlIndentTreeOutput;
const char *xmlTreeIndentString;
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
xmlMallocFunc xmlMallocAtomic;
xmlError xmlLastError;
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
void *xmlStructuredErrorContext;
};
#ifdef __cplusplus
}
#endif
#include <libxml/threads.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs);
XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func);
/** DOC_DISABLE */
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
* - xmlMalloc
* - xmlMallocAtomic
* - xmlRealloc
* - xmlMemStrdup
* - xmlFree
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void);
#define xmlMalloc \
(*(__xmlMalloc()))
#else
XMLPUBVAR xmlMallocFunc xmlMalloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void);
#define xmlMallocAtomic \
(*(__xmlMallocAtomic()))
#else
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void);
#define xmlRealloc \
(*(__xmlRealloc()))
#else
XMLPUBVAR xmlReallocFunc xmlRealloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void);
#define xmlFree \
(*(__xmlFree()))
#else
XMLPUBVAR xmlFreeFunc xmlFree;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
XMLPUBVAR xmlMallocFunc xmlMalloc;
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
XMLPUBVAR xmlReallocFunc xmlRealloc;
XMLPUBVAR xmlFreeFunc xmlFree;
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif /* LIBXML_THREAD_ALLOC_ENABLED */
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define docbDefaultSAXHandler \
(*(__docbDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler;
#endif
#endif
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif
#endif
XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLastError \
(*(__xmlLastError()))
#else
XMLPUBVAR xmlError xmlLastError;
#endif
/*
* Everything starting from the line below is
* Automatically generated by build_glob.py.
* Do not modify the previous line.
*/
XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
#ifdef LIBXML_THREAD_ENABLED
#define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility()))
#else
XMLPUBVAR int oldXMLWDcompatibility;
#endif
XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme()))
#else
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif
XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize()))
#else
XMLPUBVAR int xmlDefaultBufferSize;
#endif
XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
#endif
XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator()))
#else
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
#endif
XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDoValidityCheckingDefaultValue \
(*(__xmlDoValidityCheckingDefaultValue()))
#else
XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericError \
(*(__xmlGenericError()))
#else
XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
#endif
XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredError \
(*(__xmlStructuredError()))
#else
XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
#endif
XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericErrorContext \
(*(__xmlGenericErrorContext()))
#else
XMLPUBVAR void * xmlGenericErrorContext;
#endif
XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredErrorContext \
(*(__xmlStructuredErrorContext()))
#else
XMLPUBVAR void * xmlStructuredErrorContext;
#endif
XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGetWarningsDefaultValue \
(*(__xmlGetWarningsDefaultValue()))
#else
XMLPUBVAR int xmlGetWarningsDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlIndentTreeOutput \
(*(__xmlIndentTreeOutput()))
#else
XMLPUBVAR int xmlIndentTreeOutput;
#endif
XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlTreeIndentString \
(*(__xmlTreeIndentString()))
#else
XMLPUBVAR const char * xmlTreeIndentString;
#endif
XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlKeepBlanksDefaultValue \
(*(__xmlKeepBlanksDefaultValue()))
#else
XMLPUBVAR int xmlKeepBlanksDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue()))
#else
XMLPUBVAR int xmlLineNumbersDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLoadExtDtdDefaultValue \
(*(__xmlLoadExtDtdDefaultValue()))
#else
XMLPUBVAR int xmlLoadExtDtdDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserDebugEntities \
(*(__xmlParserDebugEntities()))
#else
XMLPUBVAR int xmlParserDebugEntities;
#endif
XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserVersion \
(*(__xmlParserVersion()))
#else
XMLPUBVAR const char * xmlParserVersion;
#endif
XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue()))
#else
XMLPUBVAR int xmlPedanticParserDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSaveNoEmptyTags \
(*(__xmlSaveNoEmptyTags()))
#else
XMLPUBVAR int xmlSaveNoEmptyTags;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSubstituteEntitiesDefaultValue \
(*(__xmlSubstituteEntitiesDefaultValue()))
#else
XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlRegisterNodeDefaultValue \
(*(__xmlRegisterNodeDefaultValue()))
#else
XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
#endif
XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDeregisterNodeDefaultValue \
(*(__xmlDeregisterNodeDefaultValue()))
#else
XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
#endif
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL __xmlParserInputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserInputBufferCreateFilenameValue \
(*(__xmlParserInputBufferCreateFilenameValue()))
#else
XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
#endif
XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlOutputBufferCreateFilenameValue \
(*(__xmlOutputBufferCreateFilenameValue()))
#else
XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_GLOBALS_H */

View File

@ -0,0 +1,233 @@
/*
* Summary: Chained hash tables
* Description: This module implements the hash table support used in
* various places in the library.
*
* Copy: See Copyright for the status of this software.
*
* Author: Bjorn Reese <bjorn.reese@systematic.dk>
*/
#ifndef __XML_HASH_H__
#define __XML_HASH_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* The hash table.
*/
typedef struct _xmlHashTable xmlHashTable;
typedef xmlHashTable *xmlHashTablePtr;
#ifdef __cplusplus
}
#endif
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Recent version of gcc produce a warning when a function pointer is assigned
* to an object pointer, or vice versa. The following macro is a dirty hack
* to allow suppression of the warning. If your architecture has function
* pointers which are a different size than a void pointer, there may be some
* serious trouble within the library.
*/
/**
* XML_CAST_FPTR:
* @fptr: pointer to a function
*
* Macro to do a casting from an object pointer to a
* function pointer without encountering a warning from
* gcc
*
* #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
* This macro violated ISO C aliasing rules (gcc4 on s390 broke)
* so it is disabled now
*/
#define XML_CAST_FPTR(fptr) fptr
/*
* function types:
*/
/**
* xmlHashDeallocator:
* @payload: the data in the hash
* @name: the name associated
*
* Callback to free data from a hash.
*/
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
/**
* xmlHashCopier:
* @payload: the data in the hash
* @name: the name associated
*
* Callback to copy data from a hash.
*
* Returns a copy of the data or NULL in case of error.
*/
typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
/**
* xmlHashScanner:
* @payload: the data in the hash
* @data: extra scannner data
* @name: the name associated
*
* Callback when scanning data in a hash with the simple scanner.
*/
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
/**
* xmlHashScannerFull:
* @payload: the data in the hash
* @data: extra scannner data
* @name: the name associated
* @name2: the second name associated
* @name3: the third name associated
*
* Callback when scanning data in a hash with the full scanner.
*/
typedef void (*xmlHashScannerFull)(void *payload, void *data,
const xmlChar *name, const xmlChar *name2,
const xmlChar *name3);
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCreate (int size);
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCreateDict(int size,
xmlDictPtr dict);
XMLPUBFUN void XMLCALL
xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f);
/*
* Add a new entry to the hash table.
*/
XMLPUBFUN int XMLCALL
xmlHashAddEntry (xmlHashTablePtr table,
const xmlChar *name,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry(xmlHashTablePtr table,
const xmlChar *name,
void *userdata,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashAddEntry2(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry2(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
void *userdata,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashAddEntry3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata,
xmlHashDeallocator f);
/*
* Remove an entry from the hash table.
*/
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3,
xmlHashDeallocator f);
/*
* Retrieve the userdata.
*/
XMLPUBFUN void * XMLCALL
xmlHashLookup (xmlHashTablePtr table,
const xmlChar *name);
XMLPUBFUN void * XMLCALL
xmlHashLookup2 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2);
XMLPUBFUN void * XMLCALL
xmlHashLookup3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3);
XMLPUBFUN void * XMLCALL
xmlHashQLookup (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN void * XMLCALL
xmlHashQLookup2 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix,
const xmlChar *name2,
const xmlChar *prefix2);
XMLPUBFUN void * XMLCALL
xmlHashQLookup3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix,
const xmlChar *name2,
const xmlChar *prefix2,
const xmlChar *name3,
const xmlChar *prefix3);
/*
* Helpers.
*/
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCopy (xmlHashTablePtr table,
xmlHashCopier f);
XMLPUBFUN int XMLCALL
xmlHashSize (xmlHashTablePtr table);
XMLPUBFUN void XMLCALL
xmlHashScan (xmlHashTablePtr table,
xmlHashScanner f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScan3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScanner f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScanFull (xmlHashTablePtr table,
xmlHashScannerFull f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScanFull3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScannerFull f,
void *data);
#ifdef __cplusplus
}
#endif
#endif /* ! __XML_HASH_H__ */

View File

@ -0,0 +1,137 @@
/*
* Summary: lists interfaces
* Description: this module implement the list support used in
* various place in the library.
*
* Copy: See Copyright for the status of this software.
*
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>
*/
#ifndef __XML_LINK_INCLUDE__
#define __XML_LINK_INCLUDE__
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlLink xmlLink;
typedef xmlLink *xmlLinkPtr;
typedef struct _xmlList xmlList;
typedef xmlList *xmlListPtr;
/**
* xmlListDeallocator:
* @lk: the data to deallocate
*
* Callback function used to free data from a list.
*/
typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
/**
* xmlListDataCompare:
* @data0: the first data
* @data1: the second data
*
* Callback function used to compare 2 data.
*
* Returns 0 is equality, -1 or 1 otherwise depending on the ordering.
*/
typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
/**
* xmlListWalker:
* @data: the data found in the list
* @user: extra user provided data to the walker
*
* Callback function used when walking a list with xmlListWalk().
*
* Returns 0 to stop walking the list, 1 otherwise.
*/
typedef int (*xmlListWalker) (const void *data, const void *user);
/* Creation/Deletion */
XMLPUBFUN xmlListPtr XMLCALL
xmlListCreate (xmlListDeallocator deallocator,
xmlListDataCompare compare);
XMLPUBFUN void XMLCALL
xmlListDelete (xmlListPtr l);
/* Basic Operators */
XMLPUBFUN void * XMLCALL
xmlListSearch (xmlListPtr l,
void *data);
XMLPUBFUN void * XMLCALL
xmlListReverseSearch (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListInsert (xmlListPtr l,
void *data) ;
XMLPUBFUN int XMLCALL
xmlListAppend (xmlListPtr l,
void *data) ;
XMLPUBFUN int XMLCALL
xmlListRemoveFirst (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListRemoveLast (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListRemoveAll (xmlListPtr l,
void *data);
XMLPUBFUN void XMLCALL
xmlListClear (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListEmpty (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL
xmlListFront (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL
xmlListEnd (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListSize (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListPopFront (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListPopBack (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListPushFront (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListPushBack (xmlListPtr l,
void *data);
/* Advanced Operators */
XMLPUBFUN void XMLCALL
xmlListReverse (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListSort (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListWalk (xmlListPtr l,
xmlListWalker walker,
const void *user);
XMLPUBFUN void XMLCALL
xmlListReverseWalk (xmlListPtr l,
xmlListWalker walker,
const void *user);
XMLPUBFUN void XMLCALL
xmlListMerge (xmlListPtr l1,
xmlListPtr l2);
XMLPUBFUN xmlListPtr XMLCALL
xmlListDup (const xmlListPtr old);
XMLPUBFUN int XMLCALL
xmlListCopy (xmlListPtr cur,
const xmlListPtr old);
/* Link operators */
XMLPUBFUN void * XMLCALL
xmlLinkGetData (xmlLinkPtr lk);
/* xmlListUnique() */
/* xmlListSwap */
#ifdef __cplusplus
}
#endif
#endif /* __XML_LINK_INCLUDE__ */

View File

@ -0,0 +1,143 @@
/*
* Summary: minimal FTP implementation
* Description: minimal FTP implementation allowing to fetch resources
* like external subset.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __NANO_FTP_H__
#define __NANO_FTP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_FTP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* ftpListCallback:
* @userData: user provided data for the callback
* @filename: the file name (including "->" when links are shown)
* @attrib: the attribute string
* @owner: the owner string
* @group: the group string
* @size: the file size
* @links: the link count
* @year: the year
* @month: the month
* @day: the day
* @hour: the hour
* @minute: the minute
*
* A callback for the xmlNanoFTPList command.
* Note that only one of year and day:minute are specified.
*/
typedef void (*ftpListCallback) (void *userData,
const char *filename, const char *attrib,
const char *owner, const char *group,
unsigned long size, int links, int year,
const char *month, int day, int hour,
int minute);
/**
* ftpDataCallback:
* @userData: the user provided context
* @data: the data received
* @len: its size in bytes
*
* A callback for the xmlNanoFTPGet command.
*/
typedef void (*ftpDataCallback) (void *userData,
const char *data,
int len);
/*
* Init
*/
XMLPUBFUN void XMLCALL
xmlNanoFTPInit (void);
XMLPUBFUN void XMLCALL
xmlNanoFTPCleanup (void);
/*
* Creating/freeing contexts.
*/
XMLPUBFUN void * XMLCALL
xmlNanoFTPNewCtxt (const char *URL);
XMLPUBFUN void XMLCALL
xmlNanoFTPFreeCtxt (void * ctx);
XMLPUBFUN void * XMLCALL
xmlNanoFTPConnectTo (const char *server,
int port);
/*
* Opening/closing session connections.
*/
XMLPUBFUN void * XMLCALL
xmlNanoFTPOpen (const char *URL);
XMLPUBFUN int XMLCALL
xmlNanoFTPConnect (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPClose (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPQuit (void *ctx);
XMLPUBFUN void XMLCALL
xmlNanoFTPScanProxy (const char *URL);
XMLPUBFUN void XMLCALL
xmlNanoFTPProxy (const char *host,
int port,
const char *user,
const char *passwd,
int type);
XMLPUBFUN int XMLCALL
xmlNanoFTPUpdateURL (void *ctx,
const char *URL);
/*
* Rather internal commands.
*/
XMLPUBFUN int XMLCALL
xmlNanoFTPGetResponse (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPCheckResponse (void *ctx);
/*
* CD/DIR/GET handlers.
*/
XMLPUBFUN int XMLCALL
xmlNanoFTPCwd (void *ctx,
const char *directory);
XMLPUBFUN int XMLCALL
xmlNanoFTPDele (void *ctx,
const char *file);
XMLPUBFUN int XMLCALL
xmlNanoFTPGetConnection (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPCloseConnection(void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPList (void *ctx,
ftpListCallback callback,
void *userData,
const char *filename);
XMLPUBFUN int XMLCALL
xmlNanoFTPGetSocket (void *ctx,
const char *filename);
XMLPUBFUN int XMLCALL
xmlNanoFTPGet (void *ctx,
ftpDataCallback callback,
void *userData,
const char *filename);
XMLPUBFUN int XMLCALL
xmlNanoFTPRead (void *ctx,
void *dest,
int len);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_FTP_ENABLED */
#endif /* __NANO_FTP_H__ */

View File

@ -0,0 +1,81 @@
/*
* Summary: minimal HTTP implementation
* Description: minimal HTTP implementation allowing to fetch resources
* like external subset.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __NANO_HTTP_H__
#define __NANO_HTTP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_HTTP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL
xmlNanoHTTPInit (void);
XMLPUBFUN void XMLCALL
xmlNanoHTTPCleanup (void);
XMLPUBFUN void XMLCALL
xmlNanoHTTPScanProxy (const char *URL);
XMLPUBFUN int XMLCALL
xmlNanoHTTPFetch (const char *URL,
const char *filename,
char **contentType);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPMethod (const char *URL,
const char *method,
const char *input,
char **contentType,
const char *headers,
int ilen);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPMethodRedir (const char *URL,
const char *method,
const char *input,
char **contentType,
char **redir,
const char *headers,
int ilen);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPOpen (const char *URL,
char **contentType);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPOpenRedir (const char *URL,
char **contentType,
char **redir);
XMLPUBFUN int XMLCALL
xmlNanoHTTPReturnCode (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPAuthHeader (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPRedir (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoHTTPContentLength( void * ctx );
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPEncoding (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPMimeType (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoHTTPRead (void *ctx,
void *dest,
int len);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
xmlNanoHTTPSave (void *ctxt,
const char *filename);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlNanoHTTPClose (void *ctx);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTTP_ENABLED */
#endif /* __NANO_HTTP_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,611 @@
/*
* Summary: internals routines exported by the parser.
* Description: this module exports a number of internal parsing routines
* they are not really all intended for applications but
* can prove useful doing low level processing.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_PARSER_INTERNALS_H__
#define __XML_PARSER_INTERNALS_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/HTMLparser.h>
#include <libxml/chvalid.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlParserMaxDepth:
*
* arbitrary depth limit for the XML documents that we allow to
* process. This is not a limitation of the parser but a safety
* boundary feature, use XML_PARSE_HUGE option to override it.
*/
XMLPUBVAR unsigned int xmlParserMaxDepth;
/**
* XML_MAX_TEXT_LENGTH:
*
* Maximum size allowed for a single text node when building a tree.
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
*/
#define XML_MAX_TEXT_LENGTH 10000000
/**
* XML_MAX_NAMELEN:
*
* Identifiers can be longer, but this will be more costly
* at runtime.
*/
#define XML_MAX_NAMELEN 100
/**
* INPUT_CHUNK:
*
* The parser tries to always have that amount of input ready.
* One of the point is providing context when reporting errors.
*/
#define INPUT_CHUNK 250
/************************************************************************
* *
* UNICODE version of the macros. *
* *
************************************************************************/
/**
* IS_BYTE_CHAR:
* @c: an byte value (int)
*
* Macro to check the following production in the XML spec:
*
* [2] Char ::= #x9 | #xA | #xD | [#x20...]
* any byte character in the accepted range
*/
#define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
/**
* IS_CHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
* | [#x10000-#x10FFFF]
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
*/
#define IS_CHAR(c) xmlIsCharQ(c)
/**
* IS_CHAR_CH:
* @c: an xmlChar (usually an unsigned char)
*
* Behaves like IS_CHAR on single-byte value
*/
#define IS_CHAR_CH(c) xmlIsChar_ch(c)
/**
* IS_BLANK:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [3] S ::= (#x20 | #x9 | #xD | #xA)+
*/
#define IS_BLANK(c) xmlIsBlankQ(c)
/**
* IS_BLANK_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Behaviour same as IS_BLANK
*/
#define IS_BLANK_CH(c) xmlIsBlank_ch(c)
/**
* IS_BASECHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [85] BaseChar ::= ... long list see REC ...
*/
#define IS_BASECHAR(c) xmlIsBaseCharQ(c)
/**
* IS_DIGIT:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [88] Digit ::= ... long list see REC ...
*/
#define IS_DIGIT(c) xmlIsDigitQ(c)
/**
* IS_DIGIT_CH:
* @c: an xmlChar value (usually an unsigned char)
*
* Behaves like IS_DIGIT but with a single byte argument
*/
#define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
/**
* IS_COMBINING:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [87] CombiningChar ::= ... long list see REC ...
*/
#define IS_COMBINING(c) xmlIsCombiningQ(c)
/**
* IS_COMBINING_CH:
* @c: an xmlChar (usually an unsigned char)
*
* Always false (all combining chars > 0xff)
*/
#define IS_COMBINING_CH(c) 0
/**
* IS_EXTENDER:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
* #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
* [#x309D-#x309E] | [#x30FC-#x30FE]
*/
#define IS_EXTENDER(c) xmlIsExtenderQ(c)
/**
* IS_EXTENDER_CH:
* @c: an xmlChar value (usually an unsigned char)
*
* Behaves like IS_EXTENDER but with a single-byte argument
*/
#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
/**
* IS_IDEOGRAPHIC:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
*/
#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
/**
* IS_LETTER:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [84] Letter ::= BaseChar | Ideographic
*/
#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
/**
* IS_LETTER_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Macro behaves like IS_LETTER, but only check base chars
*
*/
#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
/**
* IS_ASCII_LETTER:
* @c: an xmlChar value
*
* Macro to check [a-zA-Z]
*
*/
#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a)))
/**
* IS_ASCII_DIGIT:
* @c: an xmlChar value
*
* Macro to check [0-9]
*
*/
#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
/**
* IS_PUBIDCHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
*/
#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
/**
* IS_PUBIDCHAR_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Same as IS_PUBIDCHAR but for single-byte value
*/
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
/**
* SKIP_EOL:
* @p: and UTF8 string pointer
*
* Skips the end of line chars.
*/
#define SKIP_EOL(p) \
if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
/**
* MOVETO_ENDTAG:
* @p: and UTF8 string pointer
*
* Skips to the next '>' char.
*/
#define MOVETO_ENDTAG(p) \
while ((*p) && (*(p) != '>')) (p)++
/**
* MOVETO_STARTTAG:
* @p: and UTF8 string pointer
*
* Skips to the next '<' char.
*/
#define MOVETO_STARTTAG(p) \
while ((*p) && (*(p) != '<')) (p)++
/**
* Global variables used for predefined strings.
*/
XMLPUBVAR const xmlChar xmlStringText[];
XMLPUBVAR const xmlChar xmlStringTextNoenc[];
XMLPUBVAR const xmlChar xmlStringComment[];
/*
* Function to finish the work of the macros where needed.
*/
XMLPUBFUN int XMLCALL xmlIsLetter (int c);
/**
* Parser context.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateFileParserCtxt (const char *filename);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateURLParserCtxt (const char *filename,
int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateEntityParserCtxt(const xmlChar *URL,
const xmlChar *ID,
const xmlChar *base);
XMLPUBFUN int XMLCALL
xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler);
XMLPUBFUN int XMLCALL
xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler);
#ifdef IN_LIBXML
/* internal error reporting */
XMLPUBFUN void XMLCALL
__xmlErrEncoding (xmlParserCtxtPtr ctxt,
xmlParserErrors xmlerr,
const char *msg,
const xmlChar * str1,
const xmlChar * str2);
#endif
/**
* Input Streams.
*/
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
const xmlChar *buffer);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
XMLPUBFUN int XMLCALL
xmlPushInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input);
XMLPUBFUN xmlChar XMLCALL
xmlPopInput (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlFreeInputStream (xmlParserInputPtr input);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char *filename);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewInputStream (xmlParserCtxtPtr ctxt);
/**
* Namespaces.
*/
XMLPUBFUN xmlChar * XMLCALL
xmlSplitQName (xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlChar **prefix);
/**
* Generic production rules.
*/
XMLPUBFUN const xmlChar * XMLCALL
xmlParseName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseNmtoken (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseEntityValue (xmlParserCtxtPtr ctxt,
xmlChar **orig);
XMLPUBFUN xmlChar * XMLCALL
xmlParseAttValue (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseCharData (xmlParserCtxtPtr ctxt,
int cdata);
XMLPUBFUN xmlChar * XMLCALL
xmlParseExternalID (xmlParserCtxtPtr ctxt,
xmlChar **publicID,
int strict);
XMLPUBFUN void XMLCALL
xmlParseComment (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL
xmlParsePITarget (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParsePI (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
xmlChar **value);
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseNotationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
XMLPUBFUN int XMLCALL
xmlParseAttributeType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
XMLPUBFUN void XMLCALL
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementMixedContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementChildrenContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
XMLPUBFUN int XMLCALL
xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlElementContentPtr *result);
XMLPUBFUN int XMLCALL
xmlParseElementDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseCharRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlParseEntityRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParsePEReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN const xmlChar * XMLCALL
xmlParseAttribute (xmlParserCtxtPtr ctxt,
xmlChar **value);
XMLPUBFUN const xmlChar * XMLCALL
xmlParseStartTag (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseEndTag (xmlParserCtxtPtr ctxt);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN void XMLCALL
xmlParseCDSect (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseContent (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseElement (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionNum (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseEncName (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL
xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseSDDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseTextDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseMisc (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
const xmlChar *ExternalID,
const xmlChar *SystemID);
/**
* XML_SUBSTITUTE_NONE:
*
* If no entities need to be substituted.
*/
#define XML_SUBSTITUTE_NONE 0
/**
* XML_SUBSTITUTE_REF:
*
* Whether general entities need to be substituted.
*/
#define XML_SUBSTITUTE_REF 1
/**
* XML_SUBSTITUTE_PEREF:
*
* Whether parameter entities need to be substituted.
*/
#define XML_SUBSTITUTE_PEREF 2
/**
* XML_SUBSTITUTE_BOTH:
*
* Both general and parameter entities need to be substituted.
*/
#define XML_SUBSTITUTE_BOTH 3
XMLPUBFUN xmlChar * XMLCALL
xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
XMLPUBFUN xmlChar * XMLCALL
xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
/*
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
*/
XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
xmlNodePtr value);
XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value);
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
const xmlChar *value);
/*
* other commodities shared between parser.c and parserInternals.
*/
XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
int *len);
XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang);
/*
* Really core function shared with HTML parser.
*/
XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt,
int *len);
XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
int val);
XMLPUBFUN int XMLCALL xmlCopyChar (int len,
xmlChar *out,
int val);
XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
#ifdef LIBXML_HTML_ENABLED
/*
* Actually comes from the HTML parser but launched from the init stuff.
*/
XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
const char *encoding);
#endif
/*
* Specific function to keep track of entities references
* and used by the XSLT debugger.
*/
#ifdef LIBXML_LEGACY_ENABLED
/**
* xmlEntityReferenceFunc:
* @ent: the entity
* @firstNode: the fist node in the chunk
* @lastNode: the last nod in the chunk
*
* Callback function used when one needs to be able to track back the
* provenance of a chunk of nodes inherited from an entity replacement.
*/
typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
xmlNodePtr firstNode,
xmlNodePtr lastNode);
XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
XMLPUBFUN xmlChar * XMLCALL
xmlParseQuotedString (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseNamespace (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlScanName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
xmlChar **prefix);
/**
* Entities
*/
XMLPUBFUN xmlChar * XMLCALL
xmlDecodeEntities (xmlParserCtxtPtr ctxt,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
XMLPUBFUN void XMLCALL
xmlHandleEntity (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
#endif /* LIBXML_LEGACY_ENABLED */
#ifdef IN_LIBXML
/*
* internal only
*/
XMLPUBFUN void XMLCALL
xmlErrMemory (xmlParserCtxtPtr ctxt,
const char *extra);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_PARSER_INTERNALS_H__ */

View File

@ -0,0 +1,100 @@
/*
* Summary: pattern expression handling
* Description: allows to compile and test pattern expressions for nodes
* either in a tree or based on a parser state.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_PATTERN_H__
#define __XML_PATTERN_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/dict.h>
#ifdef LIBXML_PATTERN_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlPattern:
*
* A compiled (XPath based) pattern to select nodes
*/
typedef struct _xmlPattern xmlPattern;
typedef xmlPattern *xmlPatternPtr;
/**
* xmlPatternFlags:
*
* This is the set of options affecting the behaviour of pattern
* matching with this module
*
*/
typedef enum {
XML_PATTERN_DEFAULT = 0, /* simple pattern match */
XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */
XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
} xmlPatternFlags;
XMLPUBFUN void XMLCALL
xmlFreePattern (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL
xmlFreePatternList (xmlPatternPtr comp);
XMLPUBFUN xmlPatternPtr XMLCALL
xmlPatterncompile (const xmlChar *pattern,
xmlDict *dict,
int flags,
const xmlChar **namespaces);
XMLPUBFUN int XMLCALL
xmlPatternMatch (xmlPatternPtr comp,
xmlNodePtr node);
/* streaming interfaces */
typedef struct _xmlStreamCtxt xmlStreamCtxt;
typedef xmlStreamCtxt *xmlStreamCtxtPtr;
XMLPUBFUN int XMLCALL
xmlPatternStreamable (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternMaxDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternMinDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternFromRoot (xmlPatternPtr comp);
XMLPUBFUN xmlStreamCtxtPtr XMLCALL
xmlPatternGetStreamCtxt (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL
xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL
xmlStreamPushNode (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns,
int nodeType);
XMLPUBFUN int XMLCALL
xmlStreamPush (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlStreamPushAttr (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlStreamPop (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL
xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_PATTERN_ENABLED */
#endif /* __XML_PATTERN_H__ */

View File

@ -0,0 +1,213 @@
/*
* Summary: implementation of the Relax-NG validation
* Description: implementation of the Relax-NG validation
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_RELAX_NG__
#define __XML_RELAX_NG__
#include <libxml/xmlversion.h>
#include <libxml/hash.h>
#include <libxml/xmlstring.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlRelaxNG xmlRelaxNG;
typedef xmlRelaxNG *xmlRelaxNGPtr;
/**
* xmlRelaxNGValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from a Relax-NG validation
*/
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlRelaxNGValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from a Relax-NG validation
*/
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* A schemas validation context
*/
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr;
/*
* xmlRelaxNGValidErr:
*
* List of possible Relax NG validation errors
*/
typedef enum {
XML_RELAXNG_OK = 0,
XML_RELAXNG_ERR_MEMORY,
XML_RELAXNG_ERR_TYPE,
XML_RELAXNG_ERR_TYPEVAL,
XML_RELAXNG_ERR_DUPID,
XML_RELAXNG_ERR_TYPECMP,
XML_RELAXNG_ERR_NOSTATE,
XML_RELAXNG_ERR_NODEFINE,
XML_RELAXNG_ERR_LISTEXTRA,
XML_RELAXNG_ERR_LISTEMPTY,
XML_RELAXNG_ERR_INTERNODATA,
XML_RELAXNG_ERR_INTERSEQ,
XML_RELAXNG_ERR_INTEREXTRA,
XML_RELAXNG_ERR_ELEMNAME,
XML_RELAXNG_ERR_ATTRNAME,
XML_RELAXNG_ERR_ELEMNONS,
XML_RELAXNG_ERR_ATTRNONS,
XML_RELAXNG_ERR_ELEMWRONGNS,
XML_RELAXNG_ERR_ATTRWRONGNS,
XML_RELAXNG_ERR_ELEMEXTRANS,
XML_RELAXNG_ERR_ATTREXTRANS,
XML_RELAXNG_ERR_ELEMNOTEMPTY,
XML_RELAXNG_ERR_NOELEM,
XML_RELAXNG_ERR_NOTELEM,
XML_RELAXNG_ERR_ATTRVALID,
XML_RELAXNG_ERR_CONTENTVALID,
XML_RELAXNG_ERR_EXTRACONTENT,
XML_RELAXNG_ERR_INVALIDATTR,
XML_RELAXNG_ERR_DATAELEM,
XML_RELAXNG_ERR_VALELEM,
XML_RELAXNG_ERR_LISTELEM,
XML_RELAXNG_ERR_DATATYPE,
XML_RELAXNG_ERR_VALUE,
XML_RELAXNG_ERR_LIST,
XML_RELAXNG_ERR_NOGRAMMAR,
XML_RELAXNG_ERR_EXTRADATA,
XML_RELAXNG_ERR_LACKDATA,
XML_RELAXNG_ERR_INTERNAL,
XML_RELAXNG_ERR_ELEMWRONG,
XML_RELAXNG_ERR_TEXTWRONG
} xmlRelaxNGValidErr;
/*
* xmlRelaxNGParserFlags:
*
* List of possible Relax NG Parser flags
*/
typedef enum {
XML_RELAXNGP_NONE = 0,
XML_RELAXNGP_FREE_DOC = 1,
XML_RELAXNGP_CRNG = 2
} xmlRelaxNGParserFlag;
XMLPUBFUN int XMLCALL
xmlRelaxNGInitTypes (void);
XMLPUBFUN void XMLCALL
xmlRelaxNGCleanupTypes (void);
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewParserCtxt (const char *URL);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt,
int flag);
XMLPUBFUN void XMLCALL
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserStructuredErrors(
xmlRelaxNGParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN xmlRelaxNGPtr XMLCALL
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlRelaxNGFree (xmlRelaxNGPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlRelaxNGDump (FILE *output,
xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
xmlRelaxNGDumpTree (FILE * output,
xmlRelaxNGPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror, void *ctx);
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc);
/*
* Interfaces for progressive validation when possible
*/
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_RELAX_NG__ */

View File

@ -0,0 +1,958 @@
/*
* Summary: internal interfaces for XML Schemas
* Description: internal interfaces for the XML Schemas handling
* and schema validity checking
* The Schemas development is a Work In Progress.
* Some of those interfaces are not garanteed to be API or ABI stable !
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_INTERNALS_H__
#define __XML_SCHEMA_INTERNALS_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/xmlregexp.h>
#include <libxml/hash.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMAS_UNKNOWN = 0,
XML_SCHEMAS_STRING,
XML_SCHEMAS_NORMSTRING,
XML_SCHEMAS_DECIMAL,
XML_SCHEMAS_TIME,
XML_SCHEMAS_GDAY,
XML_SCHEMAS_GMONTH,
XML_SCHEMAS_GMONTHDAY,
XML_SCHEMAS_GYEAR,
XML_SCHEMAS_GYEARMONTH,
XML_SCHEMAS_DATE,
XML_SCHEMAS_DATETIME,
XML_SCHEMAS_DURATION,
XML_SCHEMAS_FLOAT,
XML_SCHEMAS_DOUBLE,
XML_SCHEMAS_BOOLEAN,
XML_SCHEMAS_TOKEN,
XML_SCHEMAS_LANGUAGE,
XML_SCHEMAS_NMTOKEN,
XML_SCHEMAS_NMTOKENS,
XML_SCHEMAS_NAME,
XML_SCHEMAS_QNAME,
XML_SCHEMAS_NCNAME,
XML_SCHEMAS_ID,
XML_SCHEMAS_IDREF,
XML_SCHEMAS_IDREFS,
XML_SCHEMAS_ENTITY,
XML_SCHEMAS_ENTITIES,
XML_SCHEMAS_NOTATION,
XML_SCHEMAS_ANYURI,
XML_SCHEMAS_INTEGER,
XML_SCHEMAS_NPINTEGER,
XML_SCHEMAS_NINTEGER,
XML_SCHEMAS_NNINTEGER,
XML_SCHEMAS_PINTEGER,
XML_SCHEMAS_INT,
XML_SCHEMAS_UINT,
XML_SCHEMAS_LONG,
XML_SCHEMAS_ULONG,
XML_SCHEMAS_SHORT,
XML_SCHEMAS_USHORT,
XML_SCHEMAS_BYTE,
XML_SCHEMAS_UBYTE,
XML_SCHEMAS_HEXBINARY,
XML_SCHEMAS_BASE64BINARY,
XML_SCHEMAS_ANYTYPE,
XML_SCHEMAS_ANYSIMPLETYPE
} xmlSchemaValType;
/*
* XML Schemas defines multiple type of types.
*/
typedef enum {
XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */
XML_SCHEMA_TYPE_ANY,
XML_SCHEMA_TYPE_FACET,
XML_SCHEMA_TYPE_SIMPLE,
XML_SCHEMA_TYPE_COMPLEX,
XML_SCHEMA_TYPE_SEQUENCE = 6,
XML_SCHEMA_TYPE_CHOICE,
XML_SCHEMA_TYPE_ALL,
XML_SCHEMA_TYPE_SIMPLE_CONTENT,
XML_SCHEMA_TYPE_COMPLEX_CONTENT,
XML_SCHEMA_TYPE_UR,
XML_SCHEMA_TYPE_RESTRICTION,
XML_SCHEMA_TYPE_EXTENSION,
XML_SCHEMA_TYPE_ELEMENT,
XML_SCHEMA_TYPE_ATTRIBUTE,
XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
XML_SCHEMA_TYPE_GROUP,
XML_SCHEMA_TYPE_NOTATION,
XML_SCHEMA_TYPE_LIST,
XML_SCHEMA_TYPE_UNION,
XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
XML_SCHEMA_TYPE_IDC_UNIQUE,
XML_SCHEMA_TYPE_IDC_KEY,
XML_SCHEMA_TYPE_IDC_KEYREF,
XML_SCHEMA_TYPE_PARTICLE = 25,
XML_SCHEMA_TYPE_ATTRIBUTE_USE,
XML_SCHEMA_FACET_MININCLUSIVE = 1000,
XML_SCHEMA_FACET_MINEXCLUSIVE,
XML_SCHEMA_FACET_MAXINCLUSIVE,
XML_SCHEMA_FACET_MAXEXCLUSIVE,
XML_SCHEMA_FACET_TOTALDIGITS,
XML_SCHEMA_FACET_FRACTIONDIGITS,
XML_SCHEMA_FACET_PATTERN,
XML_SCHEMA_FACET_ENUMERATION,
XML_SCHEMA_FACET_WHITESPACE,
XML_SCHEMA_FACET_LENGTH,
XML_SCHEMA_FACET_MAXLENGTH,
XML_SCHEMA_FACET_MINLENGTH,
XML_SCHEMA_EXTRA_QNAMEREF = 2000,
XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
} xmlSchemaTypeType;
typedef enum {
XML_SCHEMA_CONTENT_UNKNOWN = 0,
XML_SCHEMA_CONTENT_EMPTY = 1,
XML_SCHEMA_CONTENT_ELEMENTS,
XML_SCHEMA_CONTENT_MIXED,
XML_SCHEMA_CONTENT_SIMPLE,
XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */
XML_SCHEMA_CONTENT_BASIC,
XML_SCHEMA_CONTENT_ANY
} xmlSchemaContentType;
typedef struct _xmlSchemaVal xmlSchemaVal;
typedef xmlSchemaVal *xmlSchemaValPtr;
typedef struct _xmlSchemaType xmlSchemaType;
typedef xmlSchemaType *xmlSchemaTypePtr;
typedef struct _xmlSchemaFacet xmlSchemaFacet;
typedef xmlSchemaFacet *xmlSchemaFacetPtr;
/**
* Annotation
*/
typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
struct _xmlSchemaAnnot {
struct _xmlSchemaAnnot *next;
xmlNodePtr content; /* the annotation */
};
/**
* XML_SCHEMAS_ANYATTR_SKIP:
*
* Skip unknown attribute from validation
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_SKIP 1
/**
* XML_SCHEMAS_ANYATTR_LAX:
*
* Ignore validation non definition on attributes
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_LAX 2
/**
* XML_SCHEMAS_ANYATTR_STRICT:
*
* Apply strict validation rules on attributes
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_STRICT 3
/**
* XML_SCHEMAS_ANY_SKIP:
*
* Skip unknown attribute from validation
*/
#define XML_SCHEMAS_ANY_SKIP 1
/**
* XML_SCHEMAS_ANY_LAX:
*
* Used by wildcards.
* Validate if type found, don't worry if not found
*/
#define XML_SCHEMAS_ANY_LAX 2
/**
* XML_SCHEMAS_ANY_STRICT:
*
* Used by wildcards.
* Apply strict validation rules
*/
#define XML_SCHEMAS_ANY_STRICT 3
/**
* XML_SCHEMAS_ATTR_USE_PROHIBITED:
*
* Used by wildcards.
* The attribute is prohibited.
*/
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
/**
* XML_SCHEMAS_ATTR_USE_REQUIRED:
*
* The attribute is required.
*/
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
/**
* XML_SCHEMAS_ATTR_USE_OPTIONAL:
*
* The attribute is optional.
*/
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
/**
* XML_SCHEMAS_ATTR_GLOBAL:
*
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
/**
* XML_SCHEMAS_ATTR_NSDEFAULT:
*
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
/**
* XML_SCHEMAS_ATTR_INTERNAL_RESOLVED:
*
* this is set when the "type" and "ref" references
* have been resolved.
*/
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8
/**
* XML_SCHEMAS_ATTR_FIXED:
*
* the attribute has a fixed value
*/
#define XML_SCHEMAS_ATTR_FIXED 1 << 9
/**
* xmlSchemaAttribute:
* An attribute definition.
*/
typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
struct _xmlSchemaAttribute {
xmlSchemaTypeType type;
struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */
const xmlChar *name; /* the name of the declaration */
const xmlChar *id; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
const xmlChar *typeName; /* the local name of the type definition */
const xmlChar *typeNs; /* the ns URI of the type definition */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr base; /* Deprecated; not used */
int occurs; /* Deprecated; not used */
const xmlChar *defValue; /* The initial value of the value constraint */
xmlSchemaTypePtr subtypes; /* the type definition */
xmlNodePtr node;
const xmlChar *targetNamespace;
int flags;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaValPtr defVal; /* The compiled value constraint */
xmlSchemaAttributePtr refDecl; /* Deprecated; not used */
};
/**
* xmlSchemaAttributeLink:
* Used to build a list of attribute uses on complexType definitions.
* WARNING: Deprecated; not used.
*/
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
struct _xmlSchemaAttributeLink {
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
struct _xmlSchemaAttribute *attr;/* the linked attribute */
};
/**
* XML_SCHEMAS_WILDCARD_COMPLETE:
*
* If the wildcard is complete.
*/
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
/**
* xmlSchemaCharValueLink:
* Used to build a list of namespaces on wildcards.
*/
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
struct _xmlSchemaWildcardNs {
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
const xmlChar *value;/* the value */
};
/**
* xmlSchemaWildcard.
* A wildcard.
*/
typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
struct _xmlSchemaWildcard {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *id; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int processContents;
int any; /* Indicates if the ns constraint is of ##any */
xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */
xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */
int flags;
};
/**
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
*
* The attribute wildcard has been already builded.
*/
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
/**
* XML_SCHEMAS_ATTRGROUP_GLOBAL:
*
* The attribute wildcard has been already builded.
*/
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
/**
* XML_SCHEMAS_ATTRGROUP_MARKED:
*
* Marks the attr group as marked; used for circular checks.
*/
#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
/**
* XML_SCHEMAS_ATTRGROUP_REDEFINED:
*
* The attr group was redefined.
*/
#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
/**
* XML_SCHEMAS_ATTRGROUP_HAS_REFS:
*
* Whether this attr. group contains attr. group references.
*/
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
/**
* An attribute group definition.
*
* xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
* must be kept similar
*/
typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
struct _xmlSchemaAttributeGroup {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
const xmlChar *name;
const xmlChar *id;
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
xmlNodePtr node;
int flags;
xmlSchemaWildcardPtr attributeWildcard;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */
const xmlChar *targetNamespace;
void *attrUses;
};
/**
* xmlSchemaTypeLink:
* Used to build a list of types (e.g. member types of
* simpleType with variety "union").
*/
typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
struct _xmlSchemaTypeLink {
struct _xmlSchemaTypeLink *next;/* the next type link ... */
xmlSchemaTypePtr type;/* the linked type */
};
/**
* xmlSchemaFacetLink:
* Used to build a list of facets.
*/
typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
struct _xmlSchemaFacetLink {
struct _xmlSchemaFacetLink *next;/* the next facet link ... */
xmlSchemaFacetPtr facet;/* the linked facet */
};
/**
* XML_SCHEMAS_TYPE_MIXED:
*
* the element content type is mixed
*/
#define XML_SCHEMAS_TYPE_MIXED 1 << 0
/**
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION:
*
* the simple or complex type has a derivation method of "extension".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
/**
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION:
*
* the simple or complex type has a derivation method of "restriction".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
/**
* XML_SCHEMAS_TYPE_GLOBAL:
*
* the type is global
*/
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
/**
* XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD:
*
* the complexType owns an attribute wildcard, i.e.
* it can be freed by the complexType
*/
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */
/**
* XML_SCHEMAS_TYPE_VARIETY_ABSENT:
*
* the simpleType has a variety of "absent".
* TODO: Actually not necessary :-/, since if
* none of the variety flags occur then it's
* automatically absent.
*/
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5
/**
* XML_SCHEMAS_TYPE_VARIETY_LIST:
*
* the simpleType has a variety of "list".
*/
#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6
/**
* XML_SCHEMAS_TYPE_VARIETY_UNION:
*
* the simpleType has a variety of "union".
*/
#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7
/**
* XML_SCHEMAS_TYPE_VARIETY_ATOMIC:
*
* the simpleType has a variety of "union".
*/
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8
/**
* XML_SCHEMAS_TYPE_FINAL_EXTENSION:
*
* the complexType has a final of "extension".
*/
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9
/**
* XML_SCHEMAS_TYPE_FINAL_RESTRICTION:
*
* the simpleType/complexType has a final of "restriction".
*/
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10
/**
* XML_SCHEMAS_TYPE_FINAL_LIST:
*
* the simpleType has a final of "list".
*/
#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11
/**
* XML_SCHEMAS_TYPE_FINAL_UNION:
*
* the simpleType has a final of "union".
*/
#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12
/**
* XML_SCHEMAS_TYPE_FINAL_DEFAULT:
*
* the simpleType has a final of "default".
*/
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13
/**
* XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE:
*
* Marks the item as a builtin primitive.
*/
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14
/**
* XML_SCHEMAS_TYPE_MARKED:
*
* Marks the item as marked; used for circular checks.
*/
#define XML_SCHEMAS_TYPE_MARKED 1 << 16
/**
* XML_SCHEMAS_TYPE_BLOCK_DEFAULT:
*
* the complexType did not specify 'block' so use the default of the
* <schema> item.
*/
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17
/**
* XML_SCHEMAS_TYPE_BLOCK_EXTENSION:
*
* the complexType has a 'block' of "extension".
*/
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18
/**
* XML_SCHEMAS_TYPE_BLOCK_RESTRICTION:
*
* the complexType has a 'block' of "restriction".
*/
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19
/**
* XML_SCHEMAS_TYPE_ABSTRACT:
*
* the simple/complexType is abstract.
*/
#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20
/**
* XML_SCHEMAS_TYPE_FACETSNEEDVALUE:
*
* indicates if the facets need a computed value
*/
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21
/**
* XML_SCHEMAS_TYPE_INTERNAL_RESOLVED:
*
* indicates that the type was typefixed
*/
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22
/**
* XML_SCHEMAS_TYPE_INTERNAL_INVALID:
*
* indicates that the type is invalid
*/
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23
/**
* XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE:
*
* a whitespace-facet value of "preserve"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24
/**
* XML_SCHEMAS_TYPE_WHITESPACE_REPLACE:
*
* a whitespace-facet value of "replace"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25
/**
* XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE:
*
* a whitespace-facet value of "collapse"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26
/**
* XML_SCHEMAS_TYPE_HAS_FACETS:
*
* has facets
*/
#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27
/**
* XML_SCHEMAS_TYPE_NORMVALUENEEDED:
*
* indicates if the facets (pattern) need a normalized value
*/
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28
/**
* XML_SCHEMAS_TYPE_FIXUP_1:
*
* First stage of fixup was done.
*/
#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29
/**
* XML_SCHEMAS_TYPE_REDEFINED:
*
* The type was redefined.
*/
#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30
/**
* XML_SCHEMAS_TYPE_REDEFINING:
*
* The type redefines an other type.
*/
/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */
/**
* _xmlSchemaType:
*
* Schemas type definition.
*/
struct _xmlSchemaType {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next; /* the next type if in a sequence ... */
const xmlChar *name;
const xmlChar *id ; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr subtypes;
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int flags;
xmlSchemaContentType contentType;
const xmlChar *base; /* Base type's local name */
const xmlChar *baseNs; /* Base type's target namespace */
xmlSchemaTypePtr baseType; /* The base type component */
xmlSchemaFacetPtr facets; /* Local facets */
struct _xmlSchemaType *redef; /* Deprecated; not used */
int recurse; /* Obsolete */
xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */
xmlSchemaWildcardPtr attributeWildcard;
int builtInType; /* Type of built-in types. */
xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */
xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types.
Could we use @subtypes for this? */
xmlRegexpPtr contModel; /* Holds the automaton of the content model */
const xmlChar *targetNamespace;
void *attrUses;
};
/*
* xmlSchemaElement:
* An element definition.
*
* xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
* structures must be kept similar
*/
/**
* XML_SCHEMAS_ELEM_NILLABLE:
*
* the element is nillable
*/
#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
/**
* XML_SCHEMAS_ELEM_GLOBAL:
*
* the element is global
*/
#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
/**
* XML_SCHEMAS_ELEM_DEFAULT:
*
* the element has a default value
*/
#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
/**
* XML_SCHEMAS_ELEM_FIXED:
*
* the element has a fixed value
*/
#define XML_SCHEMAS_ELEM_FIXED 1 << 3
/**
* XML_SCHEMAS_ELEM_ABSTRACT:
*
* the element is abstract
*/
#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
/**
* XML_SCHEMAS_ELEM_TOPLEVEL:
*
* the element is top level
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
*/
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
/**
* XML_SCHEMAS_ELEM_REF:
*
* the element is a reference to a type
*/
#define XML_SCHEMAS_ELEM_REF 1 << 6
/**
* XML_SCHEMAS_ELEM_NSDEFAULT:
*
* allow elements in no namespace
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
/**
* XML_SCHEMAS_ELEM_INTERNAL_RESOLVED:
*
* this is set when "type", "ref", "substitutionGroup"
* references have been resolved.
*/
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
/**
* XML_SCHEMAS_ELEM_CIRCULAR:
*
* a helper flag for the search of circular references.
*/
#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
/**
* XML_SCHEMAS_ELEM_BLOCK_ABSENT:
*
* the "block" attribute is absent
*/
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
/**
* XML_SCHEMAS_ELEM_BLOCK_EXTENSION:
*
* disallowed substitutions are absent
*/
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
/**
* XML_SCHEMAS_ELEM_BLOCK_RESTRICTION:
*
* disallowed substitutions: "restriction"
*/
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
/**
* XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
*
* disallowed substitutions: "substituion"
*/
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
/**
* XML_SCHEMAS_ELEM_FINAL_ABSENT:
*
* substitution group exclusions are absent
*/
#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
/**
* XML_SCHEMAS_ELEM_FINAL_EXTENSION:
*
* substitution group exclusions: "extension"
*/
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
/**
* XML_SCHEMAS_ELEM_FINAL_RESTRICTION:
*
* substitution group exclusions: "restriction"
*/
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
/**
* XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD:
*
* the declaration is a substitution group head
*/
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17
/**
* XML_SCHEMAS_ELEM_INTERNAL_CHECKED:
*
* this is set when the elem decl has been checked against
* all constraints
*/
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18
typedef struct _xmlSchemaElement xmlSchemaElement;
typedef xmlSchemaElement *xmlSchemaElementPtr;
struct _xmlSchemaElement {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next; /* Not used? */
const xmlChar *name;
const xmlChar *id; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr subtypes; /* the type definition */
xmlSchemaAttributePtr attributes;
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int flags;
const xmlChar *targetNamespace;
const xmlChar *namedType;
const xmlChar *namedTypeNs;
const xmlChar *substGroup;
const xmlChar *substGroupNs;
const xmlChar *scope;
const xmlChar *value; /* The original value of the value constraint. */
struct _xmlSchemaElement *refDecl; /* This will now be used for the
substitution group affiliation */
xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */
xmlSchemaContentType contentType;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaValPtr defVal; /* The compiled value contraint. */
void *idcs; /* The identity-constraint defs */
};
/*
* XML_SCHEMAS_FACET_UNKNOWN:
*
* unknown facet handling
*/
#define XML_SCHEMAS_FACET_UNKNOWN 0
/*
* XML_SCHEMAS_FACET_PRESERVE:
*
* preserve the type of the facet
*/
#define XML_SCHEMAS_FACET_PRESERVE 1
/*
* XML_SCHEMAS_FACET_REPLACE:
*
* replace the type of the facet
*/
#define XML_SCHEMAS_FACET_REPLACE 2
/*
* XML_SCHEMAS_FACET_COLLAPSE:
*
* collapse the types of the facet
*/
#define XML_SCHEMAS_FACET_COLLAPSE 3
/**
* A facet definition.
*/
struct _xmlSchemaFacet {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
const xmlChar *value; /* The original value */
const xmlChar *id; /* Obsolete */
xmlSchemaAnnotPtr annot;
xmlNodePtr node;
int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
int whitespace;
xmlSchemaValPtr val; /* The compiled value */
xmlRegexpPtr regexp; /* The regex for patterns */
};
/**
* A notation definition.
*/
typedef struct _xmlSchemaNotation xmlSchemaNotation;
typedef xmlSchemaNotation *xmlSchemaNotationPtr;
struct _xmlSchemaNotation {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *name;
xmlSchemaAnnotPtr annot;
const xmlChar *identifier;
const xmlChar *targetNamespace;
};
/*
* TODO: Actually all those flags used for the schema should sit
* on the schema parser context, since they are used only
* during parsing an XML schema document, and not available
* on the component level as per spec.
*/
/**
* XML_SCHEMAS_QUALIF_ELEM:
*
* Reflects elementFormDefault == qualified in
* an XML schema document.
*/
#define XML_SCHEMAS_QUALIF_ELEM 1 << 0
/**
* XML_SCHEMAS_QUALIF_ATTR:
*
* Reflects attributeFormDefault == qualified in
* an XML schema document.
*/
#define XML_SCHEMAS_QUALIF_ATTR 1 << 1
/**
* XML_SCHEMAS_FINAL_DEFAULT_EXTENSION:
*
* the schema has "extension" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
/**
* XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION:
*
* the schema has "restriction" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
/**
* XML_SCHEMAS_FINAL_DEFAULT_LIST:
*
* the cshema has "list" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
/**
* XML_SCHEMAS_FINAL_DEFAULT_UNION:
*
* the schema has "union" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
/**
* XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION:
*
* the schema has "extension" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
/**
* XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION:
*
* the schema has "restriction" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
/**
* XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION:
*
* the schema has "substitution" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
/**
* XML_SCHEMAS_INCLUDING_CONVERT_NS:
*
* the schema is currently including an other schema with
* no target namespace.
*/
#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
/**
* _xmlSchema:
*
* A Schemas definition
*/
struct _xmlSchema {
const xmlChar *name; /* schema name */
const xmlChar *targetNamespace; /* the target namespace */
const xmlChar *version;
const xmlChar *id; /* Obsolete */
xmlDocPtr doc;
xmlSchemaAnnotPtr annot;
int flags;
xmlHashTablePtr typeDecl;
xmlHashTablePtr attrDecl;
xmlHashTablePtr attrgrpDecl;
xmlHashTablePtr elemDecl;
xmlHashTablePtr notaDecl;
xmlHashTablePtr schemasImports;
void *_private; /* unused by the library for users or bindings */
xmlHashTablePtr groupDecl;
xmlDictPtr dict;
void *includes; /* the includes, this is opaque for now */
int preserve; /* whether to free the document */
int counter; /* used to give ononymous components unique names */
xmlHashTablePtr idcDef; /* All identity-constraint defs. */
void *volatiles; /* Obsolete */
};
XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_INTERNALS_H__ */

View File

@ -0,0 +1,142 @@
/*
* Summary: XML Schemastron implementation
* Description: interface to the XML Schematron validity checking.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMATRON_H__
#define __XML_SCHEMATRON_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMATRON_ENABLED
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */
XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */
XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */
XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */
XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */
XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
} xmlSchematronValidOptions;
/**
* The schemas related types are kept internal
*/
typedef struct _xmlSchematron xmlSchematron;
typedef xmlSchematron *xmlSchematronPtr;
/**
* xmlSchematronValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from a Schematron validation
*/
typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
/**
* xmlSchematronValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from a Schematron validation
*/
typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
/**
* A schemas validation context
*/
typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewMemParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
/*****
XMLPUBFUN void XMLCALL
xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
xmlSchematronValidityErrorFunc * err,
xmlSchematronValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
*****/
XMLPUBFUN xmlSchematronPtr XMLCALL
xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchematronFree (xmlSchematronPtr schema);
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlSchematronSetValidStructuredErrors(
xmlSchematronValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
/******
XMLPUBFUN void XMLCALL
xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityErrorFunc *err,
xmlSchematronValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
xmlNodePtr elem);
*******/
XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
int options);
XMLPUBFUN void XMLCALL
xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
xmlDocPtr instance);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMATRON_ENABLED */
#endif /* __XML_SCHEMATRON_H__ */

View File

@ -0,0 +1,84 @@
/**
* Summary: interfaces for thread handling
* Description: set of generic threading related routines
* should work with pthreads, Windows native or TLS threads
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_THREADS_H__
#define __XML_THREADS_H__
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* xmlMutex are a simple mutual exception locks.
*/
typedef struct _xmlMutex xmlMutex;
typedef xmlMutex *xmlMutexPtr;
/*
* xmlRMutex are reentrant mutual exception locks.
*/
typedef struct _xmlRMutex xmlRMutex;
typedef xmlRMutex *xmlRMutexPtr;
#ifdef __cplusplus
}
#endif
#include <libxml/globals.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN xmlMutexPtr XMLCALL
xmlNewMutex (void);
XMLPUBFUN void XMLCALL
xmlMutexLock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlMutexUnlock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlFreeMutex (xmlMutexPtr tok);
XMLPUBFUN xmlRMutexPtr XMLCALL
xmlNewRMutex (void);
XMLPUBFUN void XMLCALL
xmlRMutexLock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlRMutexUnlock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlFreeRMutex (xmlRMutexPtr tok);
/*
* Library wide APIs.
*/
XMLPUBFUN void XMLCALL
xmlInitThreads (void);
XMLPUBFUN void XMLCALL
xmlLockLibrary (void);
XMLPUBFUN void XMLCALL
xmlUnlockLibrary(void);
XMLPUBFUN int XMLCALL
xmlGetThreadId (void);
XMLPUBFUN int XMLCALL
xmlIsMainThread (void);
XMLPUBFUN void XMLCALL
xmlCleanupThreads(void);
XMLPUBFUN xmlGlobalStatePtr XMLCALL
xmlGetGlobalState(void);
#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_THREADS_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
/**
* Summary: library of generic URI related routines
* Description: library of generic URI related routines
* Implements RFC 2396
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_URI_H__
#define __XML_URI_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlURI:
*
* A parsed URI reference. This is a struct containing the various fields
* as described in RFC 2396 but separated for further processing.
*
* Note: query is a deprecated field which is incorrectly unescaped.
* query_raw takes precedence over query if the former is set.
* See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127
*/
typedef struct _xmlURI xmlURI;
typedef xmlURI *xmlURIPtr;
struct _xmlURI {
char *scheme; /* the URI scheme */
char *opaque; /* opaque part */
char *authority; /* the authority part */
char *server; /* the server part */
char *user; /* the user part */
int port; /* the port number */
char *path; /* the path string */
char *query; /* the query string (deprecated - use with caution) */
char *fragment; /* the fragment identifier */
int cleanup; /* parsing potentially unclean URI */
char *query_raw; /* the query string (as it appears in the URI) */
};
/*
* This function is in tree.h:
* xmlChar * xmlNodeGetBase (xmlDocPtr doc,
* xmlNodePtr cur);
*/
XMLPUBFUN xmlURIPtr XMLCALL
xmlCreateURI (void);
XMLPUBFUN xmlChar * XMLCALL
xmlBuildURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlChar * XMLCALL
xmlBuildRelativeURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlURIPtr XMLCALL
xmlParseURI (const char *str);
XMLPUBFUN xmlURIPtr XMLCALL
xmlParseURIRaw (const char *str,
int raw);
XMLPUBFUN int XMLCALL
xmlParseURIReference (xmlURIPtr uri,
const char *str);
XMLPUBFUN xmlChar * XMLCALL
xmlSaveUri (xmlURIPtr uri);
XMLPUBFUN void XMLCALL
xmlPrintURI (FILE *stream,
xmlURIPtr uri);
XMLPUBFUN xmlChar * XMLCALL
xmlURIEscapeStr (const xmlChar *str,
const xmlChar *list);
XMLPUBFUN char * XMLCALL
xmlURIUnescapeString (const char *str,
int len,
char *target);
XMLPUBFUN int XMLCALL
xmlNormalizeURIPath (char *path);
XMLPUBFUN xmlChar * XMLCALL
xmlURIEscape (const xmlChar *str);
XMLPUBFUN void XMLCALL
xmlFreeURI (xmlURIPtr uri);
XMLPUBFUN xmlChar* XMLCALL
xmlCanonicPath (const xmlChar *path);
XMLPUBFUN xmlChar* XMLCALL
xmlPathToURI (const xmlChar *path);
#ifdef __cplusplus
}
#endif
#endif /* __XML_URI_H__ */

View File

@ -0,0 +1,458 @@
/*
* Summary: The DTD validation
* Description: API for the DTD handling and the validity checking
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_VALID_H__
#define __XML_VALID_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/list.h>
#include <libxml/xmlautomata.h>
#include <libxml/xmlregexp.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Validation state added for non-determinist content model.
*/
typedef struct _xmlValidState xmlValidState;
typedef xmlValidState *xmlValidStatePtr;
/**
* xmlValidityErrorFunc:
* @ctx: usually an xmlValidCtxtPtr to a validity error context,
* but comes from ctxt->userData (which normally contains such
* a pointer); ctxt->userData can be changed by the user.
* @msg: the string to format *printf like vararg
* @...: remaining arguments to the format
*
* Callback called when a validity error is found. This is a message
* oriented function similar to an *printf function.
*/
typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlValidityWarningFunc:
* @ctx: usually an xmlValidCtxtPtr to a validity error context,
* but comes from ctxt->userData (which normally contains such
* a pointer); ctxt->userData can be changed by the user.
* @msg: the string to format *printf like vararg
* @...: remaining arguments to the format
*
* Callback called when a validity warning is found. This is a message
* oriented function similar to an *printf function.
*/
typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
#ifdef IN_LIBXML
/**
* XML_CTXT_FINISH_DTD_0:
*
* Special value for finishDtd field when embedded in an xmlParserCtxt
*/
#define XML_CTXT_FINISH_DTD_0 0xabcd1234
/**
* XML_CTXT_FINISH_DTD_1:
*
* Special value for finishDtd field when embedded in an xmlParserCtxt
*/
#define XML_CTXT_FINISH_DTD_1 0xabcd1235
#endif
/*
* xmlValidCtxt:
* An xmlValidCtxt is used for error reporting when validating.
*/
typedef struct _xmlValidCtxt xmlValidCtxt;
typedef xmlValidCtxt *xmlValidCtxtPtr;
struct _xmlValidCtxt {
void *userData; /* user specific data block */
xmlValidityErrorFunc error; /* the callback in case of errors */
xmlValidityWarningFunc warning; /* the callback in case of warning */
/* Node analysis stack used when validating within entities */
xmlNodePtr node; /* Current parsed Node */
int nodeNr; /* Depth of the parsing stack */
int nodeMax; /* Max depth of the parsing stack */
xmlNodePtr *nodeTab; /* array of nodes */
unsigned int finishDtd; /* finished validating the Dtd ? */
xmlDocPtr doc; /* the document */
int valid; /* temporary validity check result */
/* state state used for non-determinist content validation */
xmlValidState *vstate; /* current state */
int vstateNr; /* Depth of the validation stack */
int vstateMax; /* Max depth of the validation stack */
xmlValidState *vstateTab; /* array of validation states */
#ifdef LIBXML_REGEXP_ENABLED
xmlAutomataPtr am; /* the automata */
xmlAutomataStatePtr state; /* used to build the automata */
#else
void *am;
void *state;
#endif
};
/*
* ALL notation declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlNotationTable;
typedef xmlNotationTable *xmlNotationTablePtr;
/*
* ALL element declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlElementTable;
typedef xmlElementTable *xmlElementTablePtr;
/*
* ALL attribute declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlAttributeTable;
typedef xmlAttributeTable *xmlAttributeTablePtr;
/*
* ALL IDs attributes are stored in a table.
* There is one table per document.
*/
typedef struct _xmlHashTable xmlIDTable;
typedef xmlIDTable *xmlIDTablePtr;
/*
* ALL Refs attributes are stored in a table.
* There is one table per document.
*/
typedef struct _xmlHashTable xmlRefTable;
typedef xmlRefTable *xmlRefTablePtr;
/* Notation */
XMLPUBFUN xmlNotationPtr XMLCALL
xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *PublicID,
const xmlChar *SystemID);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlNotationTablePtr XMLCALL
xmlCopyNotationTable (xmlNotationTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeNotationTable (xmlNotationTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpNotationDecl (xmlBufferPtr buf,
xmlNotationPtr nota);
XMLPUBFUN void XMLCALL
xmlDumpNotationTable (xmlBufferPtr buf,
xmlNotationTablePtr table);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Element Content */
/* the non Doc version are being deprecated */
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlNewElementContent (const xmlChar *name,
xmlElementContentType type);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlCopyElementContent (xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlFreeElementContent (xmlElementContentPtr cur);
/* the new versions with doc argument */
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlNewDocElementContent (xmlDocPtr doc,
const xmlChar *name,
xmlElementContentType type);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlCopyDocElementContent(xmlDocPtr doc,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlFreeDocElementContent(xmlDocPtr doc,
xmlElementContentPtr cur);
XMLPUBFUN void XMLCALL
xmlSnprintfElementContent(char *buf,
int size,
xmlElementContentPtr content,
int englob);
#ifdef LIBXML_OUTPUT_ENABLED
/* DEPRECATED */
XMLPUBFUN void XMLCALL
xmlSprintfElementContent(char *buf,
xmlElementContentPtr content,
int englob);
#endif /* LIBXML_OUTPUT_ENABLED */
/* DEPRECATED */
/* Element */
XMLPUBFUN xmlElementPtr XMLCALL
xmlAddElementDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *name,
xmlElementTypeVal type,
xmlElementContentPtr content);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlElementTablePtr XMLCALL
xmlCopyElementTable (xmlElementTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeElementTable (xmlElementTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpElementTable (xmlBufferPtr buf,
xmlElementTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpElementDecl (xmlBufferPtr buf,
xmlElementPtr elem);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Enumeration */
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlCreateEnumeration (const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlFreeEnumeration (xmlEnumerationPtr cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlCopyEnumeration (xmlEnumerationPtr cur);
#endif /* LIBXML_TREE_ENABLED */
/* Attribute */
XMLPUBFUN xmlAttributePtr XMLCALL
xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *ns,
xmlAttributeType type,
xmlAttributeDefault def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlAttributeTablePtr XMLCALL
xmlCopyAttributeTable (xmlAttributeTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeAttributeTable (xmlAttributeTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpAttributeTable (xmlBufferPtr buf,
xmlAttributeTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpAttributeDecl (xmlBufferPtr buf,
xmlAttributePtr attr);
#endif /* LIBXML_OUTPUT_ENABLED */
/* IDs */
XMLPUBFUN xmlIDPtr XMLCALL
xmlAddID (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XMLPUBFUN void XMLCALL
xmlFreeIDTable (xmlIDTablePtr table);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlGetID (xmlDocPtr doc,
const xmlChar *ID);
XMLPUBFUN int XMLCALL
xmlIsID (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XMLPUBFUN int XMLCALL
xmlRemoveID (xmlDocPtr doc,
xmlAttrPtr attr);
/* IDREFs */
XMLPUBFUN xmlRefPtr XMLCALL
xmlAddRef (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XMLPUBFUN void XMLCALL
xmlFreeRefTable (xmlRefTablePtr table);
XMLPUBFUN int XMLCALL
xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XMLPUBFUN int XMLCALL
xmlRemoveRef (xmlDocPtr doc,
xmlAttrPtr attr);
XMLPUBFUN xmlListPtr XMLCALL
xmlGetRefs (xmlDocPtr doc,
const xmlChar *ID);
/**
* The public function calls related to validity checking.
*/
#ifdef LIBXML_VALID_ENABLED
/* Allocate/Release Validation Contexts */
XMLPUBFUN xmlValidCtxtPtr XMLCALL
xmlNewValidCtxt(void);
XMLPUBFUN void XMLCALL
xmlFreeValidCtxt(xmlValidCtxtPtr);
XMLPUBFUN int XMLCALL
xmlValidateRoot (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlElementPtr elem);
XMLPUBFUN xmlChar * XMLCALL
xmlValidNormalizeAttributeValue(xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlAttributePtr attr);
XMLPUBFUN int XMLCALL
xmlValidateAttributeValue(xmlAttributeType type,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNotationPtr nota);
XMLPUBFUN int XMLCALL
xmlValidateDtd (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlDtdPtr dtd);
XMLPUBFUN int XMLCALL
xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateDocument (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlValidateOneElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *prefix,
xmlNsPtr ns,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
#endif /* LIBXML_VALID_ENABLED */
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN int XMLCALL
xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *notationName);
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
XMLPUBFUN int XMLCALL
xmlIsMixedElement (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlAttributePtr XMLCALL
xmlGetDtdAttrDesc (xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name);
XMLPUBFUN xmlAttributePtr XMLCALL
xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlNotationPtr XMLCALL
xmlGetDtdNotationDesc (xmlDtdPtr dtd,
const xmlChar *name);
XMLPUBFUN xmlElementPtr XMLCALL
xmlGetDtdQElementDesc (xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlElementPtr XMLCALL
xmlGetDtdElementDesc (xmlDtdPtr dtd,
const xmlChar *name);
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int XMLCALL
xmlValidGetPotentialChildren(xmlElementContent *ctree,
const xmlChar **names,
int *len,
int max);
XMLPUBFUN int XMLCALL
xmlValidGetValidElements(xmlNode *prev,
xmlNode *next,
const xmlChar **names,
int max);
XMLPUBFUN int XMLCALL
xmlValidateNameValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNamesValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNmtokenValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNmtokensValue(const xmlChar *value);
#ifdef LIBXML_REGEXP_ENABLED
/*
* Validation based on the regexp support
*/
XMLPUBFUN int XMLCALL
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
xmlElementPtr elem);
XMLPUBFUN int XMLCALL
xmlValidatePushElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
XMLPUBFUN int XMLCALL
xmlValidatePushCData (xmlValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
xmlValidatePopElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* LIBXML_VALID_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_VALID_H__ */

View File

@ -0,0 +1,129 @@
/*
* Summary: implementation of XInclude
* Description: API to handle XInclude processing,
* implements the
* World Wide Web Consortium Last Call Working Draft 10 November 2003
* http://www.w3.org/TR/2003/WD-xinclude-20031110
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XINCLUDE_H__
#define __XML_XINCLUDE_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_XINCLUDE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* XINCLUDE_NS:
*
* Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
*/
#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude"
/**
* XINCLUDE_OLD_NS:
*
* Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
*/
#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
/**
* XINCLUDE_NODE:
*
* Macro defining "include"
*/
#define XINCLUDE_NODE (const xmlChar *) "include"
/**
* XINCLUDE_FALLBACK:
*
* Macro defining "fallback"
*/
#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
/**
* XINCLUDE_HREF:
*
* Macro defining "href"
*/
#define XINCLUDE_HREF (const xmlChar *) "href"
/**
* XINCLUDE_PARSE:
*
* Macro defining "parse"
*/
#define XINCLUDE_PARSE (const xmlChar *) "parse"
/**
* XINCLUDE_PARSE_XML:
*
* Macro defining "xml"
*/
#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
/**
* XINCLUDE_PARSE_TEXT:
*
* Macro defining "text"
*/
#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
/**
* XINCLUDE_PARSE_ENCODING:
*
* Macro defining "encoding"
*/
#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
/**
* XINCLUDE_PARSE_XPOINTER:
*
* Macro defining "xpointer"
*/
#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer"
typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
/*
* standalone processing
*/
XMLPUBFUN int XMLCALL
xmlXIncludeProcess (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessFlags (xmlDocPtr doc,
int flags);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessFlagsData(xmlDocPtr doc,
int flags,
void *data);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
int flags,
void *data);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTree (xmlNodePtr tree);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
int flags);
/*
* contextual processing
*/
XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL
xmlXIncludeNewContext (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
int flags);
XMLPUBFUN void XMLCALL
xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
xmlNodePtr tree);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XINCLUDE_ENABLED */
#endif /* __XML_XINCLUDE_H__ */

View File

@ -0,0 +1,189 @@
/*
* Summary: unfinished XLink detection module
* Description: unfinished XLink detection module
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XLINK_H__
#define __XML_XLINK_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_XPTR_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* Various defines for the various Link properties.
*
* NOTE: the link detection layer will try to resolve QName expansion
* of namespaces. If "foo" is the prefix for "http://foo.com/"
* then the link detection layer will expand role="foo:myrole"
* to "http://foo.com/:myrole".
* NOTE: the link detection layer will expand URI-Refences found on
* href attributes by using the base mechanism if found.
*/
typedef xmlChar *xlinkHRef;
typedef xmlChar *xlinkRole;
typedef xmlChar *xlinkTitle;
typedef enum {
XLINK_TYPE_NONE = 0,
XLINK_TYPE_SIMPLE,
XLINK_TYPE_EXTENDED,
XLINK_TYPE_EXTENDED_SET
} xlinkType;
typedef enum {
XLINK_SHOW_NONE = 0,
XLINK_SHOW_NEW,
XLINK_SHOW_EMBED,
XLINK_SHOW_REPLACE
} xlinkShow;
typedef enum {
XLINK_ACTUATE_NONE = 0,
XLINK_ACTUATE_AUTO,
XLINK_ACTUATE_ONREQUEST
} xlinkActuate;
/**
* xlinkNodeDetectFunc:
* @ctx: user data pointer
* @node: the node to check
*
* This is the prototype for the link detection routine.
* It calls the default link detection callbacks upon link detection.
*/
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
/*
* The link detection module interact with the upper layers using
* a set of callback registered at parsing time.
*/
/**
* xlinkSimpleLinkFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @href: the target of the link
* @role: the role string
* @title: the link title
*
* This is the prototype for a simple link detection callback.
*/
typedef void
(*xlinkSimpleLinkFunk) (void *ctx,
xmlNodePtr node,
const xlinkHRef href,
const xlinkRole role,
const xlinkTitle title);
/**
* xlinkExtendedLinkFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @nbLocators: the number of locators detected on the link
* @hrefs: pointer to the array of locator hrefs
* @roles: pointer to the array of locator roles
* @nbArcs: the number of arcs detected on the link
* @from: pointer to the array of source roles found on the arcs
* @to: pointer to the array of target roles found on the arcs
* @show: array of values for the show attributes found on the arcs
* @actuate: array of values for the actuate attributes found on the arcs
* @nbTitles: the number of titles detected on the link
* @title: array of titles detected on the link
* @langs: array of xml:lang values for the titles
*
* This is the prototype for a extended link detection callback.
*/
typedef void
(*xlinkExtendedLinkFunk)(void *ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef *hrefs,
const xlinkRole *roles,
int nbArcs,
const xlinkRole *from,
const xlinkRole *to,
xlinkShow *show,
xlinkActuate *actuate,
int nbTitles,
const xlinkTitle *titles,
const xmlChar **langs);
/**
* xlinkExtendedLinkSetFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @nbLocators: the number of locators detected on the link
* @hrefs: pointer to the array of locator hrefs
* @roles: pointer to the array of locator roles
* @nbTitles: the number of titles detected on the link
* @title: array of titles detected on the link
* @langs: array of xml:lang values for the titles
*
* This is the prototype for a extended link set detection callback.
*/
typedef void
(*xlinkExtendedLinkSetFunk) (void *ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef *hrefs,
const xlinkRole *roles,
int nbTitles,
const xlinkTitle *titles,
const xmlChar **langs);
/**
* This is the structure containing a set of Links detection callbacks.
*
* There is no default xlink callbacks, if one want to get link
* recognition activated, those call backs must be provided before parsing.
*/
typedef struct _xlinkHandler xlinkHandler;
typedef xlinkHandler *xlinkHandlerPtr;
struct _xlinkHandler {
xlinkSimpleLinkFunk simple;
xlinkExtendedLinkFunk extended;
xlinkExtendedLinkSetFunk set;
};
/*
* The default detection routine, can be overridden, they call the default
* detection callbacks.
*/
XMLPUBFUN xlinkNodeDetectFunc XMLCALL
xlinkGetDefaultDetect (void);
XMLPUBFUN void XMLCALL
xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
/*
* Routines to set/get the default handlers.
*/
XMLPUBFUN xlinkHandlerPtr XMLCALL
xlinkGetDefaultHandler (void);
XMLPUBFUN void XMLCALL
xlinkSetDefaultHandler (xlinkHandlerPtr handler);
/*
* Link detection module itself.
*/
XMLPUBFUN xlinkType XMLCALL
xlinkIsLink (xmlDocPtr doc,
xmlNodePtr node);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPTR_ENABLED */
#endif /* __XML_XLINK_H__ */

View File

@ -0,0 +1,360 @@
/*
* Summary: interface for the I/O interfaces used by the parser
* Description: interface for the I/O interfaces used by the parser
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_IO_H__
#define __XML_IO_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Those are the functions and datatypes for the parser input
* I/O structures.
*/
/**
* xmlInputMatchCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Input API to detect if the current handler
* can provide input fonctionnalities for this resource.
*
* Returns 1 if yes and 0 if another Input module should be used
*/
typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
/**
* xmlInputOpenCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Input API to open the resource
*
* Returns an Input context or NULL in case or error
*/
typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
/**
* xmlInputReadCallback:
* @context: an Input context
* @buffer: the buffer to store data read
* @len: the length of the buffer in bytes
*
* Callback used in the I/O Input API to read the resource
*
* Returns the number of bytes read or -1 in case of error
*/
typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
/**
* xmlInputCloseCallback:
* @context: an Input context
*
* Callback used in the I/O Input API to close the resource
*
* Returns 0 or -1 in case of error
*/
typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Those are the functions and datatypes for the library output
* I/O structures.
*/
/**
* xmlOutputMatchCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Output API to detect if the current handler
* can provide output fonctionnalities for this resource.
*
* Returns 1 if yes and 0 if another Output module should be used
*/
typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
/**
* xmlOutputOpenCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Output API to open the resource
*
* Returns an Output context or NULL in case or error
*/
typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
/**
* xmlOutputWriteCallback:
* @context: an Output context
* @buffer: the buffer of data to write
* @len: the length of the buffer in bytes
*
* Callback used in the I/O Output API to write to the resource
*
* Returns the number of bytes written or -1 in case of error
*/
typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
int len);
/**
* xmlOutputCloseCallback:
* @context: an Output context
*
* Callback used in the I/O Output API to close the resource
*
* Returns 0 or -1 in case of error
*/
typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef __cplusplus
}
#endif
#include <libxml/globals.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/encoding.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _xmlParserInputBuffer {
void* context;
xmlInputReadCallback readcallback;
xmlInputCloseCallback closecallback;
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */
xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */
int compressed; /* -1=unknown, 0=not compressed, 1=compressed */
int error;
unsigned long rawconsumed;/* amount consumed from raw */
};
#ifdef LIBXML_OUTPUT_ENABLED
struct _xmlOutputBuffer {
void* context;
xmlOutputWriteCallback writecallback;
xmlOutputCloseCallback closecallback;
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
xmlBufferPtr conv; /* if encoder != NULL buffer for output */
int written; /* total number of byte written */
int error;
};
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for input
*/
XMLPUBFUN void XMLCALL
xmlCleanupInputCallbacks (void);
XMLPUBFUN int XMLCALL
xmlPopInputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultInputCallbacks (void);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlAllocParserInputBuffer (xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFilename (const char *URI,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFile (FILE *file,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFd (int fd,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateMem (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateStatic (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
xmlParserInputBufferRead (xmlParserInputBufferPtr in,
int len);
XMLPUBFUN int XMLCALL
xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
int len);
XMLPUBFUN int XMLCALL
xmlParserInputBufferPush (xmlParserInputBufferPtr in,
int len,
const char *buf);
XMLPUBFUN void XMLCALL
xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
XMLPUBFUN char * XMLCALL
xmlParserGetDirectory (const char *filename);
XMLPUBFUN int XMLCALL
xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc);
xmlParserInputBufferPtr
__xmlParserInputBufferCreateFilename(const char *URI,
xmlCharEncoding enc);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Interfaces for output
*/
XMLPUBFUN void XMLCALL
xmlCleanupOutputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultOutputCallbacks(void);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFilename (const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFile (FILE *file,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFd (int fd,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN int XMLCALL
xmlOutputBufferWrite (xmlOutputBufferPtr out,
int len,
const char *buf);
XMLPUBFUN int XMLCALL
xmlOutputBufferWriteString (xmlOutputBufferPtr out,
const char *str);
XMLPUBFUN int XMLCALL
xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
const xmlChar *str,
xmlCharEncodingOutputFunc escaping);
XMLPUBFUN int XMLCALL
xmlOutputBufferFlush (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
xmlOutputBufferClose (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc);
xmlOutputBufferPtr
__xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
#ifdef LIBXML_HTTP_ENABLED
/* This function only exists if HTTP support built into the library */
XMLPUBFUN void XMLCALL
xmlRegisterHTTPPostCallbacks (void );
#endif /* LIBXML_HTTP_ENABLED */
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr ret);
/*
* A predefined entity loader disabling network accesses
*/
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNoNetExternalEntityLoader (const char *URL,
const char *ID,
xmlParserCtxtPtr ctxt);
/*
* xmlNormalizeWindowsPath is obsolete, don't use it.
* Check xmlCanonicPath in uri.h for a better alternative.
*/
XMLPUBFUN xmlChar * XMLCALL
xmlNormalizeWindowsPath (const xmlChar *path);
XMLPUBFUN int XMLCALL
xmlCheckFilename (const char *path);
/**
* Default 'file://' protocol callbacks
*/
XMLPUBFUN int XMLCALL
xmlFileMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlFileOpen (const char *filename);
XMLPUBFUN int XMLCALL
xmlFileRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlFileClose (void * context);
/**
* Default 'http://' protocol callbacks
*/
#ifdef LIBXML_HTTP_ENABLED
XMLPUBFUN int XMLCALL
xmlIOHTTPMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlIOHTTPOpen (const char *filename);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void * XMLCALL
xmlIOHTTPOpenW (const char * post_uri,
int compression );
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
xmlIOHTTPRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlIOHTTPClose (void * context);
#endif /* LIBXML_HTTP_ENABLED */
/**
* Default 'ftp://' protocol callbacks
*/
#ifdef LIBXML_FTP_ENABLED
XMLPUBFUN int XMLCALL
xmlIOFTPMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlIOFTPOpen (const char *filename);
XMLPUBFUN int XMLCALL
xmlIOFTPRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlIOFTPClose (void * context);
#endif /* LIBXML_FTP_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_IO_H__ */

View File

@ -0,0 +1,146 @@
/*
* Summary: API to build regexp automata
* Description: the API to build regexp automata
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_AUTOMATA_H__
#define __XML_AUTOMATA_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef LIBXML_AUTOMATA_ENABLED
#include <libxml/xmlregexp.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlAutomataPtr:
*
* A libxml automata description, It can be compiled into a regexp
*/
typedef struct _xmlAutomata xmlAutomata;
typedef xmlAutomata *xmlAutomataPtr;
/**
* xmlAutomataStatePtr:
*
* A state int the automata description,
*/
typedef struct _xmlAutomataState xmlAutomataState;
typedef xmlAutomataState *xmlAutomataStatePtr;
/*
* Building API
*/
XMLPUBFUN xmlAutomataPtr XMLCALL
xmlNewAutomata (void);
XMLPUBFUN void XMLCALL
xmlFreeAutomata (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataGetInitState (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
xmlAutomataSetFinalState (xmlAutomataPtr am,
xmlAutomataStatePtr state);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewState (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewTransition (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewTransition2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewNegTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewOnceTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewAllTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int lax);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewEpsilon (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountedTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCounterTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter);
XMLPUBFUN int XMLCALL
xmlAutomataNewCounter (xmlAutomataPtr am,
int min,
int max);
XMLPUBFUN xmlRegexpPtr XMLCALL
xmlAutomataCompile (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
xmlAutomataIsDeterminist (xmlAutomataPtr am);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_AUTOMATA_ENABLED */
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* __XML_AUTOMATA_H__ */

View File

@ -0,0 +1,945 @@
/*
* Summary: error handling
* Description: the API used to report errors
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#include <libxml/parser.h>
#ifndef __XML_ERROR_H__
#define __XML_ERROR_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlErrorLevel:
*
* Indicates the level of an error
*/
typedef enum {
XML_ERR_NONE = 0,
XML_ERR_WARNING = 1, /* A simple warning */
XML_ERR_ERROR = 2, /* A recoverable error */
XML_ERR_FATAL = 3 /* A fatal error */
} xmlErrorLevel;
/**
* xmlErrorDomain:
*
* Indicates where an error may have come from
*/
typedef enum {
XML_FROM_NONE = 0,
XML_FROM_PARSER, /* The XML parser */
XML_FROM_TREE, /* The tree module */
XML_FROM_NAMESPACE, /* The XML Namespace module */
XML_FROM_DTD, /* The XML DTD validation with parser context*/
XML_FROM_HTML, /* The HTML parser */
XML_FROM_MEMORY, /* The memory allocator */
XML_FROM_OUTPUT, /* The serialization code */
XML_FROM_IO, /* The Input/Output stack */
XML_FROM_FTP, /* The FTP module */
XML_FROM_HTTP, /* The HTTP module */
XML_FROM_XINCLUDE, /* The XInclude processing */
XML_FROM_XPATH, /* The XPath module */
XML_FROM_XPOINTER, /* The XPointer module */
XML_FROM_REGEXP, /* The regular expressions module */
XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */
XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */
XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */
XML_FROM_RELAXNGP, /* The Relax-NG parser module */
XML_FROM_RELAXNGV, /* The Relax-NG validator module */
XML_FROM_CATALOG, /* The Catalog module */
XML_FROM_C14N, /* The Canonicalization module */
XML_FROM_XSLT, /* The XSLT engine from libxslt */
XML_FROM_VALID, /* The XML DTD validation with valid context */
XML_FROM_CHECK, /* The error checking module */
XML_FROM_WRITER, /* The xmlwriter module */
XML_FROM_MODULE, /* The dynamically loaded module module*/
XML_FROM_I18N, /* The module handling character conversion */
XML_FROM_SCHEMATRONV /* The Schematron validator module */
} xmlErrorDomain;
/**
* xmlError:
*
* An XML Error instance.
*/
typedef struct _xmlError xmlError;
typedef xmlError *xmlErrorPtr;
struct _xmlError {
int domain; /* What part of the library raised this error */
int code; /* The error code, e.g. an xmlParserError */
char *message;/* human-readable informative error message */
xmlErrorLevel level;/* how consequent is the error */
char *file; /* the filename */
int line; /* the line number if available */
char *str1; /* extra string information */
char *str2; /* extra string information */
char *str3; /* extra string information */
int int1; /* extra number information */
int int2; /* column number of the error or 0 if N/A (todo: rename this field when we would break ABI) */
void *ctxt; /* the parser context if available */
void *node; /* the node in the tree */
};
/**
* xmlParserError:
*
* This is an error that the XML (or HTML) parser can generate
*/
typedef enum {
XML_ERR_OK = 0,
XML_ERR_INTERNAL_ERROR, /* 1 */
XML_ERR_NO_MEMORY, /* 2 */
XML_ERR_DOCUMENT_START, /* 3 */
XML_ERR_DOCUMENT_EMPTY, /* 4 */
XML_ERR_DOCUMENT_END, /* 5 */
XML_ERR_INVALID_HEX_CHARREF, /* 6 */
XML_ERR_INVALID_DEC_CHARREF, /* 7 */
XML_ERR_INVALID_CHARREF, /* 8 */
XML_ERR_INVALID_CHAR, /* 9 */
XML_ERR_CHARREF_AT_EOF, /* 10 */
XML_ERR_CHARREF_IN_PROLOG, /* 11 */
XML_ERR_CHARREF_IN_EPILOG, /* 12 */
XML_ERR_CHARREF_IN_DTD, /* 13 */
XML_ERR_ENTITYREF_AT_EOF, /* 14 */
XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */
XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */
XML_ERR_ENTITYREF_IN_DTD, /* 17 */
XML_ERR_PEREF_AT_EOF, /* 18 */
XML_ERR_PEREF_IN_PROLOG, /* 19 */
XML_ERR_PEREF_IN_EPILOG, /* 20 */
XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */
XML_ERR_ENTITYREF_NO_NAME, /* 22 */
XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */
XML_ERR_PEREF_NO_NAME, /* 24 */
XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */
XML_ERR_UNDECLARED_ENTITY, /* 26 */
XML_WAR_UNDECLARED_ENTITY, /* 27 */
XML_ERR_UNPARSED_ENTITY, /* 28 */
XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */
XML_ERR_ENTITY_IS_PARAMETER, /* 30 */
XML_ERR_UNKNOWN_ENCODING, /* 31 */
XML_ERR_UNSUPPORTED_ENCODING, /* 32 */
XML_ERR_STRING_NOT_STARTED, /* 33 */
XML_ERR_STRING_NOT_CLOSED, /* 34 */
XML_ERR_NS_DECL_ERROR, /* 35 */
XML_ERR_ENTITY_NOT_STARTED, /* 36 */
XML_ERR_ENTITY_NOT_FINISHED, /* 37 */
XML_ERR_LT_IN_ATTRIBUTE, /* 38 */
XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */
XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */
XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */
XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */
XML_ERR_LITERAL_NOT_STARTED, /* 43 */
XML_ERR_LITERAL_NOT_FINISHED, /* 44 */
XML_ERR_COMMENT_NOT_FINISHED, /* 45 */
XML_ERR_PI_NOT_STARTED, /* 46 */
XML_ERR_PI_NOT_FINISHED, /* 47 */
XML_ERR_NOTATION_NOT_STARTED, /* 48 */
XML_ERR_NOTATION_NOT_FINISHED, /* 49 */
XML_ERR_ATTLIST_NOT_STARTED, /* 50 */
XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */
XML_ERR_MIXED_NOT_STARTED, /* 52 */
XML_ERR_MIXED_NOT_FINISHED, /* 53 */
XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */
XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */
XML_ERR_XMLDECL_NOT_STARTED, /* 56 */
XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */
XML_ERR_CONDSEC_NOT_STARTED, /* 58 */
XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */
XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */
XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */
XML_ERR_MISPLACED_CDATA_END, /* 62 */
XML_ERR_CDATA_NOT_FINISHED, /* 63 */
XML_ERR_RESERVED_XML_NAME, /* 64 */
XML_ERR_SPACE_REQUIRED, /* 65 */
XML_ERR_SEPARATOR_REQUIRED, /* 66 */
XML_ERR_NMTOKEN_REQUIRED, /* 67 */
XML_ERR_NAME_REQUIRED, /* 68 */
XML_ERR_PCDATA_REQUIRED, /* 69 */
XML_ERR_URI_REQUIRED, /* 70 */
XML_ERR_PUBID_REQUIRED, /* 71 */
XML_ERR_LT_REQUIRED, /* 72 */
XML_ERR_GT_REQUIRED, /* 73 */
XML_ERR_LTSLASH_REQUIRED, /* 74 */
XML_ERR_EQUAL_REQUIRED, /* 75 */
XML_ERR_TAG_NAME_MISMATCH, /* 76 */
XML_ERR_TAG_NOT_FINISHED, /* 77 */
XML_ERR_STANDALONE_VALUE, /* 78 */
XML_ERR_ENCODING_NAME, /* 79 */
XML_ERR_HYPHEN_IN_COMMENT, /* 80 */
XML_ERR_INVALID_ENCODING, /* 81 */
XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */
XML_ERR_CONDSEC_INVALID, /* 83 */
XML_ERR_VALUE_REQUIRED, /* 84 */
XML_ERR_NOT_WELL_BALANCED, /* 85 */
XML_ERR_EXTRA_CONTENT, /* 86 */
XML_ERR_ENTITY_CHAR_ERROR, /* 87 */
XML_ERR_ENTITY_PE_INTERNAL, /* 88 */
XML_ERR_ENTITY_LOOP, /* 89 */
XML_ERR_ENTITY_BOUNDARY, /* 90 */
XML_ERR_INVALID_URI, /* 91 */
XML_ERR_URI_FRAGMENT, /* 92 */
XML_WAR_CATALOG_PI, /* 93 */
XML_ERR_NO_DTD, /* 94 */
XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */
XML_ERR_VERSION_MISSING, /* 96 */
XML_WAR_UNKNOWN_VERSION, /* 97 */
XML_WAR_LANG_VALUE, /* 98 */
XML_WAR_NS_URI, /* 99 */
XML_WAR_NS_URI_RELATIVE, /* 100 */
XML_ERR_MISSING_ENCODING, /* 101 */
XML_WAR_SPACE_VALUE, /* 102 */
XML_ERR_NOT_STANDALONE, /* 103 */
XML_ERR_ENTITY_PROCESSING, /* 104 */
XML_ERR_NOTATION_PROCESSING, /* 105 */
XML_WAR_NS_COLUMN, /* 106 */
XML_WAR_ENTITY_REDEFINED, /* 107 */
XML_ERR_UNKNOWN_VERSION, /* 108 */
XML_ERR_VERSION_MISMATCH, /* 109 */
XML_ERR_USER_STOP, /* 110 */
XML_NS_ERR_XML_NAMESPACE = 200,
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
XML_NS_ERR_QNAME, /* 202 */
XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */
XML_NS_ERR_EMPTY, /* 204 */
XML_NS_ERR_COLON, /* 205 */
XML_DTD_ATTRIBUTE_DEFAULT = 500,
XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */
XML_DTD_ATTRIBUTE_VALUE, /* 502 */
XML_DTD_CONTENT_ERROR, /* 503 */
XML_DTD_CONTENT_MODEL, /* 504 */
XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */
XML_DTD_DIFFERENT_PREFIX, /* 506 */
XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */
XML_DTD_ELEM_NAMESPACE, /* 508 */
XML_DTD_ELEM_REDEFINED, /* 509 */
XML_DTD_EMPTY_NOTATION, /* 510 */
XML_DTD_ENTITY_TYPE, /* 511 */
XML_DTD_ID_FIXED, /* 512 */
XML_DTD_ID_REDEFINED, /* 513 */
XML_DTD_ID_SUBSET, /* 514 */
XML_DTD_INVALID_CHILD, /* 515 */
XML_DTD_INVALID_DEFAULT, /* 516 */
XML_DTD_LOAD_ERROR, /* 517 */
XML_DTD_MISSING_ATTRIBUTE, /* 518 */
XML_DTD_MIXED_CORRUPT, /* 519 */
XML_DTD_MULTIPLE_ID, /* 520 */
XML_DTD_NO_DOC, /* 521 */
XML_DTD_NO_DTD, /* 522 */
XML_DTD_NO_ELEM_NAME, /* 523 */
XML_DTD_NO_PREFIX, /* 524 */
XML_DTD_NO_ROOT, /* 525 */
XML_DTD_NOTATION_REDEFINED, /* 526 */
XML_DTD_NOTATION_VALUE, /* 527 */
XML_DTD_NOT_EMPTY, /* 528 */
XML_DTD_NOT_PCDATA, /* 529 */
XML_DTD_NOT_STANDALONE, /* 530 */
XML_DTD_ROOT_NAME, /* 531 */
XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */
XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */
XML_DTD_UNKNOWN_ELEM, /* 534 */
XML_DTD_UNKNOWN_ENTITY, /* 535 */
XML_DTD_UNKNOWN_ID, /* 536 */
XML_DTD_UNKNOWN_NOTATION, /* 537 */
XML_DTD_STANDALONE_DEFAULTED, /* 538 */
XML_DTD_XMLID_VALUE, /* 539 */
XML_DTD_XMLID_TYPE, /* 540 */
XML_DTD_DUP_TOKEN, /* 541 */
XML_HTML_STRUCURE_ERROR = 800,
XML_HTML_UNKNOWN_TAG, /* 801 */
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
XML_RNGP_ATTR_CONFLICT, /* 1001 */
XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */
XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */
XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */
XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */
XML_RNGP_CHOICE_CONTENT, /* 1006 */
XML_RNGP_CHOICE_EMPTY, /* 1007 */
XML_RNGP_CREATE_FAILURE, /* 1008 */
XML_RNGP_DATA_CONTENT, /* 1009 */
XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */
XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */
XML_RNGP_DEFINE_EMPTY, /* 1012 */
XML_RNGP_DEFINE_MISSING, /* 1013 */
XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */
XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */
XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */
XML_RNGP_ELEMENT_EMPTY, /* 1017 */
XML_RNGP_ELEMENT_CONTENT, /* 1018 */
XML_RNGP_ELEMENT_NAME, /* 1019 */
XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */
XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */
XML_RNGP_EMPTY, /* 1022 */
XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */
XML_RNGP_EMPTY_CONTENT, /* 1024 */
XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */
XML_RNGP_ERROR_TYPE_LIB, /* 1026 */
XML_RNGP_EXCEPT_EMPTY, /* 1027 */
XML_RNGP_EXCEPT_MISSING, /* 1028 */
XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */
XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */
XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */
XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */
XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */
XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */
XML_RNGP_FOREIGN_ELEMENT, /* 1035 */
XML_RNGP_GRAMMAR_CONTENT, /* 1036 */
XML_RNGP_GRAMMAR_EMPTY, /* 1037 */
XML_RNGP_GRAMMAR_MISSING, /* 1038 */
XML_RNGP_GRAMMAR_NO_START, /* 1039 */
XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */
XML_RNGP_HREF_ERROR, /* 1041 */
XML_RNGP_INCLUDE_EMPTY, /* 1042 */
XML_RNGP_INCLUDE_FAILURE, /* 1043 */
XML_RNGP_INCLUDE_RECURSE, /* 1044 */
XML_RNGP_INTERLEAVE_ADD, /* 1045 */
XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */
XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */
XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */
XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */
XML_RNGP_INVALID_URI, /* 1050 */
XML_RNGP_INVALID_VALUE, /* 1051 */
XML_RNGP_MISSING_HREF, /* 1052 */
XML_RNGP_NAME_MISSING, /* 1053 */
XML_RNGP_NEED_COMBINE, /* 1054 */
XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */
XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */
XML_RNGP_NSNAME_NO_NS, /* 1057 */
XML_RNGP_PARAM_FORBIDDEN, /* 1058 */
XML_RNGP_PARAM_NAME_MISSING, /* 1059 */
XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */
XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */
XML_RNGP_PARENTREF_NO_NAME, /* 1062 */
XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */
XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */
XML_RNGP_PARSE_ERROR, /* 1065 */
XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */
XML_RNGP_PAT_ATTR_ATTR, /* 1067 */
XML_RNGP_PAT_ATTR_ELEM, /* 1068 */
XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */
XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */
XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */
XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */
XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */
XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */
XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */
XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */
XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */
XML_RNGP_PAT_LIST_ATTR, /* 1078 */
XML_RNGP_PAT_LIST_ELEM, /* 1079 */
XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */
XML_RNGP_PAT_LIST_LIST, /* 1081 */
XML_RNGP_PAT_LIST_REF, /* 1082 */
XML_RNGP_PAT_LIST_TEXT, /* 1083 */
XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */
XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */
XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */
XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */
XML_RNGP_PAT_START_ATTR, /* 1088 */
XML_RNGP_PAT_START_DATA, /* 1089 */
XML_RNGP_PAT_START_EMPTY, /* 1090 */
XML_RNGP_PAT_START_GROUP, /* 1091 */
XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */
XML_RNGP_PAT_START_LIST, /* 1093 */
XML_RNGP_PAT_START_ONEMORE, /* 1094 */
XML_RNGP_PAT_START_TEXT, /* 1095 */
XML_RNGP_PAT_START_VALUE, /* 1096 */
XML_RNGP_PREFIX_UNDEFINED, /* 1097 */
XML_RNGP_REF_CREATE_FAILED, /* 1098 */
XML_RNGP_REF_CYCLE, /* 1099 */
XML_RNGP_REF_NAME_INVALID, /* 1100 */
XML_RNGP_REF_NO_DEF, /* 1101 */
XML_RNGP_REF_NO_NAME, /* 1102 */
XML_RNGP_REF_NOT_EMPTY, /* 1103 */
XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */
XML_RNGP_START_CONTENT, /* 1105 */
XML_RNGP_START_EMPTY, /* 1106 */
XML_RNGP_START_MISSING, /* 1107 */
XML_RNGP_TEXT_EXPECTED, /* 1108 */
XML_RNGP_TEXT_HAS_CHILD, /* 1109 */
XML_RNGP_TYPE_MISSING, /* 1110 */
XML_RNGP_TYPE_NOT_FOUND, /* 1111 */
XML_RNGP_TYPE_VALUE, /* 1112 */
XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */
XML_RNGP_UNKNOWN_COMBINE, /* 1114 */
XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */
XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */
XML_RNGP_URI_FRAGMENT, /* 1117 */
XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */
XML_RNGP_VALUE_EMPTY, /* 1119 */
XML_RNGP_VALUE_NO_CONTENT, /* 1120 */
XML_RNGP_XMLNS_NAME, /* 1121 */
XML_RNGP_XML_NS, /* 1122 */
XML_XPATH_EXPRESSION_OK = 1200,
XML_XPATH_NUMBER_ERROR, /* 1201 */
XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */
XML_XPATH_START_LITERAL_ERROR, /* 1203 */
XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */
XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */
XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */
XML_XPATH_EXPR_ERROR, /* 1207 */
XML_XPATH_UNCLOSED_ERROR, /* 1208 */
XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */
XML_XPATH_INVALID_OPERAND, /* 1210 */
XML_XPATH_INVALID_TYPE, /* 1211 */
XML_XPATH_INVALID_ARITY, /* 1212 */
XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */
XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */
XML_XPATH_MEMORY_ERROR, /* 1215 */
XML_XPTR_SYNTAX_ERROR, /* 1216 */
XML_XPTR_RESOURCE_ERROR, /* 1217 */
XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */
XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */
XML_XPATH_ENCODING_ERROR, /* 1220 */
XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */
XML_TREE_INVALID_HEX = 1300,
XML_TREE_INVALID_DEC, /* 1301 */
XML_TREE_UNTERMINATED_ENTITY, /* 1302 */
XML_TREE_NOT_UTF8, /* 1303 */
XML_SAVE_NOT_UTF8 = 1400,
XML_SAVE_CHAR_INVALID, /* 1401 */
XML_SAVE_NO_DOCTYPE, /* 1402 */
XML_SAVE_UNKNOWN_ENCODING, /* 1403 */
XML_REGEXP_COMPILE_ERROR = 1450,
XML_IO_UNKNOWN = 1500,
XML_IO_EACCES, /* 1501 */
XML_IO_EAGAIN, /* 1502 */
XML_IO_EBADF, /* 1503 */
XML_IO_EBADMSG, /* 1504 */
XML_IO_EBUSY, /* 1505 */
XML_IO_ECANCELED, /* 1506 */
XML_IO_ECHILD, /* 1507 */
XML_IO_EDEADLK, /* 1508 */
XML_IO_EDOM, /* 1509 */
XML_IO_EEXIST, /* 1510 */
XML_IO_EFAULT, /* 1511 */
XML_IO_EFBIG, /* 1512 */
XML_IO_EINPROGRESS, /* 1513 */
XML_IO_EINTR, /* 1514 */
XML_IO_EINVAL, /* 1515 */
XML_IO_EIO, /* 1516 */
XML_IO_EISDIR, /* 1517 */
XML_IO_EMFILE, /* 1518 */
XML_IO_EMLINK, /* 1519 */
XML_IO_EMSGSIZE, /* 1520 */
XML_IO_ENAMETOOLONG, /* 1521 */
XML_IO_ENFILE, /* 1522 */
XML_IO_ENODEV, /* 1523 */
XML_IO_ENOENT, /* 1524 */
XML_IO_ENOEXEC, /* 1525 */
XML_IO_ENOLCK, /* 1526 */
XML_IO_ENOMEM, /* 1527 */
XML_IO_ENOSPC, /* 1528 */
XML_IO_ENOSYS, /* 1529 */
XML_IO_ENOTDIR, /* 1530 */
XML_IO_ENOTEMPTY, /* 1531 */
XML_IO_ENOTSUP, /* 1532 */
XML_IO_ENOTTY, /* 1533 */
XML_IO_ENXIO, /* 1534 */
XML_IO_EPERM, /* 1535 */
XML_IO_EPIPE, /* 1536 */
XML_IO_ERANGE, /* 1537 */
XML_IO_EROFS, /* 1538 */
XML_IO_ESPIPE, /* 1539 */
XML_IO_ESRCH, /* 1540 */
XML_IO_ETIMEDOUT, /* 1541 */
XML_IO_EXDEV, /* 1542 */
XML_IO_NETWORK_ATTEMPT, /* 1543 */
XML_IO_ENCODER, /* 1544 */
XML_IO_FLUSH, /* 1545 */
XML_IO_WRITE, /* 1546 */
XML_IO_NO_INPUT, /* 1547 */
XML_IO_BUFFER_FULL, /* 1548 */
XML_IO_LOAD_ERROR, /* 1549 */
XML_IO_ENOTSOCK, /* 1550 */
XML_IO_EISCONN, /* 1551 */
XML_IO_ECONNREFUSED, /* 1552 */
XML_IO_ENETUNREACH, /* 1553 */
XML_IO_EADDRINUSE, /* 1554 */
XML_IO_EALREADY, /* 1555 */
XML_IO_EAFNOSUPPORT, /* 1556 */
XML_XINCLUDE_RECURSION=1600,
XML_XINCLUDE_PARSE_VALUE, /* 1601 */
XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */
XML_XINCLUDE_NO_HREF, /* 1603 */
XML_XINCLUDE_NO_FALLBACK, /* 1604 */
XML_XINCLUDE_HREF_URI, /* 1605 */
XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */
XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */
XML_XINCLUDE_INVALID_CHAR, /* 1608 */
XML_XINCLUDE_BUILD_FAILED, /* 1609 */
XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */
XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */
XML_XINCLUDE_XPTR_FAILED, /* 1612 */
XML_XINCLUDE_XPTR_RESULT, /* 1613 */
XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */
XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */
XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */
XML_XINCLUDE_DEPRECATED_NS, /* 1617 */
XML_XINCLUDE_FRAGMENT_ID, /* 1618 */
XML_CATALOG_MISSING_ATTR = 1650,
XML_CATALOG_ENTRY_BROKEN, /* 1651 */
XML_CATALOG_PREFER_VALUE, /* 1652 */
XML_CATALOG_NOT_CATALOG, /* 1653 */
XML_CATALOG_RECURSION, /* 1654 */
XML_SCHEMAP_PREFIX_UNDEFINED = 1700,
XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */
XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */
XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */
XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */
XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */
XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */
XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */
XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */
XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */
XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */
XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */
XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */
XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */
XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */
XML_SCHEMAP_INVALID_ENUM, /* 1715 */
XML_SCHEMAP_INVALID_FACET, /* 1716 */
XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */
XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */
XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */
XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */
XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */
XML_SCHEMAP_NOATTR_NOREF, /* 1722 */
XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */
XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */
XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */
XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */
XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */
XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */
XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */
XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */
XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */
XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */
XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */
XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */
XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */
XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */
XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */
XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */
XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */
XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */
XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */
XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */
XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */
XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */
XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */
XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */
XML_SCHEMAP_UNKNOWN_REF, /* 1747 */
XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */
XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */
XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */
XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */
XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */
XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */
XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */
XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */
XML_SCHEMAP_REGEXP_INVALID, /* 1756 */
XML_SCHEMAP_FAILED_LOAD, /* 1757 */
XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */
XML_SCHEMAP_NOROOT, /* 1759 */
XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */
XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */
XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */
XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */
XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */
XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */
XML_SCHEMAP_FAILED_PARSE, /* 1766 */
XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */
XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */
XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */
XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */
XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */
XML_SCHEMAP_NOT_SCHEMA, /* 1772 */
XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */
XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */
XML_SCHEMAP_RECURSIVE, /* 1775 */
XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */
XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */
XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */
XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */
XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */
XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */
XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */
XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */
XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */
XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */
XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */
XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */
XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */
XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */
XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */
XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */
XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */
XML_SCHEMAV_NOROOT = 1801,
XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */
XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */
XML_SCHEMAV_MISSING, /* 1804 */
XML_SCHEMAV_WRONGELEM, /* 1805 */
XML_SCHEMAV_NOTYPE, /* 1806 */
XML_SCHEMAV_NOROLLBACK, /* 1807 */
XML_SCHEMAV_ISABSTRACT, /* 1808 */
XML_SCHEMAV_NOTEMPTY, /* 1809 */
XML_SCHEMAV_ELEMCONT, /* 1810 */
XML_SCHEMAV_HAVEDEFAULT, /* 1811 */
XML_SCHEMAV_NOTNILLABLE, /* 1812 */
XML_SCHEMAV_EXTRACONTENT, /* 1813 */
XML_SCHEMAV_INVALIDATTR, /* 1814 */
XML_SCHEMAV_INVALIDELEM, /* 1815 */
XML_SCHEMAV_NOTDETERMINIST, /* 1816 */
XML_SCHEMAV_CONSTRUCT, /* 1817 */
XML_SCHEMAV_INTERNAL, /* 1818 */
XML_SCHEMAV_NOTSIMPLE, /* 1819 */
XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */
XML_SCHEMAV_ATTRINVALID, /* 1821 */
XML_SCHEMAV_VALUE, /* 1822 */
XML_SCHEMAV_FACET, /* 1823 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */
XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */
XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */
XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */
XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */
XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */
XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */
XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */
XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */
XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */
XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */
XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */
XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */
XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */
XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */
XML_SCHEMAV_CVC_ELT_1, /* 1845 */
XML_SCHEMAV_CVC_ELT_2, /* 1846 */
XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */
XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */
XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */
XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */
XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */
XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */
XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */
XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */
XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */
XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */
XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */
XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */
XML_SCHEMAV_CVC_ELT_6, /* 1859 */
XML_SCHEMAV_CVC_ELT_7, /* 1860 */
XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */
XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */
XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */
XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */
XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */
XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */
XML_SCHEMAV_CVC_AU, /* 1874 */
XML_SCHEMAV_CVC_TYPE_1, /* 1875 */
XML_SCHEMAV_CVC_TYPE_2, /* 1876 */
XML_SCHEMAV_CVC_IDC, /* 1877 */
XML_SCHEMAV_CVC_WILDCARD, /* 1878 */
XML_SCHEMAV_MISC, /* 1879 */
XML_XPTR_UNKNOWN_SCHEME = 1900,
XML_XPTR_CHILDSEQ_START, /* 1901 */
XML_XPTR_EVAL_FAILED, /* 1902 */
XML_XPTR_EXTRA_OBJECTS, /* 1903 */
XML_C14N_CREATE_CTXT = 1950,
XML_C14N_REQUIRES_UTF8, /* 1951 */
XML_C14N_CREATE_STACK, /* 1952 */
XML_C14N_INVALID_NODE, /* 1953 */
XML_C14N_UNKNOW_NODE, /* 1954 */
XML_C14N_RELATIVE_NAMESPACE, /* 1955 */
XML_FTP_PASV_ANSWER = 2000,
XML_FTP_EPSV_ANSWER, /* 2001 */
XML_FTP_ACCNT, /* 2002 */
XML_FTP_URL_SYNTAX, /* 2003 */
XML_HTTP_URL_SYNTAX = 2020,
XML_HTTP_USE_IP, /* 2021 */
XML_HTTP_UNKNOWN_HOST, /* 2022 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000,
XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */
XML_SCHEMAP_SRC_RESOLVE, /* 3004 */
XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */
XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */
XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */
XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */
XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */
XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */
XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */
XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */
XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */
XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */
XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */
XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */
XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */
XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */
XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */
XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */
XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */
XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */
XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */
XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */
XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */
XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */
XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */
XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */
XML_SCHEMAP_SRC_INCLUDE, /* 3050 */
XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */
XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */
XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */
XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */
XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */
XML_SCHEMAP_NO_XMLNS, /* 3056 */
XML_SCHEMAP_NO_XSI, /* 3057 */
XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */
XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */
XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */
XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */
XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */
XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */
XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */
XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */
XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */
XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */
XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */
XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */
XML_SCHEMAP_SRC_CT_1, /* 3076 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */
XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */
XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */
XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */
XML_SCHEMAP_SRC_REDEFINE, /* 3081 */
XML_SCHEMAP_SRC_IMPORT, /* 3082 */
XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */
XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */
XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */
XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */
XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */
XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */
XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */
XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */
XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */
XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */
XML_SCHEMATRONV_REPORT,
XML_MODULE_OPEN = 4900, /* 4900 */
XML_MODULE_CLOSE, /* 4901 */
XML_CHECK_FOUND_ELEMENT = 5000,
XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */
XML_CHECK_FOUND_TEXT, /* 5002 */
XML_CHECK_FOUND_CDATA, /* 5003 */
XML_CHECK_FOUND_ENTITYREF, /* 5004 */
XML_CHECK_FOUND_ENTITY, /* 5005 */
XML_CHECK_FOUND_PI, /* 5006 */
XML_CHECK_FOUND_COMMENT, /* 5007 */
XML_CHECK_FOUND_DOCTYPE, /* 5008 */
XML_CHECK_FOUND_FRAGMENT, /* 5009 */
XML_CHECK_FOUND_NOTATION, /* 5010 */
XML_CHECK_UNKNOWN_NODE, /* 5011 */
XML_CHECK_ENTITY_TYPE, /* 5012 */
XML_CHECK_NO_PARENT, /* 5013 */
XML_CHECK_NO_DOC, /* 5014 */
XML_CHECK_NO_NAME, /* 5015 */
XML_CHECK_NO_ELEM, /* 5016 */
XML_CHECK_WRONG_DOC, /* 5017 */
XML_CHECK_NO_PREV, /* 5018 */
XML_CHECK_WRONG_PREV, /* 5019 */
XML_CHECK_NO_NEXT, /* 5020 */
XML_CHECK_WRONG_NEXT, /* 5021 */
XML_CHECK_NOT_DTD, /* 5022 */
XML_CHECK_NOT_ATTR, /* 5023 */
XML_CHECK_NOT_ATTR_DECL, /* 5024 */
XML_CHECK_NOT_ELEM_DECL, /* 5025 */
XML_CHECK_NOT_ENTITY_DECL, /* 5026 */
XML_CHECK_NOT_NS_DECL, /* 5027 */
XML_CHECK_NO_HREF, /* 5028 */
XML_CHECK_WRONG_PARENT,/* 5029 */
XML_CHECK_NS_SCOPE, /* 5030 */
XML_CHECK_NS_ANCESTOR, /* 5031 */
XML_CHECK_NOT_UTF8, /* 5032 */
XML_CHECK_NO_DICT, /* 5033 */
XML_CHECK_NOT_NCNAME, /* 5034 */
XML_CHECK_OUTSIDE_DICT, /* 5035 */
XML_CHECK_WRONG_NAME, /* 5036 */
XML_CHECK_NAME_NOT_NULL, /* 5037 */
XML_I18N_NO_NAME = 6000,
XML_I18N_NO_HANDLER, /* 6001 */
XML_I18N_EXCESS_HANDLER, /* 6002 */
XML_I18N_CONV_FAILED, /* 6003 */
XML_I18N_NO_OUTPUT /* 6004 */
#if 0
XML_CHECK_, /* 5033 */
XML_CHECK_X /* 503 */
#endif
} xmlParserErrors;
/**
* xmlGenericErrorFunc:
* @ctx: a parsing context
* @msg: the message
* @...: the extra arguments of the varags to format the message
*
* Signature of the function to use when there is an error and
* no parsing or validity context available .
*/
typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlStructuredErrorFunc:
* @userData: user provided data for the error callback
* @error: the error being raised.
*
* Signature of the function to use when there is an error and
* the module handles the new error reporting mechanism.
*/
typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
/*
* Use the following function to reset the two global variables
* xmlGenericError and xmlGenericErrorContext.
*/
XMLPUBFUN void XMLCALL
xmlSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);
XMLPUBFUN void XMLCALL
xmlSetStructuredErrorFunc (void *ctx,
xmlStructuredErrorFunc handler);
/*
* Default message routines used by SAX and Valid context for error
* and warning reporting.
*/
XMLPUBFUN void XMLCDECL
xmlParserError (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserWarning (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserValidityError (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserValidityWarning (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCALL
xmlParserPrintFileInfo (xmlParserInputPtr input);
XMLPUBFUN void XMLCALL
xmlParserPrintFileContext (xmlParserInputPtr input);
/*
* Extended error information routines
*/
XMLPUBFUN xmlErrorPtr XMLCALL
xmlGetLastError (void);
XMLPUBFUN void XMLCALL
xmlResetLastError (void);
XMLPUBFUN xmlErrorPtr XMLCALL
xmlCtxtGetLastError (void *ctx);
XMLPUBFUN void XMLCALL
xmlCtxtResetLastError (void *ctx);
XMLPUBFUN void XMLCALL
xmlResetError (xmlErrorPtr err);
XMLPUBFUN int XMLCALL
xmlCopyError (xmlErrorPtr from,
xmlErrorPtr to);
#ifdef IN_LIBXML
/*
* Internal callback reporting routine
*/
XMLPUBFUN void XMLCALL
__xmlRaiseError (xmlStructuredErrorFunc schannel,
xmlGenericErrorFunc channel,
void *data,
void *ctx,
void *node,
int domain,
int code,
xmlErrorLevel level,
const char *file,
int line,
const char *str1,
const char *str2,
const char *str3,
int int1,
int col,
const char *msg,
...) LIBXML_ATTR_FORMAT(16,17);
XMLPUBFUN void XMLCALL
__xmlSimpleError (int domain,
int code,
xmlNodePtr node,
const char *msg,
const char *extra);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_ERROR_H__ */

View File

@ -0,0 +1,162 @@
/*
* Summary: macros for marking symbols as exportable/importable.
* Description: macros for marking symbols as exportable/importable.
*
* Copy: See Copyright for the status of this software.
*
* Author: Igor Zlatovic <igor@zlatkovic.com>
*/
#ifndef __XML_EXPORTS_H__
#define __XML_EXPORTS_H__
/**
* XMLPUBFUN, XMLPUBVAR, XMLCALL
*
* Macros which declare an exportable function, an exportable variable and
* the calling convention used for functions.
*
* Please use an extra block for every platform/compiler combination when
* modifying this, rather than overlong #ifdef lines. This helps
* readability as well as the fact that different compilers on the same
* platform might need different definitions.
*/
/**
* XMLPUBFUN:
*
* Macros which declare an exportable function
*/
#define XMLPUBFUN
/**
* XMLPUBVAR:
*
* Macros which declare an exportable variable
*/
#define XMLPUBVAR extern
/**
* XMLCALL:
*
* Macros which declare the called convention for exported functions
*/
#define XMLCALL
/**
* XMLCDECL:
*
* Macro which declares the calling convention for exported functions that
* use '...'.
*/
#define XMLCDECL
/** DOC_DISABLE */
/* Windows platform with MS compiler */
#if defined(_WIN32) && defined(_MSC_VER)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#if defined(LIBXML_FASTCALL)
#define XMLCALL __fastcall
#else
#define XMLCALL __cdecl
#endif
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Windows platform with Borland compiler */
#if defined(_WIN32) && defined(__BORLANDC__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport) extern
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Windows platform with GNU compiler (Mingw) */
#if defined(_WIN32) && defined(__MINGW32__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
/*
* if defined(IN_LIBXML) this raises problems on mingw with msys
* _imp__xmlFree listed as missing. Try to workaround the problem
* by also making that declaration when compiling client code.
*/
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Cygwin platform, GNU compiler */
#if defined(_WIN32) && defined(__CYGWIN__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#endif
/* Compatibility */
#if !defined(LIBXML_DLL_IMPORT)
#define LIBXML_DLL_IMPORT XMLPUBVAR
#endif
#endif /* __XML_EXPORTS_H__ */

View File

@ -0,0 +1,224 @@
/*
* Summary: interface for the memory allocator
* Description: provides interfaces for the memory allocator,
* including debugging capabilities.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DEBUG_MEMORY_ALLOC__
#define __DEBUG_MEMORY_ALLOC__
#include <stdio.h>
#include <libxml/xmlversion.h>
/**
* DEBUG_MEMORY:
*
* DEBUG_MEMORY replaces the allocator with a collect and debug
* shell to the libc allocator.
* DEBUG_MEMORY should only be activated when debugging
* libxml i.e. if libxml has been configured with --with-debug-mem too.
*/
/* #define DEBUG_MEMORY_FREED */
/* #define DEBUG_MEMORY_LOCATION */
#ifdef DEBUG
#ifndef DEBUG_MEMORY
#define DEBUG_MEMORY
#endif
#endif
/**
* DEBUG_MEMORY_LOCATION:
*
* DEBUG_MEMORY_LOCATION should be activated only when debugging
* libxml i.e. if libxml has been configured with --with-debug-mem too.
*/
#ifdef DEBUG_MEMORY_LOCATION
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* The XML memory wrapper support 4 basic overloadable functions.
*/
/**
* xmlFreeFunc:
* @mem: an already allocated block of memory
*
* Signature for a free() implementation.
*/
typedef void (XMLCALL *xmlFreeFunc)(void *mem);
/**
* xmlMallocFunc:
* @size: the size requested in bytes
*
* Signature for a malloc() implementation.
*
* Returns a pointer to the newly allocated block or NULL in case of error.
*/
typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
/**
* xmlReallocFunc:
* @mem: an already allocated block of memory
* @size: the new size requested in bytes
*
* Signature for a realloc() implementation.
*
* Returns a pointer to the newly reallocated block or NULL in case of error.
*/
typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
/**
* xmlStrdupFunc:
* @str: a zero terminated string
*
* Signature for an strdup() implementation.
*
* Returns the copy of the string or NULL in case of error.
*/
typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
/*
* The 4 interfaces used for all memory handling within libxml.
LIBXML_DLL_IMPORT xmlFreeFunc xmlFree;
LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc;
LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic;
LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc;
LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup;
*/
/*
* The way to overload the existing functions.
* The xmlGc function have an extra entry for atomic block
* allocations useful for garbage collected memory allocators
*/
XMLPUBFUN int XMLCALL
xmlMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int XMLCALL
xmlMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
XMLPUBFUN int XMLCALL
xmlGcMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int XMLCALL
xmlGcMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlMallocFunc *mallocAtomicFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
/*
* Initialization of the memory layer.
*/
XMLPUBFUN int XMLCALL
xmlInitMemory (void);
/*
* Cleanup of the memory layer.
*/
XMLPUBFUN void XMLCALL
xmlCleanupMemory (void);
/*
* These are specific to the XML debug memory wrapper.
*/
XMLPUBFUN int XMLCALL
xmlMemUsed (void);
XMLPUBFUN int XMLCALL
xmlMemBlocks (void);
XMLPUBFUN void XMLCALL
xmlMemDisplay (FILE *fp);
XMLPUBFUN void XMLCALL
xmlMemDisplayLast(FILE *fp, long nbBytes);
XMLPUBFUN void XMLCALL
xmlMemShow (FILE *fp, int nr);
XMLPUBFUN void XMLCALL
xmlMemoryDump (void);
XMLPUBFUN void * XMLCALL
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
xmlMemRealloc (void *ptr,size_t size);
XMLPUBFUN void XMLCALL
xmlMemFree (void *ptr);
XMLPUBFUN char * XMLCALL
xmlMemoryStrdup (const char *str);
XMLPUBFUN void * XMLCALL
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
XMLPUBFUN void * XMLCALL
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN char * XMLCALL
xmlMemStrdupLoc (const char *str, const char *file, int line);
#ifdef DEBUG_MEMORY_LOCATION
/**
* xmlMalloc:
* @size: number of bytes to allocate
*
* Wrapper for the malloc() function used in the XML library.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__)
/**
* xmlMallocAtomic:
* @size: number of bytes to allocate
*
* Wrapper for the malloc() function used in the XML library for allocation
* of block not containing pointers to other areas.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__)
/**
* xmlRealloc:
* @ptr: pointer to the existing allocated area
* @size: number of bytes to allocate
*
* Wrapper for the realloc() function used in the XML library.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__)
/**
* xmlMemStrdup:
* @str: pointer to the existing string
*
* Wrapper for the strdup() function, xmlStrdup() is usually preferred.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__)
#endif /* DEBUG_MEMORY_LOCATION */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#ifndef __XML_GLOBALS_H
#ifndef __XML_THREADS_H__
#include <libxml/threads.h>
#include <libxml/globals.h>
#endif
#endif
#endif /* __DEBUG_MEMORY_ALLOC__ */

View File

@ -0,0 +1,57 @@
/*
* Summary: dynamic module loading
* Description: basic API for dynamic module loading, used by
* libexslt added in 2.6.17
*
* Copy: See Copyright for the status of this software.
*
* Author: Joel W. Reed
*/
#ifndef __XML_MODULE_H__
#define __XML_MODULE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_MODULES_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlModulePtr:
*
* A handle to a dynamically loaded module
*/
typedef struct _xmlModule xmlModule;
typedef xmlModule *xmlModulePtr;
/**
* xmlModuleOption:
*
* enumeration of options that can be passed down to xmlModuleOpen()
*/
typedef enum {
XML_MODULE_LAZY = 1, /* lazy binding */
XML_MODULE_LOCAL= 2 /* local binding */
} xmlModuleOption;
XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename,
int options);
XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module,
const char* name,
void **result);
XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module);
XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_MODULES_ENABLED */
#endif /*__XML_MODULE_H__ */

View File

@ -0,0 +1,424 @@
/*
* Summary: the XMLReader implementation
* Description: API of the XML streaming API based on C# interfaces.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XMLREADER_H__
#define __XML_XMLREADER_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/xmlIO.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/relaxng.h>
#include <libxml/xmlschemas.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlParserSeverities:
*
* How severe an error callback is when the per-reader error callback API
* is used.
*/
typedef enum {
XML_PARSER_SEVERITY_VALIDITY_WARNING = 1,
XML_PARSER_SEVERITY_VALIDITY_ERROR = 2,
XML_PARSER_SEVERITY_WARNING = 3,
XML_PARSER_SEVERITY_ERROR = 4
} xmlParserSeverities;
#ifdef LIBXML_READER_ENABLED
/**
* xmlTextReaderMode:
*
* Internal state values for the reader.
*/
typedef enum {
XML_TEXTREADER_MODE_INITIAL = 0,
XML_TEXTREADER_MODE_INTERACTIVE = 1,
XML_TEXTREADER_MODE_ERROR = 2,
XML_TEXTREADER_MODE_EOF =3,
XML_TEXTREADER_MODE_CLOSED = 4,
XML_TEXTREADER_MODE_READING = 5
} xmlTextReaderMode;
/**
* xmlParserProperties:
*
* Some common options to use with xmlTextReaderSetParserProp, but it
* is better to use xmlParserOption and the xmlReaderNewxxx and
* xmlReaderForxxx APIs now.
*/
typedef enum {
XML_PARSER_LOADDTD = 1,
XML_PARSER_DEFAULTATTRS = 2,
XML_PARSER_VALIDATE = 3,
XML_PARSER_SUBST_ENTITIES = 4
} xmlParserProperties;
/**
* xmlReaderTypes:
*
* Predefined constants for the different types of nodes.
*/
typedef enum {
XML_READER_TYPE_NONE = 0,
XML_READER_TYPE_ELEMENT = 1,
XML_READER_TYPE_ATTRIBUTE = 2,
XML_READER_TYPE_TEXT = 3,
XML_READER_TYPE_CDATA = 4,
XML_READER_TYPE_ENTITY_REFERENCE = 5,
XML_READER_TYPE_ENTITY = 6,
XML_READER_TYPE_PROCESSING_INSTRUCTION = 7,
XML_READER_TYPE_COMMENT = 8,
XML_READER_TYPE_DOCUMENT = 9,
XML_READER_TYPE_DOCUMENT_TYPE = 10,
XML_READER_TYPE_DOCUMENT_FRAGMENT = 11,
XML_READER_TYPE_NOTATION = 12,
XML_READER_TYPE_WHITESPACE = 13,
XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,
XML_READER_TYPE_END_ELEMENT = 15,
XML_READER_TYPE_END_ENTITY = 16,
XML_READER_TYPE_XML_DECLARATION = 17
} xmlReaderTypes;
/**
* xmlTextReader:
*
* Structure for an xmlReader context.
*/
typedef struct _xmlTextReader xmlTextReader;
/**
* xmlTextReaderPtr:
*
* Pointer to an xmlReader context.
*/
typedef xmlTextReader *xmlTextReaderPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlNewTextReader (xmlParserInputBufferPtr input,
const char *URI);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlNewTextReaderFilename(const char *URI);
XMLPUBFUN void XMLCALL
xmlFreeTextReader (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderSetup(xmlTextReaderPtr reader,
xmlParserInputBufferPtr input, const char *URL,
const char *encoding, int options);
/*
* Iterators
*/
XMLPUBFUN int XMLCALL
xmlTextReaderRead (xmlTextReaderPtr reader);
#ifdef LIBXML_WRITER_ENABLED
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadInnerXml (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadOuterXml (xmlTextReaderPtr reader);
#endif
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadString (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader);
/*
* Attributes of the node
*/
XMLPUBFUN int XMLCALL
xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderDepth (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderHasValue(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsDefault (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNodeType (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderReadState (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstLocalName (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstName (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstPrefix (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstXmlLang (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstString (xmlTextReaderPtr reader,
const xmlChar *str);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstValue (xmlTextReaderPtr reader);
/*
* use the Const version of the routine for
* better performance and simpler code
*/
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLocalName (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderName (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderPrefix (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderXmlLang (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderValue (xmlTextReaderPtr reader);
/*
* Methods of the XmlTextReader
*/
XMLPUBFUN int XMLCALL
xmlTextReaderClose (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
int no);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttribute (xmlTextReaderPtr reader,
const xmlChar *name);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlTextReaderGetRemainder (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,
const xmlChar *prefix);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,
int no);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,
const xmlChar *name);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToElement (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNormalization (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstEncoding (xmlTextReaderPtr reader);
/*
* Extensions
*/
XMLPUBFUN int XMLCALL
xmlTextReaderSetParserProp (xmlTextReaderPtr reader,
int prop,
int value);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserProp (xmlTextReaderPtr reader,
int prop);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderCurrentNode (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderPreserve (xmlTextReaderPtr reader);
#ifdef LIBXML_PATTERN_ENABLED
XMLPUBFUN int XMLCALL
xmlTextReaderPreservePattern(xmlTextReaderPtr reader,
const xmlChar *pattern,
const xmlChar **namespaces);
#endif /* LIBXML_PATTERN_ENABLED */
XMLPUBFUN xmlDocPtr XMLCALL
xmlTextReaderCurrentDoc (xmlTextReaderPtr reader);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderExpand (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNext (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNextSibling (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsValid (xmlTextReaderPtr reader);
#ifdef LIBXML_SCHEMAS_ENABLED
XMLPUBFUN int XMLCALL
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
const char *rng);
XMLPUBFUN int XMLCALL
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
xmlRelaxNGPtr schema);
XMLPUBFUN int XMLCALL
xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
const char *xsd);
XMLPUBFUN int XMLCALL
xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
xmlSchemaValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlTextReaderSetSchema (xmlTextReaderPtr reader,
xmlSchemaPtr schema);
#endif
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderStandalone (xmlTextReaderPtr reader);
/*
* Index lookup
*/
XMLPUBFUN long XMLCALL
xmlTextReaderByteConsumed (xmlTextReaderPtr reader);
/*
* New more complete APIs for simpler creation and reuse of readers
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderWalker (xmlDocPtr doc);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForDoc (const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForFile (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewWalker (xmlTextReaderPtr reader,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlReaderNewDoc (xmlTextReaderPtr reader,
const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewFile (xmlTextReaderPtr reader,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewMemory (xmlTextReaderPtr reader,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewFd (xmlTextReaderPtr reader,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewIO (xmlTextReaderPtr reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/*
* Error handling extensions
*/
typedef void * xmlTextReaderLocatorPtr;
/**
* xmlTextReaderErrorFunc:
* @arg: the user argument
* @msg: the message
* @severity: the severity of the error
* @locator: a locator indicating where the error occured
*
* Signature of an error callback from a reader parser
*/
typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg,
const char *msg,
xmlParserSeverities severity,
xmlTextReaderLocatorPtr locator);
XMLPUBFUN int XMLCALL
xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
/*int xmlTextReaderLocatorLinePosition(xmlTextReaderLocatorPtr locator);*/
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
XMLPUBFUN void XMLCALL
xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc f,
void *arg);
XMLPUBFUN void XMLCALL
xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
xmlStructuredErrorFunc f,
void *arg);
XMLPUBFUN void XMLCALL
xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc *f,
void **arg);
#endif /* LIBXML_READER_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_XMLREADER_H__ */

View File

@ -0,0 +1,222 @@
/*
* Summary: regular expressions handling
* Description: basic API for libxml regular expressions handling used
* for XML Schemas and validation.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_REGEXP_H__
#define __XML_REGEXP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlRegexpPtr:
*
* A libxml regular expression, they can actually be far more complex
* thank the POSIX regex expressions.
*/
typedef struct _xmlRegexp xmlRegexp;
typedef xmlRegexp *xmlRegexpPtr;
/**
* xmlRegExecCtxtPtr:
*
* A libxml progressive regular expression evaluation context
*/
typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
#ifdef __cplusplus
}
#endif
#include <libxml/tree.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The POSIX like API
*/
XMLPUBFUN xmlRegexpPtr XMLCALL
xmlRegexpCompile (const xmlChar *regexp);
XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
xmlRegexpExec (xmlRegexpPtr comp,
const xmlChar *value);
XMLPUBFUN void XMLCALL
xmlRegexpPrint (FILE *output,
xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
xmlRegexpIsDeterminist(xmlRegexpPtr comp);
/**
* xmlRegExecCallbacks:
* @exec: the regular expression context
* @token: the current token string
* @transdata: transition data
* @inputdata: input data
*
* Callback function when doing a transition in the automata
*/
typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
const xmlChar *token,
void *transdata,
void *inputdata);
/*
* The progressive API
*/
XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
xmlRegNewExecCtxt (xmlRegexpPtr comp,
xmlRegExecCallbacks callback,
void *data);
XMLPUBFUN void XMLCALL
xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
XMLPUBFUN int XMLCALL
xmlRegExecPushString(xmlRegExecCtxtPtr exec,
const xmlChar *value,
void *data);
XMLPUBFUN int XMLCALL
xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
const xmlChar *value,
const xmlChar *value2,
void *data);
XMLPUBFUN int XMLCALL
xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
XMLPUBFUN int XMLCALL
xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
const xmlChar **string,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
#ifdef LIBXML_EXPR_ENABLED
/*
* Formal regular expression handling
* Its goal is to do some formal work on content models
*/
/* expressions are used within a context */
typedef struct _xmlExpCtxt xmlExpCtxt;
typedef xmlExpCtxt *xmlExpCtxtPtr;
XMLPUBFUN void XMLCALL
xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
XMLPUBFUN xmlExpCtxtPtr XMLCALL
xmlExpNewCtxt (int maxNodes,
xmlDictPtr dict);
XMLPUBFUN int XMLCALL
xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
/* Expressions are trees but the tree is opaque */
typedef struct _xmlExpNode xmlExpNode;
typedef xmlExpNode *xmlExpNodePtr;
typedef enum {
XML_EXP_EMPTY = 0,
XML_EXP_FORBID = 1,
XML_EXP_ATOM = 2,
XML_EXP_SEQ = 3,
XML_EXP_OR = 4,
XML_EXP_COUNT = 5
} xmlExpNodeType;
/*
* 2 core expressions shared by all for the empty language set
* and for the set with just the empty token
*/
XMLPUBVAR xmlExpNodePtr forbiddenExp;
XMLPUBVAR xmlExpNodePtr emptyExp;
/*
* Expressions are reference counted internally
*/
XMLPUBFUN void XMLCALL
xmlExpFree (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr);
XMLPUBFUN void XMLCALL
xmlExpRef (xmlExpNodePtr expr);
/*
* constructors can be either manual or from a string
*/
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpParse (xmlExpCtxtPtr ctxt,
const char *expr);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewAtom (xmlExpCtxtPtr ctxt,
const xmlChar *name,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewOr (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewSeq (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewRange (xmlExpCtxtPtr ctxt,
xmlExpNodePtr subset,
int min,
int max);
/*
* The really interesting APIs
*/
XMLPUBFUN int XMLCALL
xmlExpIsNillable(xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
xmlExpMaxToken (xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**langList,
int len);
XMLPUBFUN int XMLCALL
xmlExpGetStart (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**tokList,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpStringDerive(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar *str,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpExpDerive (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN int XMLCALL
xmlExpSubsume (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN void XMLCALL
xmlExpDump (xmlBufferPtr buf,
xmlExpNodePtr expr);
#endif /* LIBXML_EXPR_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_REGEXP_ENABLED */
#endif /*__XML_REGEXP_H__ */

View File

@ -0,0 +1,87 @@
/*
* Summary: the XML document serializer
* Description: API to save document or subtree of document
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XMLSAVE_H__
#define __XML_XMLSAVE_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/encoding.h>
#include <libxml/xmlIO.h>
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlSaveOption:
*
* This is the set of XML save options that can be passed down
* to the xmlSaveToFd() and similar calls.
*/
typedef enum {
XML_SAVE_FORMAT = 1<<0, /* format save output */
XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */
XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */
XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */
XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */
XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */
XML_SAVE_AS_HTML = 1<<6 /* force HTML serialization on XML doc */
} xmlSaveOption;
typedef struct _xmlSaveCtxt xmlSaveCtxt;
typedef xmlSaveCtxt *xmlSaveCtxtPtr;
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToFd (int fd,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToFilename (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToBuffer (xmlBufferPtr buffer,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
const char *encoding,
int options);
XMLPUBFUN long XMLCALL
xmlSaveDoc (xmlSaveCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN long XMLCALL
xmlSaveTree (xmlSaveCtxtPtr ctxt,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSaveFlush (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSaveClose (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape);
XMLPUBFUN int XMLCALL
xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* __XML_XMLSAVE_H__ */

View File

@ -0,0 +1,218 @@
/*
* Summary: incomplete XML Schemas structure implementation
* Description: interface to the XML Schemas handling and schema validity
* checking, it is incomplete right now.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_H__
#define __XML_SCHEMA_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* This error codes are obsolete; not used any more.
*/
typedef enum {
XML_SCHEMAS_ERR_OK = 0,
XML_SCHEMAS_ERR_NOROOT = 1,
XML_SCHEMAS_ERR_UNDECLAREDELEM,
XML_SCHEMAS_ERR_NOTTOPLEVEL,
XML_SCHEMAS_ERR_MISSING,
XML_SCHEMAS_ERR_WRONGELEM,
XML_SCHEMAS_ERR_NOTYPE,
XML_SCHEMAS_ERR_NOROLLBACK,
XML_SCHEMAS_ERR_ISABSTRACT,
XML_SCHEMAS_ERR_NOTEMPTY,
XML_SCHEMAS_ERR_ELEMCONT,
XML_SCHEMAS_ERR_HAVEDEFAULT,
XML_SCHEMAS_ERR_NOTNILLABLE,
XML_SCHEMAS_ERR_EXTRACONTENT,
XML_SCHEMAS_ERR_INVALIDATTR,
XML_SCHEMAS_ERR_INVALIDELEM,
XML_SCHEMAS_ERR_NOTDETERMINIST,
XML_SCHEMAS_ERR_CONSTRUCT,
XML_SCHEMAS_ERR_INTERNAL,
XML_SCHEMAS_ERR_NOTSIMPLE,
XML_SCHEMAS_ERR_ATTRUNKNOWN,
XML_SCHEMAS_ERR_ATTRINVALID,
XML_SCHEMAS_ERR_VALUE,
XML_SCHEMAS_ERR_FACET,
XML_SCHEMAS_ERR_,
XML_SCHEMAS_ERR_XXX
} xmlSchemaValidError;
/*
* ATTENTION: Change xmlSchemaSetValidOptions's check
* for invalid values, if adding to the validation
* options below.
*/
/**
* xmlSchemaValidOption:
*
* This is the set of XML Schema validation options.
*/
typedef enum {
XML_SCHEMA_VAL_VC_I_CREATE = 1<<0
/* Default/fixed: create an attribute node
* or an element's text node on the instance.
*/
} xmlSchemaValidOption;
/*
XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,
* assemble schemata using
* xsi:schemaLocation and
* xsi:noNamespaceSchemaLocation
*/
/**
* The schemas related types are kept internal
*/
typedef struct _xmlSchema xmlSchema;
typedef xmlSchema *xmlSchemaPtr;
/**
* xmlSchemaValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from an XSD validation
*/
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlSchemaValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from an XSD validation
*/
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* A schemas validation context
*/
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaPtr XMLCALL
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchemaFree (xmlSchemaPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlSchemaDump (FILE *output,
xmlSchemaPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc *err,
xmlSchemaValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
XMLPUBFUN void XMLCALL
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
xmlDocPtr instance);
XMLPUBFUN int XMLCALL
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc,
xmlSAXHandlerPtr sax,
void *user_data);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
const char * filename,
int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
/*
* Interface to insert Schemas SAX validation in a SAX stream
*/
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
xmlSAXHandlerPtr *sax,
void **user_data);
XMLPUBFUN int XMLCALL
xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_H__ */

View File

@ -0,0 +1,151 @@
/*
* Summary: implementation of XML Schema Datatypes
* Description: module providing the XML Schema Datatypes implementation
* both definition and validity checking
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_TYPES_H__
#define __XML_SCHEMA_TYPES_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/schemasInternals.h>
#include <libxml/xmlschemas.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
XML_SCHEMA_WHITESPACE_PRESERVE = 1,
XML_SCHEMA_WHITESPACE_REPLACE = 2,
XML_SCHEMA_WHITESPACE_COLLAPSE = 3
} xmlSchemaWhitespaceValueType;
XMLPUBFUN void XMLCALL
xmlSchemaInitTypes (void);
XMLPUBFUN void XMLCALL
xmlSchemaCleanupTypes (void);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetPredefinedType (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val);
XMLPUBFUN int XMLCALL
xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFacet (xmlSchemaTypePtr base,
xmlSchemaFacetPtr facet,
const xmlChar *value,
xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType fws,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaValPtr val,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN void XMLCALL
xmlSchemaFreeValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaFacetPtr XMLCALL
xmlSchemaNewFacet (void);
XMLPUBFUN int XMLCALL
xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
xmlSchemaTypePtr typeDecl,
xmlSchemaParserCtxtPtr ctxt,
const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlSchemaFreeFacet (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL
xmlSchemaCompareValues (xmlSchemaValPtr x,
xmlSchemaValPtr y);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type);
XMLPUBFUN int XMLCALL
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
const xmlChar *value,
unsigned long actualLen,
unsigned long *expectedLen);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetBuiltInType (xmlSchemaValType type);
XMLPUBFUN int XMLCALL
xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
int facetType);
XMLPUBFUN xmlChar * XMLCALL
xmlSchemaCollapseString (const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlSchemaWhiteSpaceReplace (const xmlChar *value);
XMLPUBFUN unsigned long XMLCALL
xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL
xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
xmlSchemaFacetPtr facet,
const xmlChar *value,
xmlSchemaValPtr val,
unsigned long *length);
XMLPUBFUN int XMLCALL
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaValPtr val,
unsigned long *length,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int XMLCALL
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSchemaGetCanonValue (xmlSchemaValPtr val,
const xmlChar **retValue);
XMLPUBFUN int XMLCALL
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
const xmlChar **retValue,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int XMLCALL
xmlSchemaValueAppend (xmlSchemaValPtr prev,
xmlSchemaValPtr cur);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaValueGetNext (xmlSchemaValPtr cur);
XMLPUBFUN const xmlChar * XMLCALL
xmlSchemaValueGetAsString (xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL
xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewStringValue (xmlSchemaValType type,
const xmlChar *value);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewNOTATIONValue (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewQNameValue (const xmlChar *namespaceName,
const xmlChar *localName);
XMLPUBFUN int XMLCALL
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
xmlSchemaWhitespaceValueType xws,
xmlSchemaValPtr y,
xmlSchemaWhitespaceValueType yws);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaCopyValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValType XMLCALL
xmlSchemaGetValType (xmlSchemaValPtr val);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_TYPES_H__ */

Some files were not shown because too many files have changed in this diff Show More