* XMLAda dom document to string
@ 2005-04-13 6:14 Björn Lundin
2005-04-13 7:03 ` Alex R. Mosteo
2005-04-13 7:37 ` Martin Dowie
0 siblings, 2 replies; 9+ messages in thread
From: Björn Lundin @ 2005-04-13 6:14 UTC (permalink / raw)
To: comp.lang.ada
Hello!
Is there a way of converting a dom document from
XML/Ada (1.0) to a string?
I found a Print in DOM.Core.Nodes that prints out a document to std out.
That is actually what I want, but to a string instead, that I can put
through a socket later on.
I'm sure I've missed something obvious, but I can't see through it.
I've also found on a wiki, a way of walking the nodes in a document.,
by David Button,
I've been thinking of using it, as a template for a new
procedure/function that does what I want,
but I thought I'd ask here first, before I invent the wheel again.
/Björn
Björn Lundin
bnl at spray dot se
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: XMLAda dom document to string
2005-04-13 6:14 XMLAda dom document to string Björn Lundin
@ 2005-04-13 7:03 ` Alex R. Mosteo
2005-04-13 17:03 ` Björn Lundin
2005-04-13 18:50 ` Björn Lundin
2005-04-13 7:37 ` Martin Dowie
1 sibling, 2 replies; 9+ messages in thread
From: Alex R. Mosteo @ 2005-04-13 7:03 UTC (permalink / raw)
Bj�rn Lundin wrote:
> Hello!
>
> Is there a way of converting a dom document from
> XML/Ada (1.0) to a string?
>
> I found a Print in DOM.Core.Nodes that prints out a document to std out.
> That is actually what I want, but to a string instead, that I can put
> through a socket later on.
>
> I'm sure I've missed something obvious, but I can't see through it.
>
> I've also found on a wiki, a way of walking the nodes in a document., by
> David Button,
> I've been thinking of using it, as a template for a new
> procedure/function that does what I want,
> but I thought I'd ask here first, before I invent the wheel again.
AFAIK, this is not present in that release of XML/Ada. I modified the
Print function to get a string. You can look at it at
http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-output.ads
http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-output.adb
but be warned that it performs some pretty printing and by that reason
Windows-style new lines are embedded in the resulting string.
You may want then to use a shrinking function or simply remove the
tidying code. (I have mine at:)
http://deepsix.homeip.net/svn/Adagio%20head/src/storage/adagio-xml.ads
Look for the Compress function.
I'm sure I've talked about this with other people in some mailing list,
so no doubt there are alternate solutions out there. It's possible that
CVS XML/Ada has it already.
Kind regards,
A. Mosteo.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: XMLAda dom document to string
2005-04-13 6:14 XMLAda dom document to string Björn Lundin
2005-04-13 7:03 ` Alex R. Mosteo
@ 2005-04-13 7:37 ` Martin Dowie
2005-04-13 17:08 ` Björn Lundin
1 sibling, 1 reply; 9+ messages in thread
From: Martin Dowie @ 2005-04-13 7:37 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 433 bytes --]
Bj�rn Lundin wrote:
> Is there a way of converting a dom document from
> XML/Ada (1.0) to a string?
>
> I found a Print in DOM.Core.Nodes that prints out a document to std
> out. That is actually what I want, but to a string instead, that I
> can put through a socket later on.
You could set the standard output to be a file that you read in later.
see Ada.Text_IO.Set_Output
Bit clunky but should work.
Cheers
-- Martin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: XMLAda dom document to string
2005-04-13 7:03 ` Alex R. Mosteo
@ 2005-04-13 17:03 ` Björn Lundin
2005-04-14 7:26 ` Alex R. Mosteo
2005-04-13 18:50 ` Björn Lundin
1 sibling, 1 reply; 9+ messages in thread
From: Björn Lundin @ 2005-04-13 17:03 UTC (permalink / raw)
To: Alex R. Mosteo; +Cc: comp.lang.ada
2005-04-13 kl. 09.03 skrev Alex R. Mosteo:
> Björn Lundin wrote:
>> Hello!
>> Is there a way of converting a dom document from
>> XML/Ada (1.0) to a string?
>> I found a Print in DOM.Core.Nodes that prints out a document to std
>> out.
>> That is actually what I want, but to a string instead, that I can put
>> through a socket later on.
>> I'm sure I've missed something obvious, but I can't see through it.
>> I've also found on a wiki, a way of walking the nodes in a document.,
>> by David Button,
>> I've been thinking of using it, as a template for a new
>> procedure/function that does what I want,
>> but I thought I'd ask here first, before I invent the wheel again.
>
> AFAIK, this is not present in that release of XML/Ada. I modified the
> Print function to get a string. You can look at it at
>
> http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-
> output.ads
> http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-
> output.adb
Great, just what I was after :)
Curiosity : what are you escaping?
Agpl.Xml.Escape is found in the body,
which I removed.
> but be warned that it performs some pretty printing and by that reason
> Windows-style new lines are embedded in the resulting string.
I can live with that.
> I'm sure I've talked about this with other people in some mailing
> list, so no doubt there are alternate solutions out there. It's
> possible that CVS XML/Ada has it already.
No, not a week ago anyway. I did download it then, but did not find
anything helpfull at all.
However I think this qualify for inclusion, except for the with'ed agpl
package
Thanks a lot
/Björn
Björn Lundin
bnl at spray dot se
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: XMLAda dom document to string
2005-04-13 7:37 ` Martin Dowie
@ 2005-04-13 17:08 ` Björn Lundin
0 siblings, 0 replies; 9+ messages in thread
From: Björn Lundin @ 2005-04-13 17:08 UTC (permalink / raw)
To: Martin Dowie; +Cc: comp.lang.ada
2005-04-13 kl. 09.37 skrev Martin Dowie:
> Björn Lundin wrote:
>> Is there a way of converting a dom document from
>> XML/Ada (1.0) to a string?
>>
>> I found a Print in DOM.Core.Nodes that prints out a document to std
>> out. That is actually what I want, but to a string instead, that I
>> can put through a socket later on.
>
> You could set the standard output to be a file that you read in later.
>
> see Ada.Text_IO.Set_Output
>
> Bit clunky but should work.
I did think of it, but naah, as you say, too clumpsy.
In my case I would receive a rpc request, and then
create a dom-document for an answer, save it to a file, read that file
again,
and put it back on the socket. I can't defend that to my colleagues.
But thanks for the input.
Mr Mosteo solved it for me
/Björn
> Cheers
>
> -- Martin
>
>
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada-france.org
> http://www.ada-france.org/mailman/listinfo/comp.lang.ada
>
>
>
Björn Lundin
bnl at spray dot se
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: XMLAda dom document to string
2005-04-13 7:03 ` Alex R. Mosteo
2005-04-13 17:03 ` Björn Lundin
@ 2005-04-13 18:50 ` Björn Lundin
1 sibling, 0 replies; 9+ messages in thread
From: Björn Lundin @ 2005-04-13 18:50 UTC (permalink / raw)
To: Alex R. Mosteo; +Cc: comp.lang.ada
[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]
2005-04-13 kl. 09.03 skrev Alex R. Mosteo:
>
> AFAIK, this is not present in that release of XML/Ada. I modified the
> Print function to get a string. You can look at it at
>
> http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-
> output.ads
> http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-
> output.adb
Having a closer look at it, it's licensed under the GPL license. Is
there
any chance you could licence it under Gnat GPL? ie add these line to
the header?
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
Björn Lundin
bnl at spray dot se
[-- Attachment #2: Type: text/enriched, Size: 1320 bytes --]
2005-04-13 kl. 09.03 skrev Alex R. Mosteo:
<excerpt>
AFAIK, this is not present in that release of XML/Ada. I modified the
Print function to get a string. You can look at it at
http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-output.ads
http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-output.adb
</excerpt>
Having a closer look at it, it's licensed under the GPL license. Is
there
any chance you could licence it under Gnat GPL? ie add these line to
the header?
<fixed><color><param>2323,6E6E,2525</param>-- As a special exception,
if other files instantiate generics from --</color>
<color><param>2323,6E6E,2525</param>-- this unit, or you link this
unit with other files to produce an --</color>
<color><param>2323,6E6E,2525</param>-- executable, this unit does
not by itself cause the resulting --</color>
<color><param>2323,6E6E,2525</param>-- executable to be covered by the
GNU General Public License. This --</color>
<color><param>2323,6E6E,2525</param>-- exception does not however
invalidate any other reasons why the --</color>
<color><param>2323,6E6E,2525</param>-- executable file might be
covered by the GNU Public License. --</color>
</fixed>
Björn Lundin
bnl at spray dot se
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: XMLAda dom document to string
2005-04-13 17:03 ` Björn Lundin
@ 2005-04-14 7:26 ` Alex R. Mosteo
2005-04-14 15:35 ` Björn Lundin
0 siblings, 1 reply; 9+ messages in thread
From: Alex R. Mosteo @ 2005-04-14 7:26 UTC (permalink / raw)
Bj�rn Lundin wrote:
>
> 2005-04-13 kl. 09.03 skrev Alex R. Mosteo:
>
>> Bj�rn Lundin wrote:
>>
>>> Hello! Is there a way of converting a dom document from XML/Ada
>>> (1.0) to a string? I found a Print in DOM.Core.Nodes that prints
>>> out a document to std out. That is actually what I want, but to a
>>> string instead, that I can put through a socket later on. I'm
>>> sure I've missed something obvious, but I can't see through it.
>>> I've also found on a wiki, a way of walking the nodes in a
>>> document., by David Button, I've been thinking of using it, as a
>>> template for a new procedure/function that does what I want, but
>>> I thought I'd ask here first, before I invent the wheel again.
>>
>>
>> AFAIK, this is not present in that release of XML/Ada. I modified
>> the Print function to get a string. You can look at it at
>>
>> http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-
>> output.ads
>> http://deepsix.homeip.net/svn/Adagio%20head/src/agpl/dom-core-nodes-
>> output.adb
>
>
> Great, just what I was after :)
>
> Curiosity : what are you escaping? Agpl.Xml.Escape is found in the
> body, which I removed.
All the code is at http://deepsix.homeip.net/svn/
------------
-- Escape --
------------
-- Takes a Latin1 string and encodes all invalid characters as &, <, etc.
Not sure if that function is in fact 100% right for XML syntax. It
changes an attribute name (not value!) like "avi�n" into "avión"
and the like.
About the license, it may be indeed that it must be GMGPL because
XML/Ada is. I copied/pasted the license block in the rest of my original
code, but here we're talking about a modification of XML/Ada so I
presume I must maintain the original license (which I'm not interested
in modifying, I simply didn't thought of it until now).
I presume that any modification introduced in the GPL such as the GMGPL
is propagated? I mean, Could someone provide a more restrictive license
for a derivative work?
In any case I will reflect this change in the file license ASAP.
>> but be warned that it performs some pretty printing and by that
>> reason Windows-style new lines are embedded in the resulting
>> string.
>
>
> I can live with that.
There are too some chunks of whitespace for tabulating. That can add
quite some size. You may want to remove that too if the XML generated is
never for human consumption.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: XMLAda dom document to string
2005-04-14 7:26 ` Alex R. Mosteo
@ 2005-04-14 15:35 ` Björn Lundin
2005-04-15 9:32 ` Alex R. Mosteo
0 siblings, 1 reply; 9+ messages in thread
From: Björn Lundin @ 2005-04-14 15:35 UTC (permalink / raw)
To: Alex R. Mosteo; +Cc: comp.lang.ada
[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]
2005-04-14 kl. 09.26 skrev Alex R. Mosteo:
>
> About the license, it may be indeed that it must be GMGPL because
> XML/Ada is. I copied/pasted the license block in the rest of my
> original
> code, but here we're talking about a modification of XML/Ada so I
> presume I must maintain the original license (which I'm not interested
> in modifying, I simply didn't thought of it until now).
>
> I presume that any modification introduced in the GPL such as the GMGPL
> is propagated? I mean, Could someone provide a more restrictive license
> for a derivative work?
>
> In any case I will reflect this change in the file license ASAP.
I looked at your cvs-site, but did not find it.
However, I then presume it is ok if I paste in the GMGPL into
Dom.Core.Nodes.Output ?
>>> but be warned that it performs some pretty printing and by that
>>> reason Windows-style new lines are embedded in the resulting
>>> string.
>> I can live with that.
>
> There are too some chunks of whitespace for tabulating. That can add
> quite some size. You may want to remove that too if the XML generated
> is
> never for human consumption.
>
Well, it's not intended for humans, but it's fairly small documents
(less than 5 k)
so i'll keep it ,since it makes it easier to debug
/Björn
Björn Lundin
bnl at spray dot se
[-- Attachment #2: Type: text/enriched, Size: 1443 bytes --]
2005-04-14 kl. 09.26 skrev Alex R. Mosteo:
<excerpt>
About the license, it may be indeed that it must be GMGPL because
XML/Ada is. I copied/pasted the license block in the rest of my
original
code, but here we're talking about a modification of XML/Ada so I
presume I must maintain the original license (which I'm not interested
in modifying, I simply didn't thought of it until now).
I presume that any modification introduced in the GPL such as the GMGPL
is propagated? I mean, Could someone provide a more restrictive license
for a derivative work?
In any case I will reflect this change in the file license ASAP.
</excerpt>
I looked at your cvs-site, but did not find it.
However, I then presume it is ok if I paste in the GMGPL into
<fixed>Dom.Core.Nodes.Output ? </fixed>
<excerpt><excerpt><excerpt>but be warned that it performs some pretty
printing and by that
reason Windows-style new lines are embedded in the resulting
string.
</excerpt>I can live with that.
</excerpt>
There are too some chunks of whitespace for tabulating. That can add
quite some size. You may want to remove that too if the XML generated
is
never for human consumption.
</excerpt>Well, it's not intended for humans, but it's fairly small
documents (less than 5 k)
so i'll keep it ,since it makes it easier to debug
/Björn
Björn Lundin
bnl at spray dot se
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: XMLAda dom document to string
2005-04-14 15:35 ` Björn Lundin
@ 2005-04-15 9:32 ` Alex R. Mosteo
0 siblings, 0 replies; 9+ messages in thread
From: Alex R. Mosteo @ 2005-04-15 9:32 UTC (permalink / raw)
Bj�rn Lundin wrote:
>
>
> 2005-04-14 kl. 09.26 skrev Alex R. Mosteo:
>
>
> About the license, it may be indeed that it must be GMGPL because
> XML/Ada is. I copied/pasted the license block in the rest of my
> original
> code, but here we're talking about a modification of XML/Ada so I
> presume I must maintain the original license (which I'm not interested
> in modifying, I simply didn't thought of it until now).
>
> I presume that any modification introduced in the GPL such as the GMGPL
> is propagated? I mean, Could someone provide a more restrictive license
> for a derivative work?
>
> In any case I will reflect this change in the file license ASAP.
>
>
> I looked at your cvs-site, but did not find it.
> However, I then presume it is ok if I paste in the GMGPL into
> Dom.Core.Nodes.Output ?
I did forget to commit the change. It's now there, or paste it yourself
if you prefer.
> but be warned that it performs some pretty printing and by that
> reason Windows-style new lines are embedded in the resulting
> string.
>
> I can live with that.
>
>
> There are too some chunks of whitespace for tabulating. That can add
> quite some size. You may want to remove that too if the XML
> generated is
> never for human consumption.
>
> Well, it's not intended for humans, but it's fairly small documents
> (less than 5 k)
> so i'll keep it ,since it makes it easier to debug
That's a point.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-04-15 9:32 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-13 6:14 XMLAda dom document to string Björn Lundin
2005-04-13 7:03 ` Alex R. Mosteo
2005-04-13 17:03 ` Björn Lundin
2005-04-14 7:26 ` Alex R. Mosteo
2005-04-14 15:35 ` Björn Lundin
2005-04-15 9:32 ` Alex R. Mosteo
2005-04-13 18:50 ` Björn Lundin
2005-04-13 7:37 ` Martin Dowie
2005-04-13 17:08 ` Björn Lundin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox