comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: generating an XML file using Ada code
Date: Sat, 25 Jun 2016 08:11:50 +0100
Date: 2016-06-25T08:11:50+01:00	[thread overview]
Message-ID: <lymvm991zd.fsf@pushface.org> (raw)
In-Reply-To: 139d39ee-c198-4a63-a5c6-9cb265820edb@googlegroups.com

Stephen Leake <stephen_leake@stephe-leake.org> 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


  parent reply	other threads:[~2016-06-25  7:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 14:44 generating an XML file using Ada code Stephen Leake
2016-06-25  5:32 ` Niklas Holsti
2016-06-25  7:11 ` Simon Wright [this message]
2016-06-25 14:14 ` Georg Bauhaus
2016-06-26 14:15 ` Vadim Godunko
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox