www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Compiler time XML parser ?

reply =?iso-8859-1?q?Knud_S=F8rensen?= <12tkvvb02 sneakemail.com> writes:
Since Eric Anderton posted he's compile-time regular expressions lib, I
have been thinking if it is possible to make a compiler time XML parser.

The similar function to Eric lib would be to have the lib read the DTD
file at compiler time and make a parser which could validate XML files.

Another idea is to make a library which make it possible 
to write XML pages in a way so that they always is valid.





  
Jan 07 2006
next sibling parent pragma <pragma_member pathlink.com> writes:
In article <pan.2006.01.07.21.23.19.554011 sneakemail.com>,
=?iso-8859-1?q?Knud_S=F8rensen?= says...
Since Eric Anderton posted he's compile-time regular expressions lib, I
have been thinking if it is possible to make a compiler time XML parser.

The similar function to Eric lib would be to have the lib read the DTD
file at compiler time and make a parser which could validate XML files.
Interesting concept. While I cringe at the mere thought of writing a DTD parser (I shyed away from this when I wrote my XML parser some time ago), I can certainly see the value in this. I say: go for it! The only major problems you're going to run into is with the upper limit on mangled D symbol name lengths. This pretty much goes for any template that accepts a const char[] value as an argument: it forces a hard limitation on the size of the data set you can process. The regex engine has the regex spec on its side, as most expressions are usually very brief.
Another idea is to make a library which make it possible 
to write XML pages in a way so that they always is valid.
Sort of like a DTD aware, validating, writable DOM? Sweet. One request if I may: please adopt a strategy like I did with regex, where you have a separate compile-time and runtime portions to the DTD lib if you can. That way, people can use the runtime portion if they see the need (not to mention the runtime portion will be testable separate from the compile-time portion that merely leverages it). - EricAnderton at yahoo
Jan 07 2006
prev sibling next sibling parent nick <nick.atamas gmail.com> writes:
Knud Sørensen wrote:
 The similar function to Eric lib would be to have the lib read the DTD
 file at compiler time and make a parser which could validate XML files.
But perhaps you want to use a schema instead of a DTD.
Jan 28 2006
prev sibling parent David Medlock <noone nowhere.com> writes:
Knud Sørensen wrote:
 Since Eric Anderton posted he's compile-time regular expressions lib, I
 have been thinking if it is possible to make a compiler time XML parser.
 
 The similar function to Eric lib would be to have the lib read the DTD
 file at compiler time and make a parser which could validate XML files.
 
 Another idea is to make a library which make it possible 
 to write XML pages in a way so that they always is valid.
 
 
Perhaps this will inspire some ideas: http://www.codeproject.com/cpp/yard-xml-parser.asp
Feb 02 2006