Questions tagged [pugixml]

Light-weight, simple and fast XML parser for C++ with XPath support

Overview(from official website)

pugixml is a light-weight C++ XML processing library. It features:

  • DOM-like interface with rich traversal/modification capabilities
  • Extremely fast non-validating XML parser which constructs the DOM tree from an XML file/buffer
  • XPath 1.0 implementation for complex data-driven tree queries
  • Full Unicode support with Unicode interface variants and automatic encoding conversions

The library is extremely portable and easy to integrate and use.

pugixml is developed and maintained since 2006 and has many users. All code is distributed under the MIT license, making it completely free to use in both open-source and proprietary applications.

Links

170 questions
2
votes
1 answer

How to read through nodes using pugixml?

I have just downloaded the pugixml library and I am trying to adapt it to my needs. It is mostly oriented for DOM style which I am not using. The data I store looks like this:
Łukasz Przeniosło
  • 2,725
  • 5
  • 38
  • 74
2
votes
1 answer

Use pugiXML to rename nodes based on a std::map

I'm new to C++ but I am trying to define a standard set of node names and then map to them. For example my standard import / output schema is this: 1 Test However sometimes my XML…
J.Zil
  • 2,397
  • 7
  • 44
  • 78
2
votes
1 answer

failed to get values of XML elements in pugixml using node.value()

I have below simple XML template in my C++ source code. Within below code block I need to get values for and . both elements are children of pugixml document root. xml_document doc; xml_parse_result r; std::string sXml =…
Dig The Code
  • 658
  • 2
  • 15
  • 32
2
votes
0 answers

Parse file into u32strings using pugixml

I am trying to store the parsed information in std::u32strings. I see from the documentation that unicode is supported, but they only talk about wchars and wstrings. Is there a way to use u32strings instead without explicitly having to convert it…
mxdg
  • 314
  • 3
  • 14
2
votes
1 answer

Pugixml: No document element found

I'm having some trouble loading the document (see link http://pastebin.com/FE3nDX9h) in pugixml. I'm getting an error code of 16: No document element found which indicates that the XML file is invalid or empty which I think is neither. I am using…
user3102241
  • 487
  • 1
  • 7
  • 18
2
votes
1 answer

specify target with gcc

I am trying to compile a library in linux with gcc. I want the lib to run on a different platform. With configure, we normally use build and host. However, this library has no configure option. So I am writing my own code to compile lib using GCC.…
user1388142
  • 581
  • 2
  • 11
  • 26
2
votes
1 answer

pugixml error parsing document c++

I've loaded an xml document from a website. I then try to parse it with pugixml. ParseXml::parseTrainsXml(char source[]) { __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "NDK:LC: [ %s ]", source); size_t size = sizeof(source); …
Tristan
  • 342
  • 2
  • 13
2
votes
1 answer

Pugixml - parse namespace with prefix mapping and without prefix mappig

I have a client application that parses xml responses that are sent from 2 different servers. I call them server A and server B. Server A responds to one of the request with a response as below:
Sandeep
  • 1,237
  • 1
  • 14
  • 29
2
votes
2 answers

PugiXML value output encoding

I am a little confused. pugi::xml_node::value() returns string of type chart_t, which can be either wchar_t or char depends on compilation flags. In documentation to pugiXML said that it works with different types on utf family encodings. OK. I am…
dmigous
  • 167
  • 1
  • 3
  • 14
2
votes
1 answer

Saving Large XML file with PUGIXML repeatedly takes a lot of time

I have a 65Mb XML file that I am loading and modifying with PUGIXML. Problem is that I need to keep it updated and saved to disk so that other files can access. I don't want to implement a database, so is there a way for me to make modifications,…
user2125494
  • 31
  • 1
  • 3
1
vote
1 answer

pugixml node_cdata, node_pcdata set_value() invalid characters

pugixml seems to be adding invalid characters when I set the value of a node_pcdata. The code is below. What I'm trying to do is base-64 encode a PNG and send it via XML. I wrote the base-64 encoded text to a file to check it separately from…
Tomas
  • 125
  • 1
  • 10
1
vote
1 answer

Using pugixml in Visual C++ .NET 2010

I am building a GUI for my final project. This project uses pugixml as xml parser for reading some data. Everything works in console mode. So I started a new windows form project and I added all the headers files I wrote. I desgined my GUI etc.…
Oni
  • 798
  • 2
  • 8
  • 17
1
vote
0 answers

pugiXML append existing node into the document

this is my code: void SaveHandler::saveGrid(TileGrid &grid, const char * Filename, bool saveToSceneFile) { pugi::xml_node gridNode; for (int L = 0; L < grid.m_tileLayers.size(); L++) { for (int C = 0; C < grid.m_tileLayers[L].size(); C++) …
Ronald joe
  • 339
  • 2
  • 9
1
vote
1 answer

Add xml namespace to xml_document using pugixml

How can I add an xml namespace declaration to my xml_document using pugixml? I tried this, which results in a invalid xml (invalid char ":", says my validator): xml_document doc; auto declarationNode =…
nabulke
  • 11,025
  • 13
  • 65
  • 114
1
vote
2 answers

How to get inner XML of a node in pugixml?

I parse a document and want to retrieve part of the XML tree as string. The document (example):
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
1 2
3
11 12