Commit ed6c5497 authored by Daniel Veillard's avatar Daniel Veillard

changed xmlPatterncompile signature to pass an int and not an enum since

* pattern.c include/libxml/pattern.h: changed xmlPatterncompile
  signature to pass an int and not an enum since it can generate
  ABI compat troubles.
* include/libxml/schematron.h schematron.c: adding the new
  schematron code, work in progress lots to be left and needing
  testing
* include/libxml/xmlversion.h.in include/libxml/xmlwin32version.h.in
  Makefile.am configure.in: integration of schematron into the
  build
* xpath.c include/libxml/xpath.h: adding flags to control compilation
  options right now just XML_XPATH_CHECKNS.
Daniel
parent 041c5ffa
Sat Jul 23 10:55:50 EDT 2005 Daniel Veillard <daniel@veillard.com>
* pattern.c include/libxml/pattern.h: changed xmlPatterncompile
signature to pass an int and not an enum since it can generate
ABI compat troubles.
* include/libxml/schematron.h schematron.c: adding the new
schematron code, work in progress lots to be left and needing
testing
* include/libxml/xmlversion.h.in include/libxml/xmlwin32version.h.in
Makefile.am configure.in: integration of schematron into the
build
* xpath.c include/libxml/xpath.h: adding flags to control compilation
options right now just XML_XPATH_CHECKNS.
Sat Jul 23 16:39:35 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c: Removed an "internal error" message from
......
......@@ -27,7 +27,8 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
catalog.c globals.c threads.c c14n.c xmlstring.c \
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c \
xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c xmlmodule.c
xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \
xmlmodule.c schematron.c
else
libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \
......@@ -37,7 +38,7 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
xmlreader.c relaxng.c dict.c SAX2.c \
xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \
xmlmodule.c
xmlmodule.c schematron.c
endif
DEPS = $(top_builddir)/libxml2.la
......
......@@ -128,6 +128,8 @@ AC_ARG_WITH(sax1,
[ --with-sax1 add the older SAX1 interface (on)])
AC_ARG_WITH(schemas,
[ --with-schemas add Relax-NG and Schemas support (on)])
AC_ARG_WITH(schematron,
[ --with-schematron add Schematron support (on)])
AC_ARG_WITH(threads,
[ --with-threads add multithread support(on)])
AC_ARG_WITH(thread-alloc,
......@@ -163,6 +165,11 @@ then
with_pattern=yes
with_regexp=yes
fi
if test "$with_schematron" = "yes"
then
with_pattern=yes
with_xpath=yes
fi
if test "$with_reader" = "yes"
then
with_push=yes
......@@ -270,6 +277,10 @@ then
then
with_schemas=no
fi
if test "$with_schematron" = ""
then
with_schematron=no
fi
if test "$with_threads" = ""
then
with_threads=no
......@@ -1152,6 +1163,20 @@ fi
fi
AC_SUBST(WITH_ISO8859X)
if test "$with_schematron" = "no" ; then
echo "Disabling Schematron support"
WITH_SCHEMATRON=0
TEST_SCHEMATRON=
else
echo "Enabled Schematron support"
WITH_SCHEMATRON=1
TEST_SCHEMATRON="Schematrontests"
with_xpath=yes
with_pattern=yes
fi
AC_SUBST(WITH_SCHEMATRON)
AC_SUBST(TEST_SCHEMATRON)
if test "$with_schemas" = "no" ; then
echo "Disabling Schemas/Relax-NG support"
WITH_SCHEMAS=0
......
......@@ -52,7 +52,7 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN xmlPatternPtr XMLCALL
xmlPatterncompile (const xmlChar *pattern,
xmlDict *dict,
xmlPatternFlags flags,
int flags,
const xmlChar **namespaces);
XMLPUBFUN int XMLCALL
xmlPatternMatch (xmlPatternPtr comp,
......
/*
* 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
#define XML_SCHEMATRON_NS BAD_CAST "http://purl.oclc.org/dsdl/schematron"
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_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;
/**
* A schemas validation context
*/
typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
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);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlSchematronDump (FILE *output,
xmlSchematronPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
xmlSchematronSetValidStructuredErrors(xmlSchematronValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror, 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 xmlSchematronValidCtxtPtr XMLCALL
xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
int options);
XMLPUBFUN void XMLCALL
xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
xmlDocPtr instance);
XMLPUBFUN int XMLCALL
xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
xmlNodePtr elem);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMATRON_ENABLED */
#endif /* __XML_SCHEMATRON_H__ */
......@@ -339,6 +339,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#define LIBXML_SCHEMAS_ENABLED
#endif
/**
* LIBXML_SCHEMATRON_ENABLED:
*
* Whether the Schematron validation interfaces are compiled in
*/
#if @WITH_SCHEMATRON@
#define LIBXML_SCHEMATRON_ENABLED
#endif
/**
* LIBXML_MODULES_ENABLED:
*
......
......@@ -165,6 +165,15 @@ extern void xmlCheckVersion(int version);
#define LIBXML_XINCLUDE_ENABLED
#endif
/**
* LIBXML_SCHEMATRON_ENABLED:
*
* Whether the Schematron validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMATRON_ENABLED
#endif
/**
* LIBXML_ICONV_ENABLED:
*
......
......@@ -248,6 +248,14 @@ typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
/**
* xmlXPathFlags:
* Flags for XPath engine compilation and runtime
*/
typedef enum {
XML_XPATH_CHECKNS = 1 /* check namespaces at compilation */
} xmlXPathFlags;
/**
* xmlXPathContext:
*
......@@ -324,6 +332,8 @@ struct _xmlXPathContext {
/* dictionnary */
xmlDictPtr dict; /* dictionnary if any */
int flags; /* flags to control compilation */
};
/*
......
......@@ -1954,7 +1954,7 @@ xmlStreamPop(xmlStreamCtxtPtr stream) {
* xmlPatterncompile:
* @pattern: the pattern to compile
* @dict: an optional dictionary for interned strings
* @flags: compilation flags, undefined yet
* @flags: compilation flags, see xmlPatternFlags
* @namespaces: the prefix definitions, array of [URI, prefix] or NULL
*
* Compile a pattern.
......@@ -1962,8 +1962,7 @@ xmlStreamPop(xmlStreamCtxtPtr stream) {
* Returns the compiled form of the pattern or NULL in case of error
*/
xmlPatternPtr
xmlPatterncompile(const xmlChar *pattern, xmlDict *dict,
xmlPatternFlags flags,
xmlPatterncompile(const xmlChar *pattern, xmlDict *dict, int flags,
const xmlChar **namespaces) {
xmlPatternPtr ret = NULL, cur;
xmlPatParserContextPtr ctxt = NULL;
......
This diff is collapsed.
......@@ -8926,6 +8926,12 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
if (test == 0)
return;
if ((prefix != NULL) && (ctxt->context != NULL) &&
(ctxt->context->flags & XML_XPATH_CHECKNS)) {
if (xmlXPathNsLookup(ctxt->context, prefix) == NULL) {
xmlXPathErr(ctxt, XPATH_UNDEF_PREFIX_ERROR);
}
}
#ifdef DEBUG_STEP
xmlGenericError(xmlGenericErrorContext,
"Basis : computing new set\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment