Thread overview | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 01, 2007 SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
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 |
October 01, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Hsu | 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 |
October 01, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Hsu | 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?
|
October 02, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | 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 |
October 02, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Hsu | 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" |
October 02, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | 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" |
October 02, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris |
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
|
October 02, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | 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" > > |
October 02, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | Kris wrote:
> I know of another that is /insanely/ fast. Not public yet, but it royally kicks some 'enterprise' ass
Even 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
|
October 02, 2007 Re: SimpleXMLD XML Parser 0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to BLS | 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 |
Copyright © 1999-2021 by the D Language Foundation