www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Xml parser

reply "Jan Hanselaer" <jan.hanselaer gmail.com> writes:
Hi all,

I need to parse an xml-document so I hoped there would be support for that 
in the Phobos Runtime Library.
Obviously that's not the case.

There probably are some libraries for it, so my question is ... anyone of 
you has some experience in parsing Xml-files?
What library did you use? For me it's very important that there is some 
documentation available.

Thanks in advance

Jan 
Apr 25 2007
next sibling parent Lars Ivar Igesund <larsivar igesund.net> writes:
Jan Hanselaer wrote:

 Hi all,
 
 I need to parse an xml-document so I hoped there would be support for that
 in the Phobos Runtime Library.
 Obviously that's not the case.
 
 There probably are some libraries for it, so my question is ... anyone of
 you has some experience in parsing Xml-files?
 What library did you use? For me it's very important that there is some
 documentation available.
 
 Thanks in advance
 
 Jan

AFAIK, the most mature parser in D at the moment, is the SAX parser in Mango. http://www.dsource.org/projects/mango -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Apr 25 2007
prev sibling next sibling parent Lutger <lutger.blijdestijn gmail.com> writes:
Jan Hanselaer wrote:
 Hi all,
 
 I need to parse an xml-document so I hoped there would be support for that 
 in the Phobos Runtime Library.
 Obviously that's not the case.
 
 There probably are some libraries for it, so my question is ... anyone of 
 you has some experience in parsing Xml-files?
 What library did you use? For me it's very important that there is some 
 documentation available.
 
 Thanks in advance
 
 Jan 
 
 

I've had good experience with mango's xml package, it's fast and easy to use. I believe you could generate ddoc documentation with it and there are some examples in SVN. Another library is TinyXPath, with contains TinyXml (port from C++). This is not sax-based as is mango's xml package, but still convenient and has good documentation (you can use the C++ docs).
Apr 25 2007
prev sibling next sibling parent jcc7 <technocrat7 gmail.com> writes:
There's a whole list of candidates at Wiki4D:
http://www.prowiki.org/wiki4d/wiki.cgi?AllLibraries/XmlLibraries

But I suspect that others that replied are right and you're probably looking for
the SAX parser in Mango (http://www.dsource.org/projects/mango).

Many of the projects on the Wiki4D list probably aren't active and would require
some updating to work with D 1.0+.

jcc7
Apr 25 2007
prev sibling next sibling parent Clay Smith <clayasaurus gmail.com> writes:
Jan Hanselaer wrote:
 Hi all,
 
 I need to parse an xml-document so I hoped there would be support for that 
 in the Phobos Runtime Library.
 Obviously that's not the case.
 
 There probably are some libraries for it, so my question is ... anyone of 
 you has some experience in parsing Xml-files?
 What library did you use? For me it's very important that there is some 
 documentation available.
 
 Thanks in advance
 
 Jan 
 
 

Another option: http://www.dsource.org/projects/yage/browser/trunk/src/yage/core/xml.d http://www.dsource.org/projects/arclib/browser/trunk/arc/xml works fine for me so I can't complain. ~ Clay
Apr 25 2007
prev sibling parent reply Gregor Richards <Richards codu.org> writes:
Jan Hanselaer wrote:
 I hoped there would be support for that 
 in the Phobos Runtime Library.
 Obviously that's not the case.
 

I would personally like to thank Walter, the Tango team, God, Satan, Jesus, Allah, Muhammed, all the Buddhas throughout history, Brahman and Ahura Mazda for this fact. - Gregor Richards
Apr 25 2007
parent reply "Aziz K." <aziz.kerim gmail.com> writes:
On Wed, 25 Apr 2007 19:22:20 +0200, Gregor Richards <Richards codu.org>  
wrote:

 Jan Hanselaer wrote:
 I hoped there would be support for that in the Phobos Runtime Library.
 Obviously that's not the case.

I would personally like to thank Walter, the Tango team, God, Satan, Jesus, Allah, Muhammed, all the Buddhas throughout history, Brahman and Ahura Mazda for this fact. - Gregor Richards

What?! You worthless, blasphemous creature deserving of eternal punishment in hell where C++ is the only permissible language to torture your dark-sided soul! Besides the one and only true God is Huitzilopochtli. Nobody can dispute this, because I and many others have witnessed his greatness as He answered our humble prayers in our direst times. Huitzilopochtli is a just and loving God. If you want to be saved you only have to accept Him in your heart and must not ascribe partners to Him, for He is our only Lord, our Sustainer, the Light, the Truth. How can you not accept this free gift? Don't succumb to your haughtiness as so have whole nations, which were destroyed by our Lord because they sinned against their own souls and transgressed the divine laws made clear to them. They have witnessed the signs of the Lord but they rejected them and turned it to mockery. Verily, to thy Lord is the return. If you choose any other religion than submission to Huitzilopochtli, never will it be accepted from you and the Fire shall be your abode. PS.: Allah and Muhammad seem to be redundant in your list; you already thanked Satan.
Apr 25 2007
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Aziz K. wrote:
 On Wed, 25 Apr 2007 19:22:20 +0200, Gregor Richards <Richards codu.org> 
 wrote:
 
 Jan Hanselaer wrote:
 I hoped there would be support for that in the Phobos Runtime Library.
 Obviously that's not the case.

I would personally like to thank Walter, the Tango team, God, Satan, Jesus, Allah, Muhammed, all the Buddhas throughout history, Brahman and Ahura Mazda for this fact. - Gregor Richards


 
 PS.: Allah and Muhammad seem to be redundant in your list; you already 
 thanked Satan.

Joke or not, that comment is way out of line. Go sit in the corner for an hour and don't post crap like that here ever again. --bb
Apr 25 2007
parent reply "Aziz K." <aziz.kerim gmail.com> writes:
On Thu, 26 Apr 2007 01:54:44 +0200, Bill Baxter  
<dnewsgroup billbaxter.com> wrote:
 Joke or not, that comment is way out of line.  Go sit in the corner for  
 an hour and don't post crap like that here ever again.

 --bb

Thanks for the rebuke, but no, I'm not going to sit in the corner and reconsider what I said. I understand that from a "the world is full of love and sunshine"-view that little sentence seems to be very inappropriate and hurtful. But as hurtful as it may be to a Muslim, it's unfortunately the truth. If someone accused my father of being a rapist, of course I would be extremely upset and feel angry about that insult. But if all the historical evidence is incriminating and points toward the guiltiness of my father, well then I have to cope with that emotional distress and severe my ties from him. I have the utmost disrespect for Islam because I was born into it and I grew up viewing the world with islamic goggles wrapped tight around my head. Do you think I've had a choice in this? I was indoctrinated with the beliefs that Allah is the only true God and that Mohammad was His last, noble Messenger and that you would roast forever in hell if you didn't believe that. It's obvious that you can't choose your parents, so I utterly despise it when people think they have to force the religious baloney down the throat of their children, the way their own parents did it to them. Once you're born a Muslim you'll remain one until your death. There is no such thing as the concept of religious privatism in islamic families like you have it in enlightened societies. You have to carry that stupid religious label around you even after you have made the intelligent decision to free yourself from the mind slavery of Islam. It's a huge taboo to ask tough questions about Islam that might threaten the faith. An even bigger taboo is it to leave the religion altogether. All hell would break loose if you announced your apostasy to your family. The best that could happen is ostracism, and the worst being mercilessly killed for having dared to use your basic human right of freedom of conscience. Even moderate parents would reject you or try to bring you back to the faith, because you know, there's an everlasting punishment awaiting you after your death, and they wouldn't like the thought of you being barbecued by their merciful Lord. It's certainly not easy to be a closet apostate in a muslim family. Despite my abhorrence of Islam I acknowledge that the Muslim communities are hugely and immensely diverse. Most of them have a rich and great culture, but alas, as I see it, it is stained with the stupidity and savagery of Islam. I'm very critical of the ideology and I make a distinction between it and the followers. I'm the last person to demonize a whole group of people and say that they are all evil and potential terrorists. I don't have a problem with them practicing their religion privately and in Mosques as long as they fully subscribe to the humanistic values Europe has gained through the enlightenment process. And such a thing has still to happen in Muslim countries and in the minds of the Muslims living in secular countries. They don't even like the slightest negative criticism from a reformist Muslim or Non-Muslim regarding the Prophet and his Message. A lot of deluded reformist Muslims live in secular countries, and even there they often have to fear for their lives (like Irshad Manji for example). When they live in islamic countries all the islamic authorities can do is censor their books, lock them up in a cell or worse execute them. And all the Muslims in the secular countries can do is to get aggressively huffy when someone points out the idiocies and inhumanities in the islamic doctrine. I know it's hard to understand that post scriptum one-liner, but I and many other ex-Muslims are fed up with the ever recurring BS phrase "Islam is a tolerant/peaceful religion." Well it is not. Mohammad carried out over 70 raids on caravans routing out of and to Mecca in order to support the weak economy in Medinah. Once he became stronger he attacked the villages of Jewish tribes, massacred ca. 600 men and pubertal boys (of the Banu Quraizah) who were his prisoners of war, the women and children were not harmed but were considered booties of war like cattle, gold etc. and evenly distributed among the army of the Prophet and one fifth was always assigned to him and his sky-daddy Allah (8:41). The apologetic view regarding this is that they received a punishment according to their own book by a jewish judge from their amidst, which of course suddenly acquits him of this unbelievable crime. Mohammad (or his alter ego Allah) sanctioned the right to enjoy those whom thy right hand possesses out of the prisoners of war (33:50). This means it was legitimate for Mohammad and his cult members to have sex with the enslaved women whose husbands and fathers were killed in war. Now tell me, which woman with self-worth and sanity would happily consent to intercourse with the killer of her relatives? Would it matter to throw in the allegation that Mohammad had acted in self-defence in those wars? I don't think so. He married a 6 year-old and consumated the marriage when she was 9, and even if you want to dispute all the evidence in the Hadith testifying to this fact, there is a worryingly large amount of Muslims who defend this devilish act with all sorts of mental gymnastics. They really have no qualms about a fifty years old man having intercourse with an innocent child. Now if these kind of things don't disgust you I don't know what does. Non-Muslims feel extremely uncomfortable with such statements, even if it comes from the mouth of an ex-Muslim. There's an organisation in Germany, the Central Council of Ex-Muslims, which was founded by the exile-Iranian and dissident Mina Ahadi in the beginning of this year. While Mina was away from home, her husband and 5 other guests were arrested and mercilessly executed by the iranian version of the Gestapo. She had to flee Iran but she didn't remain inactive and founded an organisation with a group of other ex-Muslims that is so deeply needed as a public voice of all the ex-Muslims. Of course this isn't the right place to discuss religious issues, but I really felt the need to explain myself, so that the D community can understand me better.
Apr 26 2007
parent Dan <murpsoft hotmail.com> writes:
Well said, sir; and fully agreed upon.

However, the religious zealots get all excited and anxious when such things are
said, preventing us from discussing D; so exists the age old convention of
refraining from bringing up such things in public forum; so continues this
mental disorder; so we grieve.

If you bring it up in a more appropriate place, the religious will fight or
flee - progressing nothing; while the aware will agree - progressing nothing. 
This has always perplexed us, and I'm at a loss for words as to how one might
overcome it.

Shall we abandon the topic on these forums?

Sincerely,
Dan

Aziz K. Wrote:
 On Thu, 26 Apr 2007 01:54:44 +0200, Bill Baxter  
 <dnewsgroup billbaxter.com> wrote:
 Joke or not, that comment is way out of line.  Go sit in the corner for  
 an hour and don't post crap like that here ever again.

 --bb

Thanks for the rebuke, but no, I'm not going to sit in the corner and reconsider what I said. I understand that from a "the world is full of love and sunshine"-view that little sentence seems to be very inappropriate and hurtful. But as hurtful as it may be to a Muslim, it's unfortunately the truth. If someone accused my father of being a rapist, of course I would be extremely upset and feel angry about that insult. But if all the historical evidence is incriminating and points toward the guiltiness of my father, well then I have to cope with that emotional distress and severe my ties from him. I have the utmost disrespect for Islam because I was born into it and I grew up viewing the world with islamic goggles wrapped tight around my head. Do you think I've had a choice in this? I was indoctrinated with the beliefs that Allah is the only true God and that Mohammad was His last, noble Messenger and that you would roast forever in hell if you didn't believe that. It's obvious that you can't choose your parents, so I utterly despise it when people think they have to force the religious baloney down the throat of their children, the way their own parents did it to them. Once you're born a Muslim you'll remain one until your death. There is no such thing as the concept of religious privatism in islamic families like you have it in enlightened societies. You have to carry that stupid religious label around you even after you have made the intelligent decision to free yourself from the mind slavery of Islam. It's a huge taboo to ask tough questions about Islam that might threaten the faith. An even bigger taboo is it to leave the religion altogether. All hell would break loose if you announced your apostasy to your family. The best that could happen is ostracism, and the worst being mercilessly killed for having dared to use your basic human right of freedom of conscience. Even moderate parents would reject you or try to bring you back to the faith, because you know, there's an everlasting punishment awaiting you after your death, and they wouldn't like the thought of you being barbecued by their merciful Lord. It's certainly not easy to be a closet apostate in a muslim family. Despite my abhorrence of Islam I acknowledge that the Muslim communities are hugely and immensely diverse. Most of them have a rich and great culture, but alas, as I see it, it is stained with the stupidity and savagery of Islam. I'm very critical of the ideology and I make a distinction between it and the followers. I'm the last person to demonize a whole group of people and say that they are all evil and potential terrorists. I don't have a problem with them practicing their religion privately and in Mosques as long as they fully subscribe to the humanistic values Europe has gained through the enlightenment process. And such a thing has still to happen in Muslim countries and in the minds of the Muslims living in secular countries. They don't even like the slightest negative criticism from a reformist Muslim or Non-Muslim regarding the Prophet and his Message. A lot of deluded reformist Muslims live in secular countries, and even there they often have to fear for their lives (like Irshad Manji for example). When they live in islamic countries all the islamic authorities can do is censor their books, lock them up in a cell or worse execute them. And all the Muslims in the secular countries can do is to get aggressively huffy when someone points out the idiocies and inhumanities in the islamic doctrine. I know it's hard to understand that post scriptum one-liner, but I and many other ex-Muslims are fed up with the ever recurring BS phrase "Islam is a tolerant/peaceful religion." Well it is not. Mohammad carried out over 70 raids on caravans routing out of and to Mecca in order to support the weak economy in Medinah. Once he became stronger he attacked the villages of Jewish tribes, massacred ca. 600 men and pubertal boys (of the Banu Quraizah) who were his prisoners of war, the women and children were not harmed but were considered booties of war like cattle, gold etc. and evenly distributed among the army of the Prophet and one fifth was always assigned to him and his sky-daddy Allah (8:41). The apologetic view regarding this is that they received a punishment according to their own book by a jewish judge from their amidst, which of course suddenly acquits him of this unbelievable crime. Mohammad (or his alter ego Allah) sanctioned the right to enjoy those whom thy right hand possesses out of the prisoners of war (33:50). This means it was legitimate for Mohammad and his cult members to have sex with the enslaved women whose husbands and fathers were killed in war. Now tell me, which woman with self-worth and sanity would happily consent to intercourse with the killer of her relatives? Would it matter to throw in the allegation that Mohammad had acted in self-defence in those wars? I don't think so. He married a 6 year-old and consumated the marriage when she was 9, and even if you want to dispute all the evidence in the Hadith testifying to this fact, there is a worryingly large amount of Muslims who defend this devilish act with all sorts of mental gymnastics. They really have no qualms about a fifty years old man having intercourse with an innocent child. Now if these kind of things don't disgust you I don't know what does. Non-Muslims feel extremely uncomfortable with such statements, even if it comes from the mouth of an ex-Muslim. There's an organisation in Germany, the Central Council of Ex-Muslims, which was founded by the exile-Iranian and dissident Mina Ahadi in the beginning of this year. While Mina was away from home, her husband and 5 other guests were arrested and mercilessly executed by the iranian version of the Gestapo. She had to flee Iran but she didn't remain inactive and founded an organisation with a group of other ex-Muslims that is so deeply needed as a public voice of all the ex-Muslims. Of course this isn't the right place to discuss religious issues, but I really felt the need to explain myself, so that the D community can understand me better.

Apr 26 2007