Docbook Compare Crashes when using Xinclude+xpointer
| Poster | Content |
|---|---|
nk4um User Posts: 2 | Hi Nigel, thank you for your quick response! Meanwhile we have reengineered the structure of our documents so that we can use DeltaXML without xpointer. Thank you for your hint about xmllint, that was new to us! We use Docbook5, Saxon and Antenna House Formatter. The xpointer syntax we use is very simple: <xi:include href="document.xml" xpointer="xml:id of element in target file"> We use pointers to xml:id's. We tried using the XPointer element() scheme, but that didn't work either. I hope this helps. Best regards, Oliver |
nk4um Administrator Posts: 129 | Hi Oliver, A quick update - It looks like Bob Stayton comes to a similar finding on xpointer() scheme support: http://www.sagehill.net/docbookxsl/ModularDoc.html#xpointerScheme It would be very useful to see your exact XInclude element and attributes. Thanks, Nigel |
nk4um Administrator Posts: 129 | Hello Oliver, Thanks for reporting this - we very much appreciate this useful feedback. We have spent some time today investigating the issue and here is a quick summary: We should be able to improve the diagnostics. Some parts of Xpointer are supported, others are not (currently); I'll explain the technicallities of what is or isn't supported and the issues involved in doing so below. There are some interim work-around suggestions too. It's also worth asking at this point for any other customers or potential users who would like XPointer support to 'raise their hands' so we can assess the importance of this feature. Firstly the diagnostics. I expect you saw a "Problem loading the A (or B) input file" exception, with a nested cause further down the exception stack of a SAXParseException saying: "An 'include' failed, and no 'fallback' element was found." We've reviewed our code and discovered that we were loosing some parse warnings which would give a possibly more helpful message such as: "SchemeUnsupported: The XPointer scheme 'xpointer' is not supported." I'm not too sure of your exact Xinclude syntax when you say: "using an xpointer attribute to point to a specific element within document B, identified by an xml:id." - as there are several ways or 'schemes' of doing this. Similarly, I'm not sure of your XPointer knowledge, but just in case and for other, future readers of the forum here is a good overview tutorial: http://commons.oreilly.com/wiki/index.php/XPath_and_XPointer/XPointer_Syntax The DocBook comparator uses Apache Xerces-J to initially parse its inputs. This parser does support the XPointer element() scheme, but not the xpointer() scheme. For certain DocBook use cases, it may work, for example for DocBook v4 files using the DocBook DTD and element with id="foo" could be included with: <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="B.xml" xpointer="element(foo)" /> This works because the element() scheme has a DTD specifying that the id attribute is of type 'ID'. DocBook v5 files are unfortunately less likely to use a DTD. For Xerces-J documentation please see: "What types of IDs are currently supported for XPointers?" at http://xerces.apache.org/xerces2-j/faq-xinclude.html#faq-9 The FAQ answer immediately above, covering XPointer scheme support, http://xerces.apache.org/xerces2-j/faq-xinclude.html#faq-8 also means that alternative xpointer based approaches, such as the one below are also not possible: <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="B.xml" xpointer="xpointer(id('foo'))" /> We've had a look at alternative ways of doing this and cannot easily find something compatible with our Java/XSLT based code. Perhaps the lack of xpointer() scheme support is because it did not make it from a W3C 'Working Draft' standard to a 'Recommendation': http://www.w3.org/TR/xptr-xpointer/ The only support for these XPointer schemes we've found is that in the platform specific (C compiled executable) binaries for xmllint/xsltproc. These are typically available on MacOSX/Linux/Solaris systems, or at: http://xmlsoft.org/ The compiled-binary nature of this code makes it hard to integrate and support with our Java code. While we are looking for alternative parsers and also XSLT based solutions, could we suggest you consider using a tool like xmllint is an XInclude pre-processor for your files, before comparison? For example: xmllint --xincludes file1.xml > file1-xi.xml xmllint --xincludes file2.xml > file2-xi.xml java -jar deltaxml-docbook.jar compare file1-xi.xml file2-xi.xml file12.xml It would be useful to know what other software you are using for processing your DocBook files to see if there is anything we can learn from its approach to XPointer. To conclude, we have two short-term actions:
Can we suggest you consider the pre-processing work-around suggested above? If you need further help, we could make further suggestions if you can describe your operating system and other software. We will also keep looking at Xpointer implementation techniques and would also value feedback requests for this feature from other users. Many thanks, Nigel |
nk4um User Posts: 2 | We are using docbook compare to compare two version of a document A. The document A uses Xinclude to partially include another document B, using an xpointer attribute to point to a specific element within document B, identified by an xml:id. docbook compare crashes, claiming that an include failed. Everything works fine if we omit the xpointer attribute. Is there anything we can do about this, other than rebuilding our document structure? |
