diff --git a/ChangeLog b/ChangeLog index b40922b7..e7a2dd9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Tue Dec 9 12:29:26 CET 2003 Daniel Veillard + + * xinclude.c xmllint.c xmlreader.c include/libxml/xinclude.h + include/libxml/xmlerror.h: augmented the XInclude API + to be able to pass XML parser flags down to the Inclusion + process. Also resynchronized with the Last Call W3C Working + Draft 10 November 2003 for the xpointer attribute. + * Makefile.am test/XInclude/docs/nodes[23].xml + result/XInclude/*: augmented the tests for the new namespace and + testing the xpointer attribute, changed the way error messages + are tested + * doc/*: regenerated the documentation + Mon Dec 8 18:38:26 CET 2003 Daniel Veillard * error.c: filter warning messages if the global setting blocks them diff --git a/Makefile.am b/Makefile.am index f10ed55a..cedd5205 100644 --- a/Makefile.am +++ b/Makefile.am @@ -405,14 +405,15 @@ XIncludetests : xmllint$(EXEEXT) if [ ! -d $$i ] ; then \ if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \ echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > $(srcdir)/result/XInclude/$$name ; \ + $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i 2>&1 > result.$$name | grep -v 'failed to load external entity' ; \ + log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > result.$$name 2>error.$$name | grep -v 'failed to load external entity' ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name result.$$name` ; \ + diff $(srcdir)/result/XInclude/$$name result.$$name ; \ + diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ + rm result.$$name error.$$name ; \ fi ; fi ; done) @(echo > .memdump) @echo "## XInclude xmlReader regression tests" @@ -424,11 +425,12 @@ XIncludetests : xmllint$(EXEEXT) $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --walker --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i 2>&1 > result.$$name | grep -v 'failed to load external entity' ; \ + log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name | grep -v 'failed to load external entity' ; \ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ + diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \ diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ + rm result.$$name error.$$name ; \ fi ; fi ; done) Scripttests : xmllint$(EXEEXT) diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html index 0c953d80..9c368466 100644 --- a/doc/APIchunk11.html +++ b/doc/APIchunk11.html @@ -171,10 +171,12 @@ A:link, A:visited, A:active { text-decoration: underline } XINCLUDE_HREF
XINCLUDE_NODE
XINCLUDE_NS
+XINCLUDE_OLD_NS
XINCLUDE_PARSE
XINCLUDE_PARSE_ENCODING
XINCLUDE_PARSE_TEXT
XINCLUDE_PARSE_XML
+XINCLUDE_PARSE_XPOINTER
xmlGetID
xmlReconciliateNs
xmlShellDu
@@ -504,6 +506,7 @@ A:link, A:visited, A:active { text-decoration: underline }
doublequotes
xmlParseQuotedString
down
xmlGetBufferAllocationScheme
xmlSetBufferAllocationScheme
+
draft
XINCLUDE_OLD_NS
drop
xmlFileRead
xmlIOFTPRead
xmlIOHTTPRead
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index 4011faca..698cc4c2 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -56,8 +56,10 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRemoveRef
xmlShellLoad
xmlXIncludeProcess
+xmlXIncludeProcessFlags
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
xmlXPathCompareValues
fails
UTF8ToHtml
UTF8Toisolat1
@@ -197,6 +199,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReaderNewFile
xmlReaderNewIO
xmlReaderNewMemory
+xmlXIncludeSetFlags
flat
xmlStringGetNodeList
xmlStringLenGetNodeList
floor
xmlXPathFloorFunction
@@ -356,6 +359,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStopParser
xmlValidCtxtNormalizeAttributeValue
xmlValidNormalizeAttributeValue
+xmlXIncludeSetFlags

A-B C-C D-E diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html index e3f87024..76e06c4b 100644 --- a/doc/APIchunk14.html +++ b/doc/APIchunk14.html @@ -314,6 +314,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlIsAutoClosed
htmlStartCloseIndex
htmlInitAutoClose
http:
XINCLUDE_NS
+XINCLUDE_OLD_NS
getSystemId
xmlC14NDocDumpMemory
xmlC14NDocSave
diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html index 2e0ed366..80f08813 100644 --- a/doc/APIchunk15.html +++ b/doc/APIchunk15.html @@ -134,6 +134,9 @@ A:link, A:visited, A:active { text-decoration: underline }
includes
_xmlSchema
xmlCleanupInputCallbacks
xmlCleanupOutputCallbacks
+xmlXIncludeProcessFlags
+xmlXIncludeProcessTreeFlags
+xmlXIncludeSetFlags
including
attribute
attributeSAXFunc
ftpListCallback
diff --git a/doc/APIchunk18.html b/doc/APIchunk18.html index c0457387..7564bba7 100644 --- a/doc/APIchunk18.html +++ b/doc/APIchunk18.html @@ -46,6 +46,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidGetValidElements
namespace-uri
xmlXPathNamespaceURIFunction
namespace:
XINCLUDE_NS
+XINCLUDE_OLD_NS
xmlParseAttribute
xmlParseStartTag
namespaces
_xmlParserCtxt
diff --git a/doc/APIchunk19.html b/doc/APIchunk19.html index 4d62a35e..f2ce57a8 100644 --- a/doc/APIchunk19.html +++ b/doc/APIchunk19.html @@ -224,6 +224,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathNextPreceding
ordering
xmlListDataCompare
org
XINCLUDE_NS
+XINCLUDE_OLD_NS
xmlC14NDocDumpMemory
xmlC14NDocSave
xmlC14NDocSaveTo
diff --git a/doc/APIchunk20.html b/doc/APIchunk20.html index 3bcbc46d..db92216f 100644 --- a/doc/APIchunk20.html +++ b/doc/APIchunk20.html @@ -358,31 +358,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAX2StartElement
xmlTextReaderRelaxNGSetSchema
xmlTextReaderRelaxNGValidate
-
processing
HTML_PI_NODE
-entityDecl
-entityDeclSAXFunc
-htmlInitAutoClose
-processingInstruction
-processingInstructionSAXFunc
-xmlCleanupParser
-xmlCleanupThreads
-xmlGetProp
-xmlInitCharEncodingHandlers
-xmlInitParser
-xmlListReverseWalk
-xmlListWalk
-xmlNewPI
-xmlParseAttValue
-xmlParsePI
-xmlSAX2EntityDecl
-xmlSAX2ProcessingInstruction
-xmlStopParser
-xmlTextReaderSetParserProp
-xmlValidateOneAttribute
-xmlValidateOneNamespace
-xmlXIncludeProcess
-xmlXIncludeProcessNode
-xmlXIncludeProcessTree
processing-instruction
xmlXPathIsNodeType
processor
xmlCurrentChar
xmlParseAttValue
diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html index 043ad629..20b664b2 100644 --- a/doc/APIchunk21.html +++ b/doc/APIchunk21.html @@ -463,6 +463,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaFreeParserCtxt
xmlSchemaFreeValidCtxt
xmlTextReaderClose
+xmlXIncludeSetFlags
respecting
xmlValidGetValidElements
response
xmlNanoFTPCheckResponse
xmlNanoFTPGetResponse
diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html index 91409430..77f11594 100644 --- a/doc/APIchunk22.html +++ b/doc/APIchunk22.html @@ -332,8 +332,10 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderSetParserProp
xmlValidatePushCData
xmlXIncludeProcess
+xmlXIncludeProcessFlags
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
somewhat
xmlCheckLanguageID
sorted
xmlParserAddNodeInfo
xmlParserFindNodeInfoIndex
@@ -666,13 +668,17 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringLenDecodeEntities
xmlSubstituteEntitiesDefault
xmlXIncludeProcess
+xmlXIncludeProcessFlags
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
substitutions
xmlStringDecodeEntities
xmlStringLenDecodeEntities
xmlXIncludeProcess
+xmlXIncludeProcessFlags
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
substring
xmlNodeAddContent
xmlNodeAddContentLen
xmlStrsub
@@ -695,6 +701,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidateElement
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
succeeded
xmlHashAddEntry
xmlHashAddEntry2
xmlHashAddEntry3
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index 50252917..c1e7aa65 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -297,8 +297,10 @@ A:link, A:visited, A:active { text-decoration: underline } xmlKeepBlanksDefault
xmlMemShow
xmlXIncludeProcess
+xmlXIncludeProcessFlags
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
wether
_xmlNodeSet
xmlPatternMatch
what
xmlCatalogGetDefaults
@@ -415,6 +417,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlOutputBufferWriteString
writing
xmlOutputBufferCreateFilename
www
XINCLUDE_NS
+XINCLUDE_OLD_NS
getSystemId
xmlC14NDocDumpMemory
xmlC14NDocSave
diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html index 7c6b29c4..3503d93e 100644 --- a/doc/APIchunk25.html +++ b/doc/APIchunk25.html @@ -456,6 +456,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReaderWalker
xpath
xmlShellPrintXPathError
xmlShellPrintXPathResult
+
xpointer
XINCLUDE_PARSE_XPOINTER

A-B C-C D-E diff --git a/doc/APIchunk6.html b/doc/APIchunk6.html index 6281f66f..4850183e 100644 --- a/doc/APIchunk6.html +++ b/doc/APIchunk6.html @@ -339,6 +339,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSetNsProp
xmlSetProp
xmlSubstituteEntitiesDefault
+xmlXIncludeSetFlags
xmlXPtrEvalRangePredicate
Sets
htmlSetMetaEncoding
xmlBufferSetAllocationScheme
diff --git a/doc/APIchunk8.html b/doc/APIchunk8.html index f31e653f..20882d97 100644 --- a/doc/APIchunk8.html +++ b/doc/APIchunk8.html @@ -122,11 +122,15 @@ A:link, A:visited, A:active { text-decoration: underline }

Letter X:

XHTML
xmlIsXHTML
XInclude
LIBXML_XINCLUDE_ENABLED
XINCLUDE_NS
+XINCLUDE_OLD_NS
xmlXIncludeFreeContext
xmlXIncludeNewContext
xmlXIncludeProcess
+xmlXIncludeProcessFlags
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
+xmlXIncludeSetFlags
XLINK_TYPE_NONE
xlinkIsLink
XML-1
xmlDetectCharEncoding
xmlValidateAttributeDecl
@@ -188,6 +192,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathNewValueTree
xmlXPathStackIsNodeSet
Xinclude
XINCLUDE_NS
+XINCLUDE_OLD_NS
Xml
xmlTextReaderNodeType
XmlNodeType
xmlTextReaderNodeType

Letter Y:

YES
htmlNodeStatus
diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html index f977640e..ac23e72d 100644 --- a/doc/APIconstructors.html +++ b/doc/APIconstructors.html @@ -178,6 +178,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringDecodeEntities
xmlParseEncName
xmlTextReaderPrefix
+xmlDecodeEntities
xmlXPathCastNumberToString
xmlParseNmtoken
xmlTextReaderLocatorBaseURI
@@ -189,7 +190,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlEncodeSpecialChars
xmlURIEscapeStr
xmlGetNsProp
-xmlDecodeEntities
xmlXPathCastNodeToString
xmlNamespaceParseNCName
xmlCatalogResolveURI
@@ -247,8 +247,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAXParseMemoryWithData
xmlSAXParseEntity
xmlParseEntity
-xmlRecoverDoc
xmlSAXParseFileWithData
+xmlRecoverDoc
xmlReadDoc
xmlReadMemory
xmlCtxtReadIO
@@ -256,13 +256,13 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReadFile
xmlRecoverFile
xmlSAXParseDoc
-xmlParseCatalogFile
xmlCtxtReadFile
xmlCtxtReadFd
xmlReadIO
xmlCopyDoc
xmlCtxtReadMemory
xmlReadFd
+xmlParseCatalogFile
xmlCtxtReadDoc
xmlParseMemory
xmlSAXParseFile
diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 9b64301b..38fee131 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -1407,19 +1407,24 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidatePushCData
xmlRefTablePtr

Module xinclude:

XINCLUDE_PARSE_TEXT
+XINCLUDE_PARSE_XPOINTER
+xmlXIncludeProcessFlags
xmlXIncludeCtxt
XINCLUDE_HREF
xmlXIncludeProcessNode
XINCLUDE_FALLBACK
XINCLUDE_NS
-xmlXIncludeCtxtPtr
+XINCLUDE_PARSE
xmlXIncludeProcessTree
xmlXIncludeProcess
xmlXIncludeFreeContext
-XINCLUDE_PARSE
+xmlXIncludeCtxtPtr
XINCLUDE_NODE
+xmlXIncludeSetFlags
XINCLUDE_PARSE_XML
xmlXIncludeNewContext
+XINCLUDE_OLD_NS
+xmlXIncludeProcessTreeFlags
XINCLUDE_PARSE_ENCODING

Module xlink:

xlinkShow
XLINK_TYPE_SIMPLE
@@ -1645,7 +1650,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_XPATH_INVALID_CTXT_POSITION
XML_ERR_NOTATION_NOT_FINISHED
xmlError
-XML_HTML_STRUCURE_ERROR
+XML_DTD_STANDALONE_DEFAULTED
XML_DTD_INVALID_DEFAULT
XML_DTD_UNKNOWN_ELEM
XML_SCHEMAP_REDEFINED_TYPE
@@ -1726,11 +1731,11 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF
XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD
XML_RNGP_PAT_START_INTERLEAVE
-XML_IO_ENFILE
+XML_HTML_STRUCURE_ERROR
XML_SCHEMAV_MISSING
XML_RNGP_GRAMMAR_CONTENT
XML_XINCLUDE_XPTR_FAILED
-XML_DTD_ELEM_REDEFINED
+XML_IO_ENFILE
XML_RNGP_PARENTREF_CREATE_FAILED
XML_ERR_ENTITY_IS_PARAMETER
XML_ERR_RESERVED_XML_NAME
@@ -1818,7 +1823,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_RNGP_PAT_DATA_EXCEPT_ATTR
XML_FTP_ACCNT
XML_FROM_RELAXNGV
-XML_RNGP_PAT_START_DATA
+XML_RNGP_REF_NAME_INVALID
XML_SCHEMAV_NOTTOPLEVEL
XML_IO_ENOENT
XML_ERR_NO_DTD
@@ -1868,6 +1873,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_WAR_CATALOG_PI
XML_SCHEMAP_INVALID_MINOCCURS
XML_IO_ENOLCK
+XML_XINCLUDE_DEPRECATED_NS
XML_RNGP_CHOICE_EMPTY
XML_ERR_LITERAL_NOT_FINISHED
xmlSetStructuredErrorFunc
@@ -1940,13 +1946,14 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCtxtResetLastError
XML_IO_EFBIG
XML_ERR_NS_DECL_ERROR
-XML_RNGP_REF_NAME_INVALID
+XML_RNGP_PAT_START_DATA
XML_ERR_ERROR
XML_DTD_MISSING_ATTRIBUTE
XML_IO_EMFILE
XML_RNGP_EMPTY_NOT_EMPTY
XML_DTD_ELEM_NAMESPACE
XML_RNGP_PAT_ATTR_ELEM
+XML_XINCLUDE_FRAGMENT_ID
XML_IO_NO_INPUT
XML_NS_ERR_UNDEFINED_NAMESPACE
XML_XPATH_INVALID_ARITY
@@ -1976,6 +1983,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_FROM_XPOINTER
XML_ERR_ATTRIBUTE_WITHOUT_VALUE
XML_RNGP_TEXT_HAS_CHILD
+XML_DTD_ELEM_REDEFINED
XML_SCHEMAV_NOTNILLABLE
XML_SCHEMAP_ELEM_DEFAULT_FIXED
XML_SCHEMAP_UNKNOWN_TYPE
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index c21ab2fd..94d42a41 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -1368,6 +1368,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidateRoot
xmlXIncludeNewContext
xmlXIncludeProcess
+xmlXIncludeProcessFlags
xmlXPathNewContext
xmlXPathOrderDocElems
xmlXPtrNewContext
@@ -1663,6 +1664,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidatePushElement
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
xmlXPathCastNodeToNumber
xmlXPathCastNodeToString
xmlXPathCmpNodes
@@ -2199,6 +2201,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidateRoot

Type xmlXIncludeCtxtPtr:

xmlXIncludeFreeContext
xmlXIncludeProcessNode
+xmlXIncludeSetFlags

Type xmlXPathCompExprPtr:

xmlXPathCompiledEval
xmlXPathDebugDumpCompExpr
xmlXPathFreeCompExpr
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 0cdcee1d..bca353e7 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -95,10 +95,12 @@ A:link, A:visited, A:active { text-decoration: underline } XINCLUDE_HREF
XINCLUDE_NODE
XINCLUDE_NS
+XINCLUDE_OLD_NS
XINCLUDE_PARSE
XINCLUDE_PARSE_ENCODING
XINCLUDE_PARSE_TEXT
XINCLUDE_PARSE_XML
+XINCLUDE_PARSE_XPOINTER
XLINK_ACTUATE_AUTO
XLINK_ACTUATE_NONE
XLINK_ACTUATE_ONREQUEST
@@ -216,6 +218,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_DTD_NO_PREFIX
XML_DTD_NO_ROOT
XML_DTD_ROOT_NAME
+XML_DTD_STANDALONE_DEFAULTED
XML_DTD_STANDALONE_WHITE_SPACE
XML_DTD_UNKNOWN_ATTRIBUTE
XML_DTD_UNKNOWN_ELEM
@@ -872,10 +875,12 @@ A:link, A:visited, A:active { text-decoration: underline } XML_WAR_UNDECLARED_ENTITY
XML_WAR_UNKNOWN_VERSION
XML_XINCLUDE_BUILD_FAILED
+XML_XINCLUDE_DEPRECATED_NS
XML_XINCLUDE_END
XML_XINCLUDE_ENTITY_DEF_MISMATCH
XML_XINCLUDE_FALLBACKS_IN_INCLUDE
XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE
+XML_XINCLUDE_FRAGMENT_ID
XML_XINCLUDE_HREF_URI
XML_XINCLUDE_INCLUDE_IN_INCLUDE
XML_XINCLUDE_INVALID_CHAR
@@ -2604,8 +2609,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXIncludeFreeContext
xmlXIncludeNewContext
xmlXIncludeProcess
+xmlXIncludeProcessFlags
xmlXIncludeProcessNode
xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
+xmlXIncludeSetFlags
xmlXPathAddValues
xmlXPathAxis
xmlXPathAxisFunc
diff --git a/doc/html/libxml-xinclude.html b/doc/html/libxml-xinclude.html index 8c4368a5..ff7b3676 100644 --- a/doc/html/libxml-xinclude.html +++ b/doc/html/libxml-xinclude.html @@ -10,23 +10,28 @@ A:link, A:visited, A:active { text-decoration: underline } Module xinclude from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xinclude from libxml2

API Menu
API Indexes
Related links

API to handle XInclude processing, implements the World Wide Web Consortium Working Draft 26 October 2000

Table of Contents

#define XINCLUDE_FALLBACK
#define XINCLUDE_HREF
#define XINCLUDE_NODE
#define XINCLUDE_NS
#define XINCLUDE_PARSE
#define XINCLUDE_PARSE_ENCODING
#define XINCLUDE_PARSE_TEXT
#define XINCLUDE_PARSE_XML
Structure xmlXIncludeCtxt
struct _xmlXIncludeCtxt + Module xinclude from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xinclude from libxml2

API Menu
API Indexes
Related links

API to handle XInclude processing, implements the World Wide Web Consortium Last Call Working Draft 10 November 2003

Table of Contents

#define XINCLUDE_FALLBACK
#define XINCLUDE_HREF
#define XINCLUDE_NODE
#define XINCLUDE_NS
#define XINCLUDE_OLD_NS
#define XINCLUDE_PARSE
#define XINCLUDE_PARSE_ENCODING
#define XINCLUDE_PARSE_TEXT
#define XINCLUDE_PARSE_XML
#define XINCLUDE_PARSE_XPOINTER
Structure xmlXIncludeCtxt
struct _xmlXIncludeCtxt The content of this structure is not made public by the API.
Typedef xmlXIncludeCtxt * xmlXIncludeCtxtPtr
 
void	xmlXIncludeFreeContext		(xmlXIncludeCtxtPtr ctxt)
xmlXIncludeCtxtPtr	xmlXIncludeNewContext	(xmlDocPtr doc)
int	xmlXIncludeProcess		(xmlDocPtr doc)
+
int	xmlXIncludeProcessFlags		(xmlDocPtr doc, 
int flags)
int	xmlXIncludeProcessNode		(xmlXIncludeCtxtPtr ctxt, 
xmlNodePtr node)
int	xmlXIncludeProcessTree		(xmlNodePtr tree)
+
int	xmlXIncludeProcessTreeFlags	(xmlNodePtr tree, 
int flags)
+
int	xmlXIncludeSetFlags		(xmlXIncludeCtxtPtr ctxt, 
int flags)

Description

Macro: XINCLUDE_FALLBACK

#define XINCLUDE_FALLBACK

Macro defining "fallback"

Macro: XINCLUDE_HREF

#define XINCLUDE_HREF

Macro defining "href"

Macro: XINCLUDE_NODE

#define XINCLUDE_NODE

Macro defining "include"

-

Macro: XINCLUDE_NS

#define XINCLUDE_NS

Macro defining the Xinclude namespace: http://www.w3.org/2001/XInclude

+

Macro: XINCLUDE_NS

#define XINCLUDE_NS

Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude

+

Macro: XINCLUDE_OLD_NS

#define XINCLUDE_OLD_NS

Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude

Macro: XINCLUDE_PARSE

#define XINCLUDE_PARSE

Macro defining "parse"

Macro: XINCLUDE_PARSE_ENCODING

#define XINCLUDE_PARSE_ENCODING

Macro defining "encoding"

Macro: XINCLUDE_PARSE_TEXT

#define XINCLUDE_PARSE_TEXT

Macro defining "text"

Macro: XINCLUDE_PARSE_XML

#define XINCLUDE_PARSE_XML

Macro defining "xml"

+

Macro: XINCLUDE_PARSE_XPOINTER

#define XINCLUDE_PARSE_XPOINTER

Macro defining "xpointer"

Structure xmlXIncludeCtxt

Structure xmlXIncludeCtxt
struct _xmlXIncludeCtxt { The content of this structure is not made public by the API. }

Function: xmlXIncludeFreeContext

void	xmlXIncludeFreeContext		(xmlXIncludeCtxtPtr ctxt)
@@ -35,8 +40,14 @@ The content of this structure is not made public by the API.

Creates a new XInclude context

doc:an XML Document
Returns:the new set

Function: xmlXIncludeProcess

int	xmlXIncludeProcess		(xmlDocPtr doc)

Implement the XInclude substitution on the XML document @doc

-
doc:an XML document
Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

Function: xmlXIncludeProcessNode

int	xmlXIncludeProcessNode		(xmlXIncludeCtxtPtr ctxt, 
xmlNodePtr node)
+
doc:an XML document
Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

Function: xmlXIncludeProcessFlags

int	xmlXIncludeProcessFlags		(xmlDocPtr doc, 
int flags)
+

Implement the XInclude substitution on the XML document @doc

+
doc:an XML document
flags:a set of xmlParserOption used for parsing XML includes
Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

Function: xmlXIncludeProcessNode

int	xmlXIncludeProcessNode		(xmlXIncludeCtxtPtr ctxt, 
xmlNodePtr node)

Implement the XInclude substitution for the given subtree reusing the informations and data coming from the given context.

ctxt:an existing XInclude context
node:a node in an XML document
Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

Function: xmlXIncludeProcessTree

int	xmlXIncludeProcessTree		(xmlNodePtr tree)

Implement the XInclude substitution for the given subtree

-
tree:a node in an XML document
Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

Daniel Veillard

+
tree:a node in an XML document
Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

Function: xmlXIncludeProcessTreeFlags

int	xmlXIncludeProcessTreeFlags	(xmlNodePtr tree, 
int flags)
+

Implement the XInclude substitution for the given subtree

+
tree:a node in an XML document
flags:a set of xmlParserOption used for parsing XML includes
Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

Function: xmlXIncludeSetFlags

int	xmlXIncludeSetFlags		(xmlXIncludeCtxtPtr ctxt, 
int flags)
+

Set the flags used for further processing of XML resources.

+
ctxt:an XInclude processing context
flags:a set of xmlParserOption used for parsing XML includes
Returns:0 in case of success and -1 in case of error.

Daniel Veillard

diff --git a/doc/html/libxml-xmlerror.html b/doc/html/libxml-xmlerror.html index b8a9d348..8777fe6b 100644 --- a/doc/html/libxml-xmlerror.html +++ b/doc/html/libxml-xmlerror.html @@ -228,6 +228,7 @@ void xmlStructuredErrorFunc (void * userD XML_DTD_UNKNOWN_ENTITY = 535 : 535 XML_DTD_UNKNOWN_ID = 536 : 536 XML_DTD_UNKNOWN_NOTATION = 537 : 537 + XML_DTD_STANDALONE_DEFAULTED = 538 : 538 XML_HTML_STRUCURE_ERROR = 800 XML_HTML_UNKNOWN_TAG = 801 : 801 XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000 @@ -457,6 +458,8 @@ void xmlStructuredErrorFunc (void * userD XML_XINCLUDE_INCLUDE_IN_INCLUDE = 1614 : 1614 XML_XINCLUDE_FALLBACKS_IN_INCLUDE = 1615 : 1615 XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE = 1616 : 1616 + XML_XINCLUDE_DEPRECATED_NS = 1617 : 1617 + XML_XINCLUDE_FRAGMENT_ID = 1618 : 1618 XML_CATALOG_MISSING_ATTR = 1650 XML_CATALOG_ENTRY_BROKEN = 1651 : 1651 XML_CATALOG_PREFER_VALUE = 1652 : 1652 diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 155ba3f4..33de4376 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -1533,23 +1533,28 @@

implementation of XInclude - API to handle XInclude processing, implements the World Wide Web Consortium Working Draft 26 October 2000 + API to handle XInclude processing, implements the World Wide Web Consortium Last Call Working Draft 10 November 2003 Daniel Veillard + + - + + + + + - - - + + unfinished XLink detection module @@ -1787,7 +1792,7 @@ - + @@ -1865,11 +1870,11 @@ - + - + @@ -1953,7 +1958,7 @@ - + @@ -2003,6 +2008,7 @@ + @@ -2069,13 +2075,14 @@ - + + @@ -2105,6 +2112,7 @@ + @@ -3290,7 +3298,10 @@ Macro defining "include" - Macro defining the Xinclude namespace: http://www.w3.org/2001/XInclude + Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude + + + Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude Macro defining "parse" @@ -3304,6 +3315,9 @@ Macro defining "xml" + + Macro defining "xpointer" + @@ -3729,6 +3743,7 @@ + @@ -4356,10 +4371,12 @@ + + @@ -13551,6 +13568,12 @@ actually an xmlCharEncoding'/> + + Implement the XInclude substitution on the XML document @doc + + + + Implement the XInclude substitution for the given subtree reusing the informations and data coming from the given context. @@ -13562,6 +13585,18 @@ actually an xmlCharEncoding'/> + + Implement the XInclude substitution for the given subtree + + + + + + Set the flags used for further processing of XML resources. + + + + Implement the add operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function. diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml index 3169d24f..ef46d222 100644 --- a/doc/libxml2-refs.xml +++ b/doc/libxml2-refs.xml @@ -89,10 +89,12 @@ + + @@ -210,6 +212,7 @@ + @@ -866,10 +869,12 @@ + + @@ -2598,8 +2603,11 @@ + + + @@ -2933,10 +2941,12 @@ + + @@ -3054,6 +3064,7 @@ + @@ -3710,10 +3721,12 @@ + + @@ -5478,8 +5491,11 @@ + + + @@ -5929,6 +5945,7 @@ + @@ -5940,7 +5957,6 @@ - @@ -6008,8 +6024,8 @@ - + @@ -6017,13 +6033,13 @@ - + @@ -7873,6 +7889,7 @@ + @@ -8252,6 +8269,7 @@ + @@ -8902,6 +8920,7 @@ + @@ -10497,19 +10516,24 @@ + + - + - + + + + @@ -10743,7 +10767,7 @@ - + @@ -10824,11 +10848,11 @@ - + - + @@ -10916,7 +10940,7 @@ - + @@ -10966,6 +10990,7 @@ + @@ -11038,13 +11063,14 @@ - + + @@ -11074,6 +11100,7 @@ + @@ -15100,6 +15127,7 @@ + @@ -15774,11 +15802,15 @@ + + + + @@ -15906,6 +15938,7 @@ + @@ -18229,10 +18262,12 @@ + + @@ -18705,6 +18740,9 @@ + + + @@ -19320,8 +19358,10 @@ + + @@ -19527,6 +19567,7 @@ + @@ -19750,6 +19791,7 @@ + @@ -20161,6 +20203,7 @@ + @@ -20331,6 +20374,9 @@ + + + @@ -21711,6 +21757,7 @@ + @@ -22316,6 +22363,7 @@ + @@ -22932,33 +22980,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23790,6 +23811,7 @@ + @@ -24382,8 +24404,10 @@ + + @@ -24890,15 +24914,19 @@ + + + + @@ -24931,6 +24959,7 @@ + @@ -25963,8 +25992,10 @@ + + @@ -26129,6 +26160,7 @@ + @@ -27031,6 +27063,9 @@ + + + diff --git a/include/libxml/xinclude.h b/include/libxml/xinclude.h index 8c26e918..880a280b 100644 --- a/include/libxml/xinclude.h +++ b/include/libxml/xinclude.h @@ -2,8 +2,8 @@ * Summary: implementation of XInclude * Description: API to handle XInclude processing, * implements the - * World Wide Web Consortium Working Draft 26 October 2000 - * http://www.w3.org/TR/2000/WD-xinclude-20001026 + * 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. * @@ -89,13 +89,22 @@ typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; */ XMLPUBFUN int XMLCALL xmlXIncludeProcess (xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessFlags (xmlDocPtr doc, + int flags); 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 diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index 8a4fd7a6..46d93c41 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -465,6 +465,7 @@ typedef enum { 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 */ diff --git a/python/libxml2class.txt b/python/libxml2class.txt index 271dbebc..8eab9308 100644 --- a/python/libxml2class.txt +++ b/python/libxml2class.txt @@ -488,6 +488,7 @@ Class xmlNode(xmlCore) # functions from module xinclude xincludeProcessTree() + xincludeProcessTreeFlags() # functions from module xpath xpathCastNodeToNumber() @@ -616,6 +617,7 @@ Class xmlDoc(xmlNode) # functions from module xinclude xincludeProcess() + xincludeProcessFlags() # functions from module xmlreader NewWalker() diff --git a/result/XInclude/docids.xml.err b/result/XInclude/docids.xml.err new file mode 100644 index 00000000..e69de29b diff --git a/result/XInclude/fallback.xml.err b/result/XInclude/fallback.xml.err new file mode 100644 index 00000000..e69de29b diff --git a/result/XInclude/include.xml.err b/result/XInclude/include.xml.err new file mode 100644 index 00000000..e69de29b diff --git a/result/XInclude/nodes.xml.err b/result/XInclude/nodes.xml.err new file mode 100644 index 00000000..e69de29b diff --git a/result/XInclude/nodes2.xml b/result/XInclude/nodes2.xml new file mode 100644 index 00000000..a515a576 --- /dev/null +++ b/result/XInclude/nodes2.xml @@ -0,0 +1,9 @@ + + + + +

something

+

really

+

simple

+
+
diff --git a/result/XInclude/nodes2.xml.err b/result/XInclude/nodes2.xml.err new file mode 100644 index 00000000..e69de29b diff --git a/result/XInclude/nodes2.xml.rdr b/result/XInclude/nodes2.xml.rdr new file mode 100644 index 00000000..b4978c04 --- /dev/null +++ b/result/XInclude/nodes2.xml.rdr @@ -0,0 +1,28 @@ +0 1 x 0 0 +1 14 #text 0 1 + +1 8 #comment 0 1 Simple test of including a set of nodes from an XML document +1 14 #text 0 1 + +1 1 doc 0 0 +2 14 #text 0 1 + +2 1 p 0 0 +3 3 #text 0 1 something +2 15 p 0 0 +2 14 #text 0 1 + +2 1 p 0 0 +3 3 #text 0 1 really +2 15 p 0 0 +2 14 #text 0 1 + +2 1 p 0 0 +3 3 #text 0 1 simple +2 15 p 0 0 +2 14 #text 0 1 + +1 15 doc 0 0 +1 14 #text 0 1 + +0 15 x 0 0 diff --git a/result/XInclude/nodes3.xml b/result/XInclude/nodes3.xml new file mode 100644 index 00000000..9ab20448 --- /dev/null +++ b/result/XInclude/nodes3.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/result/XInclude/nodes3.xml.err b/result/XInclude/nodes3.xml.err new file mode 100644 index 00000000..fb115253 --- /dev/null +++ b/result/XInclude/nodes3.xml.err @@ -0,0 +1 @@ +./test/XInclude/docs/nodes3.xml:3: element include: XInclude error : Invalid fragment identifier in URI test/XInclude/ents/something.xml#xpointer(//p) use the xpointer attribute diff --git a/result/XInclude/nodes3.xml.rdr b/result/XInclude/nodes3.xml.rdr new file mode 100644 index 00000000..f2ae87b5 --- /dev/null +++ b/result/XInclude/nodes3.xml.rdr @@ -0,0 +1,10 @@ +0 1 x 0 0 +1 14 #text 0 1 + +1 8 #comment 0 1 Simple test of including a set of nodes from an XML document +1 14 #text 0 1 + +1 1 xinclude:include 1 0 +1 14 #text 0 1 + +0 15 x 0 0 diff --git a/result/XInclude/recursive.xml.err b/result/XInclude/recursive.xml.err new file mode 100644 index 00000000..e69de29b diff --git a/result/XInclude/tstencoding.xml.err b/result/XInclude/tstencoding.xml.err new file mode 100644 index 00000000..e69de29b diff --git a/result/XInclude/txtinclude.xml.err b/result/XInclude/txtinclude.xml.err new file mode 100644 index 00000000..e69de29b diff --git a/test/XInclude/docs/nodes2.xml b/test/XInclude/docs/nodes2.xml new file mode 100644 index 00000000..32f8cfe8 --- /dev/null +++ b/test/XInclude/docs/nodes2.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test/XInclude/docs/nodes3.xml b/test/XInclude/docs/nodes3.xml new file mode 100644 index 00000000..355c5488 --- /dev/null +++ b/test/XInclude/docs/nodes3.xml @@ -0,0 +1,4 @@ + + + + diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src index ab92f21c..705c2ba1 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -2315,11 +2315,20 @@ xmlXIncludeNewContext xmlXIncludeProcess #endif #ifdef LIBXML_XINCLUDE_ENABLED +xmlXIncludeProcessFlags +#endif +#ifdef LIBXML_XINCLUDE_ENABLED xmlXIncludeProcessNode #endif #ifdef LIBXML_XINCLUDE_ENABLED xmlXIncludeProcessTree #endif +#ifdef LIBXML_XINCLUDE_ENABLED +xmlXIncludeProcessTreeFlags +#endif +#ifdef LIBXML_XINCLUDE_ENABLED +xmlXIncludeSetFlags +#endif #ifdef LIBXML_XPATH_ENABLED xmlXPathAddValues #endif diff --git a/xinclude.c b/xinclude.c index d7dc1304..3bfbc728 100644 --- a/xinclude.c +++ b/xinclude.c @@ -1,8 +1,8 @@ /* * xinclude.c : Code to implement XInclude processing * - * World Wide Web Consortium W3C Last Call Working Draft 16 May 2001 - * http://www.w3.org/TR/2001/WD-xinclude-20010516/ + * World Wide Web Consortium W3C Last Call Working Draft 10 November 2003 + * http://www.w3.org/TR/2003/WD-xinclude-20031110 * * See Copyright for the status of this software. * @@ -79,6 +79,7 @@ struct _xmlXIncludeCtxt { int nbErrors; /* the number of errors detected */ int legacy; /* using XINCLUDE_OLD_NS */ + int parseFlags; /* the flags used for parsing XML documents */ }; static int @@ -404,17 +405,39 @@ xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) { * parse an document for XInclude */ static xmlDocPtr -xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt ATTRIBUTE_UNUSED, const char *URL) { +xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { xmlDocPtr ret; xmlParserCtxtPtr pctxt; char *directory = NULL; + xmlParserInputPtr inputStream; xmlInitParser(); - pctxt = xmlCreateFileParserCtxt(URL); + pctxt = xmlNewParserCtxt(); if (pctxt == NULL) { + xmlXIncludeErrMemory(ctxt, NULL, "cannot allocate parser context"); return(NULL); } + /* + * try to ensure that the new document included are actually + * built with the same dictionary as the including document. + */ + if ((ctxt->doc != NULL) && (ctxt->doc->dict != NULL) && + (pctxt->dict != NULL)) { + xmlDictFree(pctxt->dict); + pctxt->dict = ctxt->doc->dict; + xmlDictReference(pctxt->dict); + } + + xmlCtxtUseOptions(pctxt, ctxt->parseFlags | XML_PARSE_DTDLOAD); + + inputStream = xmlLoadExternalEntity(URL, NULL, pctxt); + if (inputStream == NULL) { + xmlFreeParserCtxt(pctxt); + return(NULL); + } + + inputPush(pctxt, inputStream); if ((pctxt->directory == NULL) && (directory == NULL)) directory = xmlParserGetDirectory(URL); @@ -432,6 +455,8 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt ATTRIBUTE_UNUSED, const char *URL) xmlFreeDoc(pctxt->myDoc); pctxt->myDoc = NULL; } + if ((pctxt->myDoc != NULL) && (pctxt->dict == pctxt->myDoc->dict)) + xmlDictReference(pctxt->dict); xmlFreeParserCtxt(pctxt); return(ret); @@ -529,6 +554,7 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { "failed build URL\n", NULL); return(-1); } + fragment = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE_XPOINTER); /* * Check the URL and remove any fragment identifier @@ -537,10 +563,29 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { if (uri == NULL) { xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_HREF_URI, "invalid value URI %s\n", URI); + if (fragment != NULL) + xmlFree(fragment); + xmlFree(URI); return(-1); } + if (uri->fragment != NULL) { - fragment = (xmlChar *) uri->fragment; + if (ctxt->legacy != 0) { + if (fragment == NULL) { + fragment = (xmlChar *) uri->fragment; + } else { + xmlFree(uri->fragment); + } + } else { + xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_FRAGMENT_ID, + "Invalid fragment identifier in URI %s use the xpointer attribute\n", + URI); + if (fragment != NULL) + xmlFree(fragment); + xmlFreeURI(uri); + xmlFree(URI); + return(-1); + } uri->fragment = NULL; } URL = xmlSaveUri(uri); @@ -1972,6 +2017,7 @@ xmlXIncludeTestNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) { xmlXIncludeWarn(ctxt, node, XML_XINCLUDE_DEPRECATED_NS, "Deprecated XInclude namespace found, use %s", XINCLUDE_NS); + ctxt->legacy = 1; } } if (xmlStrEqual(node->name, XINCLUDE_NODE)) { @@ -2105,8 +2151,26 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree) { } /** - * xmlXIncludeProcess: + * xmlXIncludeSetFlags: + * @ctxt: an XInclude processing context + * @flags: a set of xmlParserOption used for parsing XML includes + * + * Set the flags used for further processing of XML resources. + * + * Returns 0 in case of success and -1 in case of error. + */ +int +xmlXIncludeSetFlags(xmlXIncludeCtxtPtr ctxt, int flags) { + if (ctxt == NULL) + return(-1); + ctxt->parseFlags = flags; + return(0); +} + +/** + * xmlXIncludeProcessFlags: * @doc: an XML document + * @flags: a set of xmlParserOption used for parsing XML includes * * Implement the XInclude substitution on the XML document @doc * @@ -2114,7 +2178,7 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree) { * or the number of substitutions done. */ int -xmlXIncludeProcess(xmlDocPtr doc) { +xmlXIncludeProcessFlags(xmlDocPtr doc, int flags) { xmlXIncludeCtxtPtr ctxt; xmlNodePtr tree; int ret = 0; @@ -2127,6 +2191,7 @@ xmlXIncludeProcess(xmlDocPtr doc) { ctxt = xmlXIncludeNewContext(doc); if (ctxt == NULL) return(-1); + xmlXIncludeSetFlags(ctxt, flags); ret = xmlXIncludeDoProcess(ctxt, doc, tree); if ((ret >= 0) && (ctxt->nbErrors > 0)) ret = -1; @@ -2135,6 +2200,49 @@ xmlXIncludeProcess(xmlDocPtr doc) { return(ret); } +/** + * xmlXIncludeProcess: + * @doc: an XML document + * + * Implement the XInclude substitution on the XML document @doc + * + * Returns 0 if no substitution were done, -1 if some processing failed + * or the number of substitutions done. + */ +int +xmlXIncludeProcess(xmlDocPtr doc) { + return(xmlXIncludeProcessFlags(doc, 0)); +} + +/** + * xmlXIncludeProcessTreeFlags: + * @tree: a node in an XML document + * @flags: a set of xmlParserOption used for parsing XML includes + * + * Implement the XInclude substitution for the given subtree + * + * Returns 0 if no substitution were done, -1 if some processing failed + * or the number of substitutions done. + */ +int +xmlXIncludeProcessTreeFlags(xmlNodePtr tree, int flags) { + xmlXIncludeCtxtPtr ctxt; + int ret = 0; + + if ((tree == NULL) || (tree->doc == NULL)) + return(-1); + ctxt = xmlXIncludeNewContext(tree->doc); + if (ctxt == NULL) + return(-1); + xmlXIncludeSetFlags(ctxt, flags); + ret = xmlXIncludeDoProcess(ctxt, tree->doc, tree); + if ((ret >= 0) && (ctxt->nbErrors > 0)) + ret = -1; + + xmlXIncludeFreeContext(ctxt); + return(ret); +} + /** * xmlXIncludeProcessTree: * @tree: a node in an XML document @@ -2146,20 +2254,7 @@ xmlXIncludeProcess(xmlDocPtr doc) { */ int xmlXIncludeProcessTree(xmlNodePtr tree) { - xmlXIncludeCtxtPtr ctxt; - int ret = 0; - - if ((tree == NULL) || (tree->doc == NULL)) - return(-1); - ctxt = xmlXIncludeNewContext(tree->doc); - if (ctxt == NULL) - return(-1); - ret = xmlXIncludeDoProcess(ctxt, tree->doc, tree); - if ((ret >= 0) && (ctxt->nbErrors > 0)) - ret = -1; - - xmlXIncludeFreeContext(ctxt); - return(ret); + return(xmlXIncludeProcessTreeFlags(tree, 0)); } /** diff --git a/xmllint.c b/xmllint.c index 37dc72e7..106c3620 100644 --- a/xmllint.c +++ b/xmllint.c @@ -1007,7 +1007,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { if ((timing) && (!repeat)) { startTimer(); } - xmlXIncludeProcess(doc); + xmlXIncludeProcessFlags(doc, options); if ((timing) && (!repeat)) { endTimer("Xinclude processing"); } diff --git a/xmlreader.c b/xmlreader.c index bbba459f..485859e6 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -156,6 +156,7 @@ struct _xmlTextReader { xmlPatternPtr *patternTab; /* array of preserve patterns */ #endif int preserves; /* level of preserves */ + int parserFlags; /* the set of options set */ }; #define NODE_IS_EMPTY 0x1 @@ -1368,6 +1369,7 @@ node_found: (xmlStrEqual(reader->node->ns->href, XINCLUDE_OLD_NS)))) { if (reader->xincctxt == NULL) { reader->xincctxt = xmlXIncludeNewContext(reader->ctxt->myDoc); + xmlXIncludeSetFlags(reader->xincctxt, reader->parserFlags); } /* * expand that node and process it @@ -4032,6 +4034,7 @@ xmlTextReaderSetup(xmlTextReaderPtr reader, reader->doc = NULL; reader->entNr = 0; + reader->parserFlags = options; reader->validate = XML_TEXTREADER_NOT_VALIDATE; if ((input != NULL) && (reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT)) {