From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: generating an XML file using Ada code Date: Sat, 25 Jun 2016 08:11:50 +0100 Organization: A noiseless patient Spider Message-ID: References: <139d39ee-c198-4a63-a5c6-9cb265820edb@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="15bacc9237911e76a94be23536470c55"; logging-data="11189"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18x7RhkvFuKd8GFThe8H4LCEkZSCFr3xvU=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:kHubLrDXnG2RcbUsRSXsMCFtyo8= sha1:4dl2muGglt+IEbgZMUVtkRIePlU= Xref: news.eternal-september.org comp.lang.ada:30921 Date: 2016-06-25T08:11:50+01:00 List-Id: Stephen Leake writes: > How can I create an XML file? In ASIS2XML[1] I say DOM.Core.Nodes.Print (Doc, Print_Comments => True, Print_XML_PI => True, EOL_Sequence => ""); This produces a single very long line of XML; tidy will make a readable version. Looking at DOM.Core.Nodes.Print, procedure Print (N : Node; Print_Comments : Boolean := False; Print_XML_PI : Boolean := False; With_URI : Boolean := False; EOL_Sequence : String := Sax.Encodings.Lf_Sequence; Encoding : Unicode.Encodings.Unicode_Encoding := Unicode.Encodings.Get_By_Name ("utf-8"); Collapse_Empty_Nodes : Boolean := False); -- For debugging purposes only! -- -- Same as Write, but the output is done on Stdout. -- Warning: the default values for the parameters are not the same as for -- write. For the latter, they are chosen so that by default the output is -- valid XML, whereas Print is mostly intended to be used for testsuite -- purposes, and the default match that goal. I see I should have used DOM.Core.Nodes.Write! Another example of scratch development code making it into production. [1] https://sourceforge.net/p/asis2xml/code/ci/default/tree/asis2xml.adb