[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Ledger::write() -- adding DOCTYPE support to xmlwrapp?
From: |
Greg Chicares |
Subject: |
Re: [lmi] Ledger::write() -- adding DOCTYPE support to xmlwrapp? |
Date: |
Fri, 12 Dec 2008 02:11:54 +0000 |
User-agent: |
Thunderbird 2.0.0.18 (Windows/20081105) |
On 2008-12-10 22:36Z, Vaclav Slavik wrote:
>
> the new XSLT code will depend on not-yet-released xmlwrapp 0.6.0 and so
> this would be a good time to put more API-changing enhancements into
> xmlwrapp. In particular, this code from ledger_xml_io.cpp attracted my
> attention:
[...aggresively snipped...]
> // Need DOCTYPE support, which xmlwrapp lacks
[...]
> The important part is the comment, of course. It would be nicer to write
>
> document.set_internal_subset("sales", ...);
> document.add_processing_instruction("xml-stylesheet", ...);
>
> instead, but neither is implemented in xmlwrapp. Would this (while I'm
> working with this code and have to make an xmlwrapp release anyway) be a
> good time to add support for DTDs and PIs, or is this snippet too
> unimportant an ugliness to be worth it?
First of all: if you personally feel that this should be done,
on its own merits, just because it makes xmlwrapp a better
library, then you're welcome to implement it and disregard the
rest of this message.
That said, I question whether that comment is valid today. A
unit test can be found in the attic:
http://cvs.savannah.gnu.org/viewvc/lmi/lmi/ledger_test.cpp?hideattic=0&r1=1.13&r2=1.14
There's no need to drag that out of the attic and build it,
because I saved a copy of the results of lines 92-101, which
compare two methods of writing an xml file that's subsequently
transformed to xsl-fo and then to pdf. The two methods produce
xml that's identical except for this single difference:
--- eraseme_xsl/sample.xml 2008-11-14 05:03:41.600392000 +0000
+++ eraseme_cxx/sample.xml 2008-11-14 05:03:41.037866800 +0000
@@ -1,3 +1,6 @@
<?xml version="1.0"?>
-<illustration
noNamespaceSchemaLocation="http://savannah.nongnu.org/projects/lmi ledger.xsd">
+<!DOCTYPE sales [
+]>
+<?xml-stylesheet type="text/xsl" href="NewTransform.xsl"?>
+<illustration>
<scalar>
But the xsl-fo files generated from these two different xml
files is identical.
'eraseme_xsl/sample.xml' is what we had used in production,
approximately in [20070614T1810Z, 20081114T0506Z), and it has
no DOCTYPE. That strongly suggests that no DOCTYPE is needed.
In ancient times--say, 2005--we were using apache 'xalan'
for the xsl transformation instead of libxslt; perhaps a
DOCTYPE declaration really was needed then. Anyway, I've
removed it from the repository so that testing can prove it's
unnecessary.