Re: [xml] performance of parsing docbook with xincludes



On 05/17/2018 04:18 PM, Nick Wellnhofer wrote:
On 16/05/2018 21:51, Stefan Sauer wrote:
So one solution could be another flag to enable this?

Yes, but it would be rather ugly.

Thanks, reading the code. Need to figure where we could cache external
subsets and what a suitable keys is (ExternalID ?).

Note that I'm currently not planning to review and integrate larger
patches from other developers. I only took over some libxml2
maintenance duties because noone else did. So even if you write a
high-quality patch, it might never get merged.

Caching external subsets for XIncludes certainly sounds like a nice
feature but I would prefer to find a simpler solution. For example,
can't you just omit the external DTD from included documents?
I've tried this and I get some interesting differences. If I modify my
DOCTYPES declarations from e.g.:
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd";
[
  <!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED
'http://www.w3.org/2003/XInclude'">
  <!ENTITY % gtkdocentities SYSTEM "../xml/gtkdocentities.ent">
  %gtkdocentities;
]>

to

<!DOCTYPE refentry [
  <!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED
'http://www.w3.org/2003/XInclude'">
  <!ENTITY % gtkdocentities SYSTEM "../xml/gtkdocentities.ent">
  %gtkdocentities;
]>

and run (for each of the variants)
xmllint --noent --xinclude tester-docs.xml >tester-docs.nodtd.xml
then I get a lot of delta in this form:
-    <indexdiv xmlns:xi="http://www.w3.org/2003/XInclude";
id="api-index-0.1" xml:base="xml/api-index-0.1.xml">
+    <indexdiv id="api-index-0.1" xml:base="xml/api-index-0.1.xml">

basically if there is no DTD on the doctype, the resulting xi:include
nodes won't have the xmlns:xi attribute.

What is worse and puzzling me that it causes a small difference on the
html output produced my xsltproc:
-<a class="link" href="tester-GtkDocTestIf.html#FOO:CAPS"
title="FOO">FOO</a>, macro in <a class="link"
href="tester-GtkDocTestIf.html" title="GtkDocTestIf">GtkDocTestIf</a>
+<a href="tester-GtkDocTestIf.html#FOO:CAPS">FOO</a>, macro in GtkDocTestIf

if I drop the dtd, the first link misses 'class' and 'title' attributes
and the 2nd link is not linked at all.

Stefan

You wrote:

and gtk-doc will replicate this for the fragments (replacing 'book' with
e.g. 'refentry'). This way one can e.g. inject things like a version.

What do you mean by "inject things like a version"? Why exactly do
your included documents have to reference an external DTD?

Another idea is to stop loading external DTDs for XIncludes without an
XPointer expression. This would still change the behavior for some
users but it's much less likely to cause problems.

Nick





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]