XML functions?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
eros
I live to help wx-kind
I live to help wx-kind
Posts: 162
Joined: Mon Sep 06, 2004 1:40 am
Location: Argentina

XML functions?

Post by eros »

Is there any functions to read XML or we have to do it ourselfs?
...
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Re: XML functions?

Post by Ryan Norton »

eros wrote:Is there any functions to read XML or we have to do it ourselfs?
There's wx/xml/xml.h or expat that comes with wxwidgets, or there's a project at http://xml4wxwindows.sourceforge.net/.
[Mostly retired moderator, still check in to clean up some stuff]
caseyodonnell
Knows some wx things
Knows some wx things
Posts: 31
Joined: Fri Sep 10, 2004 1:03 pm
Location: Troy, NY
Contact:

Re: XML functions?

Post by caseyodonnell »

Ryan Norton wrote:There's wx/xml/xml.h or expat that comes with wxwidgets, or there's a project at http://xml4wxwindows.sourceforge.net/.
xml4wxwindows hasn't been updated in a while I don't think.

If wx/xml/xml.h doesn't fit your needs, I'd recommend http://www.grinninglizard.com/tinyxml/ instead. I've also been a big Xerces/Xalan user, but unless you really need XSLT, it probably isn't worth the effort and application size that they bring.

Cheers.
Casey
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Re: XML functions?

Post by Ryan Norton »

caseyodonnell wrote:
Ryan Norton wrote:There's wx/xml/xml.h or expat that comes with wxwidgets, or there's a project at http://xml4wxwindows.sourceforge.net/.
xml4wxwindows hasn't been updated in a while I don't think.

If wx/xml/xml.h doesn't fit your needs, I'd recommend http://www.grinninglizard.com/tinyxml/ instead. I've also been a big Xerces/Xalan user, but unless you really need XSLT, it probably isn't worth the effort and application size that they bring.

Cheers.
Casey
Casey - wasn't there a wxwidgets wrapper around libxml posted a while back?
[Mostly retired moderator, still check in to clean up some stuff]
caseyodonnell
Knows some wx things
Knows some wx things
Posts: 31
Joined: Fri Sep 10, 2004 1:03 pm
Location: Troy, NY
Contact:

Re: XML functions?

Post by caseyodonnell »

Ryan Norton wrote: Casey - wasn't there a wxwidgets wrapper around libxml posted a while back?
There is http://pmade.org/software/xmlwrapp/ but that doesn't seem to be wxWidgets specific. I've seen mention of wxmlccwrap, on the list archive, but don't know what it is, and Google doesn't tell me anything.

So, I suspect there might be, but I'm not finding it.
eros
I live to help wx-kind
I live to help wx-kind
Posts: 162
Joined: Mon Sep 06, 2004 1:40 am
Location: Argentina

Post by eros »

Thx guys, we should implement XML functions from PHP 5 (which are REALLY cool).

I'll take a look into it.
...
cg
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Sun Aug 29, 2004 12:33 am
Location: Canada
Contact:

Post by cg »

I have found the best XML library so far is TinyXML:

http://tinyxml.sourceforge.net/

Well, best for my needs!

CG
HopeSeekr
Earned a small fee
Earned a small fee
Posts: 16
Joined: Sun Aug 29, 2004 1:07 pm
Contact:

Post by HopeSeekr »

You could take a look at how xmule parses xml files from the DynamicPreferences class...Just remember that it is licensed under a US copyright in that you can only use no more than 10% and must directly reference if you choose to make code based off what you see in there (which is only fair).

http://cvs.sourceforge.net/viewcvs.py/x ... &view=auto

Look specifically in DynamicPreferencesCtrl::DynamicPreferencesCtrl()
User avatar
jokke
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon Sep 06, 2004 9:37 am
Location: Lund, Sweden
Contact:

Post by jokke »

Hi!

We saw some documentation for the built-in XML functionality that said "do not use yet". Perhaps that warning is deprecated?

We need only simple XML-functions; tags with and without values, and that's it. Will wx/xml/xml.h be suitable for this?

What do you reckon would be the easiest and best XML parser to use for these purposes?
Regards,

/Joakim
Ryan Wilcox
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Mon Aug 30, 2004 1:26 pm
Location: PA, USA
Contact:

Post by Ryan Wilcox »

jokke wrote:Hi!

We saw some documentation for the built-in XML functionality that said "do not use yet". Perhaps that warning is deprecated?

We need only simple XML-functions; tags with and without values, and that's it. Will wx/xml/xml.h be suitable for this?
It's a two-fold issue.

One, the wxXmlDocument stuff is there, and people do use it. I suspect (and will push for) it to remain available for a long time. Of course, I'm not one of the developers, so my request might be cast aside for other reasons.

Two, the wxXmlDocument is a simple XML parser. I've used it before to parse a simple XML document, and the functionality really ends there - parsing simple XML. If you need to apply XSLTs, or other "advanced" XML features, you have to look somewhere else.

There has been passing talk on the mailing list about needing a New And Better XML implementation, but (seemingly) nobody has stepped up to the plate yet. This could mean that everybody is already using some library like TinyXML and throwing it into wxWidgets structures, or maybe people are using the standard library with these other APIs (and they don't need to do interface that part of there app with wxWidgets). I don't know.

For my purposes (parsing a relatively simple XML document) wxXmlDocumentworked fine.
Ryan Wilcox
Wilcox Development Solutions
http://www.wilcoxd.com
kastelat
In need of some credit
In need of some credit
Posts: 3
Joined: Mon Aug 30, 2004 8:35 am
Location: Mainz, Germany

Post by kastelat »

There was also a question about XML-Libs in the Mailinglist.

Francesco Montorsi anwered :
---------8<-------------------------------
Hi,
if you want to do good XML parsing/editing/load&save with wxWidgets,
I suggest you to use wxWidgets+libxml2, maybe using the wrappers
I've created for libxml2 (they're called wxxml2; you'll find them at
http://wxcode.sourceforge.net)
[...]
FM
--------->8-------------------------------

Gordon
Post Reply