Menu

#1872 XML: entity references in child documents break tree parsing and xref linkend= navigation

None
closed-fixed
nobody
None
5
2017-03-04
2017-02-05
Alan Ezust
No

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.

Discussion

  • Alan Ezust

    Alan Ezust - 2017-02-05

    $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.

     
  • Alan Ezust

    Alan Ezust - 2017-02-05
    • summary: XML xrefs to DTD parsed entities break tree parsing and other things --> XML: entity references break tree parsing and xref linkend= navigation
    • Group: -->
     
  • Alan Ezust

    Alan Ezust - 2017-02-05
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,2 +1,3 @@
    -if you have a multiple file XML document linked together via &parsed; &entities; and an xref linkend= from one file to the id in another, XML plugin fails to show a tree and also linkend= fails to work with hyperlinks. 
    -I will add a nice test case to the plugin source shortly.
    +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. 
    +
    
     
  • Eric Le Lay

    Eric Le Lay - 2017-02-13

    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.

     
    • Alan Ezust

      Alan Ezust - 2017-02-13

      If it can't cache the derefenced value, then at least it should show the &entity; in the tree.

       
      • Eric Le Lay

        Eric Le Lay - 2017-02-14

        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.

         
        • Alan Ezust

          Alan Ezust - 2017-02-21

          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?

           
          • Eric Le Lay

            Eric Le Lay - 2017-02-21

            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

             
            • Alan Ezust

              Alan Ezust - 2017-02-24

              I thought the whole DTD from the xml.root was already somehow available - afterall how could completion work otherwise?

               
  • Eric Le Lay

    Eric Le Lay - 2017-02-13

    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?

     
    • Alan Ezust

      Alan Ezust - 2017-02-13

      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.

       
      • Eric Le Lay

        Eric Le Lay - 2017-02-14

        trademark nodes are in the tree while there is &trademark; in the file. This is what I call phantom nodes.

         
  • Eric Le Lay

    Eric Le Lay - 2017-02-13

    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).

     
    • Alan Ezust

      Alan Ezust - 2017-02-13

      I think you are talking about a different example since I"m not using xinclude in this one.

       
      • Eric Le Lay

        Eric Le Lay - 2017-02-14

        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.

         
        • Alan Ezust

          Alan Ezust - 2017-02-15

          If you use xinclude, you can't use entity references at all from child documents.

           
  • Alan Ezust

    Alan Ezust - 2017-02-15
    • summary: XML: entity references break tree parsing and xref linkend= navigation --> XML: entity references in child documents break tree parsing and xref linkend= navigation
     
  • Eric Le Lay

    Eric Le Lay - 2017-02-25

    fixed in [r24615]

     

    Related

    Commit: [r24615]

  • Alan Ezust

    Alan Ezust - 2017-02-26

    Thank you so much for fixing this!

     
  • Eric Le Lay

    Eric Le Lay - 2017-03-04
    • status: open --> closed-fixed
     
  • Eric Le Lay

    Eric Le Lay - 2017-03-04

    will be in XML 3.0.6

     

Log in to post a comment.