digitalmars.D - Can we keep std.xml : encode, decode ?
- WebFreak001 (31/31) Jul 20 2020 Whenever operating with any XML files, even if not using the
 - bauss (3/36) Jul 21 2020 We should really just have something like std.dom which would
 - WebFreak001 (4/8) Jul 31 2020 for a future API std.dom might make sense, also to replace the
 
Whenever operating with any XML files, even if not using the 
std.xml API, I very often use encode/decode to insert strings 
into fixed file templates.
I think a lot of people will have used and still use these APIs 
because they are in the standard library and very trivial short 
implementations you can expect to exist. I think for these two 
small functions pulling in a dub library is overkill and often 
will not work well for script-like D files.
`std.xml` is being removed for being considered "out-dated and 
not up to Phobos' current standards", however I believe the 
encode/decode functions are close enough to the current standards 
or can be fairly easily modified or reimplemented to meet them.
I believe putting the XML parser, DOM & serializer from std.xml 
into undeaD is a good idea, however I think the very basic string 
utilities that many more programs might use should stay in.
For example currently some simple script that is called in a 
cronjob could be used to automatically generate a static HTML 
file given some input from some other program:
import std.conv;
import std.stdio;
import std.xml : encode;
void main(string[] args)
{
	writeln("<!DOCTYPE html><html>");
	writeln("<head><title>Auto generated site</title></head>");
	writeln("<body>");
	writeln(`<h1 title="`, args.to!string.encode, `">`);
	writeln("Last call: ", args.to!string.encode);
	writeln("</h1>");
	writeln("</body></html>");
}
 Jul 20 2020
On Monday, 20 July 2020 at 14:04:57 UTC, WebFreak001 wrote:
 Whenever operating with any XML files, even if not using the 
 std.xml API, I very often use encode/decode to insert strings 
 into fixed file templates.
 I think a lot of people will have used and still use these APIs 
 because they are in the standard library and very trivial short 
 implementations you can expect to exist. I think for these two 
 small functions pulling in a dub library is overkill and often 
 will not work well for script-like D files.
 `std.xml` is being removed for being considered "out-dated and 
 not up to Phobos' current standards", however I believe the 
 encode/decode functions are close enough to the current 
 standards or can be fairly easily modified or reimplemented to 
 meet them.
 I believe putting the XML parser, DOM & serializer from std.xml 
 into undeaD is a good idea, however I think the very basic 
 string utilities that many more programs might use should stay 
 in.
 For example currently some simple script that is called in a 
 cronjob could be used to automatically generate a static HTML 
 file given some input from some other program:
 import std.conv;
 import std.stdio;
 import std.xml : encode;
 void main(string[] args)
 {
 	writeln("<!DOCTYPE html><html>");
 	writeln("<head><title>Auto generated site</title></head>");
 	writeln("<body>");
 	writeln(`<h1 title="`, args.to!string.encode, `">`);
 	writeln("Last call: ", args.to!string.encode);
 	writeln("</h1>");
 	writeln("</body></html>");
 }
We should really just have something like std.dom which would 
contain things like that.
 Jul 21 2020
On Tuesday, 21 July 2020 at 07:55:25 UTC, bauss wrote:On Monday, 20 July 2020 at 14:04:57 UTC, WebFreak001 wrote:for a future API std.dom might make sense, also to replace the current std.xml API, but I would really like to keep std.xml : encode, decode! (which std.dom could use then too)[...]We should really just have something like std.dom which would contain things like that.
 Jul 31 2020








 
 
 
 WebFreak001 <d.forum webfreak.org>