Skip to content

thinkstore/XmlParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XmlParser

Single header , unofficial xml parser for easy to use compatible with C++11

#include "XmlParser.hpp"

using namespace ez;

int main( int argc , char* argv[] ) {

	try {

		XmlTag tag = XmlTag::Parse(" < tag key = val  key2=val2>"
						" data "
						"< tag2 key = val  key2=val2>"
						  "inner data"
						"</tag2>extra"
					     "< / tag > ");

		if (tag["key"] != "val")
			return 1;

		if (tag["key2"] != "val2")
			return 1;

		if (tag.GetData() != " data extra")
			return 1;


		XmlTag tag2 = tag.GetChild("tag2");
		if (tag2["key"] != "val")
			return 1;

		if (tag2["key2"] != "val2")
			return 1;

		if (tag2.GetData() != "inner data")
			return 1;

	}
	catch (std::exception& e) {
		std::cout << e.what() << std::endl;
		return 1;
	}

	return 0;

}

About

Single header , unofficial xml parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published