digitalmars.D.announce - SimpleXMLD XML Parser 0.0.1
- Brian Hsu (42/42) Oct 01 2007 Hello, everybody
- Brian Hsu (5/6) Oct 01 2007 Sorry the above hyper link is broken: http://bone.twbbs.org.tw/SimpleXML...
- Walter Bright (3/5) Oct 01 2007 Thanks! Can you also please add the phrase "D programming language" to
- Brian Hsu (6/8) Oct 01 2007 Thanks for your reminding, this is indeed a very important thing that I ...
- Daniel Keep (9/9) Oct 01 2007 Looks nice; I'll take a closer look at it when I get the chance.
- Kris (5/14) Oct 01 2007 I know of another that is /insanely/ fast. Not public yet, but it royall...
- Daniel Keep (5/9) Oct 02 2007 Well, the goal of my XML stuff is to provide implementations of the
- BLS (5/29) Oct 02 2007 Hi Kris,
- Alexander Panek (4/6) Oct 02 2007 Even the not-so-insanely fast version kicks ass and essentially does
- Jari-Matti =?ISO-8859-1?Q?M=E4kel=E4?= (3/10) Oct 02 2007 Well, is there as fast s-expression parser yet for D? I bet that could b...
- Bill Baxter (5/16) Oct 02 2007 There's the dead dLisp project. http://www.dsource.org/projects/dlisp
- fumanchu (5/61) Oct 02 2007 Hi Brian,
Hello, everybody I've wrote an simple XML DOM-like parser, because I could not found an appropriate one that more comprehensive. I think may be there are others seeking for an library which could retrieve information from XML file easily, so here is my pieces of work. SimpleXMLD is a library which inspired by PHP's SimpleXML functions, it cloud load XML file into memory and build a tree structure of it. It is suitable when you just want to quickly access an small XML file. For example, if you have following XML file: ------------------ test.xml --------------------- <root isRoot="true"> <hello>text</hello> <node key1="1">node 1</node> <node key2="2">node 2</node> </root> -------------------------------------------------- And you cloud use SimpleXMLD access them easily: -------------------------------------------------- import SimpleXMLD.all; void main () { // Just load XML from disk file an build an tree structure SimpleXML root = SimpleXML.loadFile ("test.xml"); // Get node attribute char [] isRoot = root.attributes["isRoot"]; // Now isRoot="true" // Get node data of hello SimpleXML [] hello = root["hello"]; // This will output "text" Stdout (hello[0].data); // Iterate over all child foreach (SimpleXML node; root) { char [] tagname = node.tag; char [] textdata = node.data; } // Iterate over all olny child named "node" foreach (SimpleXML node; root["node"]) { char [] tagname = node.tag; char [] textdata = node.data; } } -------------------------------------------------- Currently I am waiting dsource approve hosting this project on it, so I only have API document instead of official website. But I tried make API documents comprehensive and clearly, although my English is not my native speaking language, so it may be look a little weired. The SimpleXMLD library download could be found at API documents too. (http://bone.twbbs.org.tw/SimpleXMLD) It is first time I wrote library for D, and in fact I'm not really familiar with XML standard, so this library may be buggy, and the design is not very pretty too, so any suggestion are welcome. -- Brian Hsu
Oct 01 2007
Brian Hsu Wrote:The SimpleXMLD library download could be found at API documents too. (http://bone.twbbs.org.tw/SimpleXMLD)Sorry the above hyper link is broken: http://bone.twbbs.org.tw/SimpleXMLD And just in case above URL doesn't work, here is a mirror site: http://stu.im.ncnu.edu.tw/~brianhsu/SimpleXMLD -- Brian Hsu
Oct 01 2007
Brian Hsu wrote:The SimpleXMLD library download could be found at API documents too. (http://bone.twbbs.org.tw/SimpleXMLD)Thanks! Can you also please add the phrase "D programming language" to your web page somewhere so google will associate it with D?
Oct 01 2007
Walter Bright Wrote:Thanks! Can you also please add the phrase "D programming language" to your web page somewhere so google will associate it with D?Thanks for your reminding, this is indeed a very important thing that I forget to do. ;) BTW, Now this project is hosting on dsource, people who interested in this project could see http://dsource.org/projects/simplexmld as official website. Subversion repository of source code and API documents are also available on that page now. -- Brian Hsu
Oct 01 2007
Looks nice; I'll take a closer look at it when I get the chance. AFAIK, the only other person working on an XML parser for D is JimPanic. That said, I've got work-in-progress implementations of DOM Level 1, SAX 2 and a D-specific PullDOM inspired by Python up at <http://drk.is-a-geek.net/~drk/d/xml.7z>. It uses a binding to Expat as the parser currently. Basically, just haven't had time to work on it lately; it's all BSD v2, so feel free to borrow bits if you want :) -- Daniel "oh how I hate the W3C"
Oct 01 2007
I know of another that is /insanely/ fast. Not public yet, but it royally kicks some 'enterprise' ass ;) "Daniel Keep" <daniel.keep.lists gmail.com> wrote in message news:fdsn0t$2k32$1 digitalmars.com...Looks nice; I'll take a closer look at it when I get the chance. AFAIK, the only other person working on an XML parser for D is JimPanic. That said, I've got work-in-progress implementations of DOM Level 1, SAX 2 and a D-specific PullDOM inspired by Python up at <http://drk.is-a-geek.net/~drk/d/xml.7z>. It uses a binding to Expat as the parser currently. Basically, just haven't had time to work on it lately; it's all BSD v2, so feel free to borrow bits if you want :) -- Daniel "oh how I hate the W3C"
Oct 01 2007
Kris wrote:I know of another that is /insanely/ fast. Not public yet, but it royally kicks some 'enterprise' ass ;)Well, the goal of my XML stuff is to provide implementations of the various API standards, not implement the actual parsing. I used Expat basically because it was there, and fairly simple to hook up. -- Daniel
Oct 02 2007
Kris schrieb:I know of another that is /insanely/ fast. Not public yet, but it royally kicks some 'enterprise' ass ;)Hi Kris, will this "damned fast piece of code" become part of Tango ? Thanks for clarification. Bjoern"Daniel Keep" <daniel.keep.lists gmail.com> wrote in message news:fdsn0t$2k32$1 digitalmars.com...Looks nice; I'll take a closer look at it when I get the chance. AFAIK, the only other person working on an XML parser for D is JimPanic. That said, I've got work-in-progress implementations of DOM Level 1, SAX 2 and a D-specific PullDOM inspired by Python up at <http://drk.is-a-geek.net/~drk/d/xml.7z>. It uses a binding to Expat as the parser currently. Basically, just haven't had time to work on it lately; it's all BSD v2, so feel free to borrow bits if you want :) -- Daniel "oh how I hate the W3C"
Oct 02 2007
A high probability :) "BLS" <nanali nospam-wanadoo.fr> wrote in message news:fdt5g9$125k$1 digitalmars.com...Kris schrieb:I know of another that is /insanely/ fast. Not public yet, but it royally kicks some 'enterprise' ass ;)Hi Kris, will this "damned fast piece of code" become part of Tango ? Thanks for clarification. Bjoern
Oct 02 2007
Kris wrote:I know of another that is /insanely/ fast. Not public yet, but it royally kicks some 'enterprise' assEven the not-so-insanely fast version kicks ass and essentially does exactly the same I am trying to achieve - damn. As Lars said on IRC, the XML market is flourish these days. ;P
Oct 02 2007
Alexander Panek wrote:Kris wrote:Well, is there as fast s-expression parser yet for D? I bet that could be useful for people who know xml is a bit too verbose. :)I know of another that is /insanely/ fast. Not public yet, but it royally kicks some 'enterprise' assEven the not-so-insanely fast version kicks ass and essentially does exactly the same I am trying to achieve - damn. As Lars said on IRC, the XML market is flourish these days. ;P
Oct 02 2007
Jari-Matti Mäkelä wrote:Alexander Panek wrote:There's the dead dLisp project. http://www.dsource.org/projects/dlisp I would hope they at *least* got as far as parsing s-exps before abandoning the project. --bbKris wrote:Well, is there as fast s-expression parser yet for D? I bet that could be useful for people who know xml is a bit too verbose. :)I know of another that is /insanely/ fast. Not public yet, but it royally kicks some 'enterprise' assEven the not-so-insanely fast version kicks ass and essentially does exactly the same I am trying to achieve - damn. As Lars said on IRC, the XML market is flourish these days. ;P
Oct 02 2007
Hi Brian, So nice to see a /simple/ DOM ;) Are you considering XPath query also? - Kris Brian Hsu Wrote:Hello, everybody I've wrote an simple XML DOM-like parser, because I could not found an appropriate one that more comprehensive. I think may be there are others seeking for an library which could retrieve information from XML file easily, so here is my pieces of work. SimpleXMLD is a library which inspired by PHP's SimpleXML functions, it cloud load XML file into memory and build a tree structure of it. It is suitable when you just want to quickly access an small XML file. For example, if you have following XML file: ------------------ test.xml --------------------- <root isRoot="true"> <hello>text</hello> <node key1="1">node 1</node> <node key2="2">node 2</node> </root> -------------------------------------------------- And you cloud use SimpleXMLD access them easily: -------------------------------------------------- import SimpleXMLD.all; void main () { // Just load XML from disk file an build an tree structure SimpleXML root = SimpleXML.loadFile ("test.xml"); // Get node attribute char [] isRoot = root.attributes["isRoot"]; // Now isRoot="true" // Get node data of hello SimpleXML [] hello = root["hello"]; // This will output "text" Stdout (hello[0].data); // Iterate over all child foreach (SimpleXML node; root) { char [] tagname = node.tag; char [] textdata = node.data; } // Iterate over all olny child named "node" foreach (SimpleXML node; root["node"]) { char [] tagname = node.tag; char [] textdata = node.data; } } -------------------------------------------------- Currently I am waiting dsource approve hosting this project on it, so I only have API document instead of official website. But I tried make API documents comprehensive and clearly, although my English is not my native speaking language, so it may be look a little weired. The SimpleXMLD library download could be found at API documents too. (http://bone.twbbs.org.tw/SimpleXMLD) It is first time I wrote library for D, and in fact I'm not really familiar with XML standard, so this library may be buggy, and the design is not very pretty too, so any suggestion are welcome. -- Brian Hsu
Oct 02 2007
fumanchu Wrote:Are you considering XPath query also? - KrisYes, but I'm just starting reading some XPath tutorial, so it may take an while before I could implement it. And there is also a high probabilities that I would just implement a subset of it instead of all operator of XPath query. For Example: // Access Select middle BBB element(s) : BBB[position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ] may not be implemented. Because currently I think the goal of SimpleXMLD is let user easily access XML as a tree structure without having to much knowledge about so many standard, parsing method or jargon that they do not know. So XPath in my current thought, it is just a way that user could easily access nodes in XML tree structure when they are already know the structure of XML tree in SimpleXMLD. They could use query like '/AAA/BBB/CCC' to access third level child and //BBB to access all child named BBB instead of writing much D code to do lots of tedious things like search the whole tree for nodes that are named BBB. Since it is very easy when you could get all BBB node in an array and calculate the middle of array index to get the middle BBB node, using above XPath query will not save much computation time or memory space(because all node object are already in system memory), but just an overhead for library to process the query. -- Brian Hsu
Oct 02 2007
Makes a lot of sense; thanks :) "Brian Hsu" <brianhsu.hsu gmail.com> wrote in message news:fdv00n$1hp0$1 digitalmars.com...fumanchu Wrote:Are you considering XPath query also? - KrisYes, but I'm just starting reading some XPath tutorial, so it may take an while before I could implement it. And there is also a high probabilities that I would just implement a subset of it instead of all operator of XPath query. For Example: // Access Select middle BBB element(s) : BBB[position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ] may not be implemented. Because currently I think the goal of SimpleXMLD is let user easily access XML as a tree structure without having to much knowledge about so many standard, parsing method or jargon that they do not know. So XPath in my current thought, it is just a way that user could easily access nodes in XML tree structure when they are already know the structure of XML tree in SimpleXMLD. They could use query like '/AAA/BBB/CCC' to access third level child and //BBB to access all child named BBB instead of writing much D code to do lots of tedious things like search the whole tree for nodes that are named BBB. Since it is very easy when you could get all BBB node in an array and calculate the middle of array index to get the middle BBB node, using above XPath query will not save much computation time or memory space(because all node object are already in system memory), but just an overhead for library to process the query. -- Brian Hsu
Oct 02 2007