lmi
[Top][All Lists]
Advanced

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

[lmi] Ledger::write() -- adding DOCTYPE support to xmlwrapp?


From: Vaclav Slavik
Subject: [lmi] Ledger::write() -- adding DOCTYPE support to xmlwrapp?
Date: Wed, 10 Dec 2008 23:36:11 +0100

Hi,

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:

        void Ledger::write(std::ostream& os) const
        {
            xml_lmi::xml_document document(xml_root_name());
            xml::element& root = document.root_node();
        
            root << *this;
        // Need DOCTYPE support, which xmlwrapp lacks--so can't do this:
        //    os << root;
        
            std::string s = document.str();
            std::string token("<?xml version=\"1.0\"?>");
            std::string string_to_insert
                ("\n<!DOCTYPE sales [\n]>\n"
                "<?xml-stylesheet type=\"text/xsl\" href=\"NewTransform.xsl\"?>"
                );
            s.insert
                (s.find(token) + token.length()
                ,string_to_insert
                );
            os << s;
        }
        
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?

Thanks,
Vaclav





reply via email to

[Prev in Thread] Current Thread [Next in Thread]