Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::XML  (Read 11857 times)

0 Members and 1 Guest are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
sf::XML
« on: January 20, 2012, 02:29:11 pm »
An XML parser? I know there are many out there (too many, if you ask me) but so many have bugs, memory leaks and are just not as user-friendly as sf::XML would surely be :-)
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::XML
« Reply #1 on: January 20, 2012, 02:34:26 pm »
I'm glad you think that I can write a better XML library than everything else that already exists, but seriously... no ;)

There are many good XML libraries, I'm surprised that you can't find one that's perfect for you.
Laurent Gomila - SFML developer

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
sf::XML
« Reply #2 on: January 20, 2012, 04:19:10 pm »
Try pugixml. It's very small, has a low memory footprint (almost none, as you can force it to work with your input buffer), easy to use and you don't have to handle empty keys or not existing elements (e.g. you can query the value of attribute x of element y even though element y doesn't even exist, which will return 0 or "").

Elgan

  • Jr. Member
  • **
  • Posts: 77
    • AOL Instant Messenger - Flat+1,+17+st+Cl
    • View Profile
sf::XML
« Reply #3 on: January 20, 2012, 07:40:57 pm »
sounds nice, using tinyxml but error handling doesnt exist..a single xml file error and it crashes everything...

I might have to take a looK! Thank you for suggestion..anymore?

using it for loading Tild maps and animation files

N1ghtly

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
sf::XML
« Reply #4 on: January 22, 2012, 08:48:15 pm »
I load Tiled maps with TinyXML :)

TechRogue

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
sf::XML
« Reply #5 on: January 23, 2012, 01:26:53 am »
I was planning on recommending pugixml if it hadn't been brought up yet. I prefer using JSON wherever possible, but pugixml is my library of choice when I use XML.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sf::XML
« Reply #6 on: January 23, 2012, 02:18:32 am »
I prefer to use YAML, mostly because it comes built in to ruby.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
sf::XML
« Reply #7 on: January 23, 2012, 01:03:29 pm »
What is the best for C++? :D

tobybear

  • Newbie
  • *
  • Posts: 27
    • View Profile
sf::XML
« Reply #8 on: January 23, 2012, 01:10:50 pm »
Quote from: "TheEnigmist"
What is the best for C++? :D

As already said above: tinyxml and pugixml both work really well for C++ and are easy to integrate in a project, but pugixml is a bit more forgiving conerning malformed xml syntax.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::XML
« Reply #9 on: January 23, 2012, 01:17:40 pm »
Quote
What is the best for C++?

There's no best, it depends on your requirements. The best for you might not be the best for me.
XML libraries are designed for different things: some have the smallest possible memory consumption, some provide the fastest parser, some provide a clean C++ API, some provide support for DTD, DOM, XPath, XSLT, SAX, ... The XML world is wide.
Laurent Gomila - SFML developer

danman

  • Hero Member
  • *****
  • Posts: 1121
    • View Profile
    • Email
sf::XML
« Reply #10 on: January 23, 2012, 10:13:38 pm »
Or libxml2, it's a C library but it's used and maintained by gnome-project, so it's quite good, and supports lots of things.
Pointilleur professionnel

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sf::XML
« Reply #11 on: January 23, 2012, 10:18:58 pm »
If you are willing you could look at other options than just XML. One of them might just take your fancy. I can't say how it is for C++ but it should be similar but when using YAML it's more or less:

Code: [Select]
# Yaml file
 - 5
 - 10
 - "Hello World!"

# Source file
array = YAML.load_file( "file.yaml" )
array[ 0 ] == 5
array[ 1 ] == 10
array[ 2 ] == "Hello World!"


NOTE: Found an C++ implementation and here's the getting started tutorial: http://code.google.com/p/yaml-cpp/wiki/Tutorial
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

raycrasher

  • Newbie
  • *
  • Posts: 24
    • View Profile
sf::XML
« Reply #12 on: January 30, 2012, 09:06:22 am »
boost::property_tree has an XML reader/writer, among others.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
sf::XML
« Reply #13 on: January 30, 2012, 09:23:34 am »
Quote from: "Groogy"
NOTE: Found an C++ implementation and here's the getting started tutorial: http://code.google.com/p/yaml-cpp/wiki/Tutorial
Looks quite interesting, thanks!
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::XML
« Reply #14 on: January 30, 2012, 09:53:14 am »
Quote
boost::property_tree has an XML reader/writer, among others

It uses the rapidxml library.
Laurent Gomila - SFML developer

 

anything