if you have a multiple file XML document linked together via &system; &entities; and an xref linkend= from one file to the id in another, and then there is also an &entity; &reference; before the xref, then XML plugin fails to show a tree, completion based on DTD is broken, and also linkend= navigation fails to work with hyperlinks.
A test case has been added that demonstrates the problem, with 1 file that has navigation working and another that does not.
$xml/test_data/dtd_with_xref> Adding dtd_with_xref
Adding dtd_with_xref/book_refguide.docbook
Adding dtd_with_xref/book_tutorials.docbook
Adding dtd_with_xref/index.docbook
Transmitting file data ...done
Committing transaction...
Committed revision 24601.
Diff:
XML plugin parses once starting from the root buffer (book_index.docbook) and once starting from current buffer (book_refguide.docbook). The second parsing is to construct the Sidekick tree.
During the first parsing, it has the DTD, so &java; can be dereferenced.
During the second pass, it doesn't have the DTD so &java; can't be dereferenced. This causes a SAXParseException (which is silently dropped) and prevents completion of the 2nd parsing, resulting in a single <para> in the tree.
Adding the DTD in book_refguide.docbook is not allowed (try it!). I'm currently investingating xinclude+nonvalidating dtd.
If it can't cache the derefenced value, then at least it should show the &entity; in the tree.
Sorry for the confusion: it's not a problem at the tree level: xerces simply can't parse book_refguide.docbook independently: the xml file is invalid since it references an undeclared entity.
If one adds the DOCTYPE in book_refguide.docbook then it can't be included via DTD entity in book_index.docbook.
What if we somehow preprocess the buffer before it is parsed by xerces so that xerces doesn't see entity references that need to be resolved but just the "&entity;" as a string, then at least they wouldn't break the sidekick tree and hyperlink navigation anymore?
Maybe. I'm also investingating what happens during parsing by Xerces of defined and undefined entitiees and there may be a way to "reuse" entities from the top document when parsing book_refguide.docbook
I thought the whole DTD from the xml.root was already somehow available - afterall how could completion work otherwise?
Also in your example, you get "phantom" trademark nodes in the sidekick tree whenever you reference the java entity. Isn't it a problem for you?
I noticed something about it, yeah. Needless to say, it would be nicer to see either the <trademark> node in the tree, or else the entity name. Phantoms suck.
trademark nodes are in the tree while there is &trademark; in the file. This is what I call phantom nodes.
I don't see how to make xml:lang validate using docbook dtd. It's a problem because DTD validation can't be easily disabled in xincluded xmls (see https://xerces.apache.org/xerces2-j/faq-xinclude.html#faq-2).
I think you are talking about a different example since I"m not using xinclude in this one.
DTD inclusion is not working with entity references in book_refguide.docbook so I'm seeking alternatives. I'm investigating achieving the same kind of inclusion using xinclude now.
If you use xinclude, you can't use entity references at all from child documents.
fixed in [r24615]
Related
Commit: [r24615]
Thank you so much for fixing this!
will be in XML 3.0.6