174 questions
2
votes
1
answer
50
views
Pugixml get full string containing whitespace
I'm trying to read an XML file with the structure
<name>search_name</name>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
...
1
vote
1
answer
52
views
How to add attribute without a value with pugixml?
How can pugixml generate an attribute without a value?
Consider the following desired html:
<option value="book" selected>book</option>
The question is about the selected ...
1
vote
1
answer
112
views
Using pugixml and OpenXLSX in the same project results in a linker error
I have a CMake&C++ project where I prepared a condensed wrapper for pugixml. This wrapper is then linked to my io.lib library and works nicely on both ubuntu-22.04 and windows-latest.
I then added ...
-2
votes
1
answer
165
views
Problems parsing XML with pugixml
Using pugixml, and C++, I can't parse the following to get Value and Result:
case #1 <Response> Value="HERE" Result="1" </Response>
Is this xml format considered ...
0
votes
1
answer
400
views
pugixml intergration in visual studio code
am trying to read an xml file in visual studio using the pugixml parser. i have downloaded the parser. but am wondering how i can link it with my c++ code. like how to configure the include ...
2
votes
2
answers
417
views
CHECK_INCLUDE_FILE_CXX doesn't find the header
I am trying to compile a project in C++ coded by other persons (Orthanc for the people that knows a bit of medical imaging) on Ubuntu 22.04.
One library needed is pugixml but CHECK_INCLUDE_FILE_CXX ...
0
votes
1
answer
215
views
Sort nodes in xml file
I'm using the pugixml library, and i try to add some content (nodes) with the fillWeek() function after sorting existing nodes in my xml file, but the problem is, when i call the sort() function, ...
0
votes
0
answers
67
views
How to count the number of nodes with a certain name using the PugiXML?
I'm using the PugiXML library in a C++ project and I have the following structure in an XML file. How can I count the number of Plan nodes?
<Profiles>
<Plan>
<Name>Foo<...
0
votes
0
answers
160
views
InitInstance(): pugixml corrupts my this pointer
I have an x64 MFC application (VS2019, fresh project from the wizard and filled with lots of old project code). Debug build is working fine but the project has a problem to start up in the Release ...
2
votes
1
answer
3k
views
How to construct a zip file with libzip
I try to create a compressed file and insert an xml file in it using two libraries (pugixml / libzip), everything goes without error, but when I open the xml file, the encoding at the beginning of the ...
0
votes
0
answers
373
views
Using pugixml to read an entire xml file
I know there's already a way to loop through a file with pugi::xml_node::traverse, but I'm very interested in how things work, so I want to reimplement it using a recursive function.
Currently, I can ...
0
votes
1
answer
2k
views
Could not find CMake package configuration file for "PugiXml"
I am trying to build a tool from a git repo and after executing "cmake .." I get the following error:
Could not find a package configuration file provided by "PugiXml" with any
of ...
0
votes
1
answer
426
views
Why is the data parsed by pugixml lost in another function?
I have 2 functions:
void XMLParser::ParseScene(const char* path)
{
// Load the XML file
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file(path);
scene = doc.child(&...
0
votes
1
answer
467
views
C++ Best way to search/traverse/replace multiple tags with pugixml?
I have to replace in multiple template_xml multiple tags to build some web services requests. While with pugixml i can access a tag like this doc.child("tag1").child("tag2").etc i ...
0
votes
0
answers
551
views
c++ pugiXML save_file not working as expected
I'm using pugiXML to write to XML.
This is demo:
//--open file
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file(filePath.c_str());
//--add node
pugi::xml_node nodeEventLogger = ...
0
votes
1
answer
727
views
Cmake and PugiXML in Github Actions
i try to get pugixml running in github actions. And i would be happy with any solution that is working...
I added the download to the cmake.yml
run: sudo apt-get update && sudo apt-get ...
1
vote
1
answer
3k
views
pugixml - check if node exists or not
I get a child node this way:
pugi::xml_node child = root.child("aaa")
I would like to check if that child node exists. Should I just call child.empty() ?
0
votes
1
answer
2k
views
pugixml - iterating over specific nodes
I have a xml document with a node which has children nodes but I want to iterate over specific nodes which names are stored in the array, for example:
const char* childrenNodes[]={"childNodeA&...
0
votes
1
answer
4k
views
C++ convert JSON to XML
I am trying to find a way to convert JSON string to XML document. For this we have evaluated PICOJSON to parse JSON and Pugixml to generate the XML document.
I know this is way easy in .Net and JAVA. ...
-1
votes
1
answer
513
views
How to Parse the XML structure data in CPP while going and accessing each node?
I'm very new to XML parse in C++. I want to parse the XML. So, I'm using the PugiXML library. I mainly want to get the values from each of the children nodes.
Here, is the sample code till here I have ...
0
votes
1
answer
146
views
Can I set the child of an object to be an object defined separetely in PugiXML?
I want to configure a device using an XML file and was thinking that I can make the individual pugi::xml_nodes first with the values I need and later on make them children of a document or some parent ...
0
votes
0
answers
121
views
pugixml for CentOS7 32bit
sorry in advance if the question is a trivial one.
I have a 32-bit machine running CentOS7, and I would need to install the pugixml package (v >= 1.0); so far, I didn't manage to (the standard sudo ...
1
vote
0
answers
556
views
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++)
{
...
0
votes
1
answer
369
views
How do i pass a char into find_child_by_attribute for pugixml
i'm trying to pass a value from a file into tileNode.find_child_by_attribute("tileset","firstgid",container[0]).attribute("source").as_string(). it should return a string for an image path.
#include ...
1
vote
1
answer
488
views
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 ...
1
vote
2
answers
2k
views
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):
<?xml version="1.0"?>
<MyConfig>
<MyData>
<Foo bar="baz>42</Foo&...
1
vote
1
answer
1k
views
Add XML contained in string as XML nodes to existing pugixml tree
I have a configuration file saver/loader. In addition to the expected data, there is a <CustomData> node. When saving the node, we'd simply have a std::string _customData and add it to the node, ...
0
votes
1
answer
376
views
How to loop n times, one level per loop in an xml file
This is something that I feel should be easy, but after many hours I still can't figure it out. I tried googling it but it would seem the only way my brain wants to ask the question is in 3 lines of ...
0
votes
1
answer
3k
views
How can I have multiple node applications on nodejs server?
I am trying to merge two (or more) nodejs apps. 1st is login application that takes you to your dashboard. When you are there you should see another app that is dedicated to you, that runs on ...
1
vote
1
answer
135
views
pugixml getting same address for all the children at the same level
we are seeing that the address of all the children at the same level are the same, this is hurting our logic as we want to store the addresses of xml nodes for later processing. here is the sample ...
0
votes
2
answers
2k
views
How to correctly access xml attributes using pugixml?
I'm new to xml, and using the pugixml documentation I haven't been able to read a node attribute to the console. The core of the issue is that I don't understand how the node accessing structure works ...
1
vote
1
answer
3k
views
pugixml include dir set to not found from pugixml config cmake files
I am trying to compile this project: https://github.com/computationalpathologygroup/ASAP.git from source.
Pugixml is a dependency
I have built pugixml from source and set PugiXML_DIR and ...
0
votes
1
answer
205
views
can't get attribute's name and value while parsing xml
I have got a non empty pugi::xml_node my_node;.
If I print it with my_node.print(std::cout); I can clearly see that the contents of this node are okay.
Let's say it's:
<my_class id="0" name="my ...
1
vote
2
answers
200
views
How to write a generic templated wrapper for type specific acess functions?
I'm trying to write a generic wrapper for the C++ pugi xml library that can save and store values to/from xml.
They have implemented their xml node attributes' (stored as strings) access functions ...
1
vote
1
answer
573
views
Pass variable to PUGIXML xml_tree_walker
I am using pugixml to parse a file. I have been using an xml_tree_walker and I have a variable I want to modify as the walker walks through the xml. I am currently using a global variable but don't ...
0
votes
1
answer
300
views
Parsing XML file in cprogram for particular element
currently im working in parsing xml by c and c++
im using pugixml library in c++ and libxml2 library in c for parsing xml
assume i have root element in xml as "configuration" and it have 4 child ...
3
votes
1
answer
1k
views
Removing child node in a XML file C++
I am using PugiXml library for XML related operations.
My XML File:
<CurrentStatus>
<Time Stamp= "12:30">
<price>100</price>
<amount>1</amount>...
-3
votes
1
answer
95
views
Get the value of a random parameter in pugixml
I have a question regarding the extraction of parameter values from an xml file using pugixml. I have an XML file with a hierarchical structure, and would like to retrieve the value associated with a ...
0
votes
1
answer
792
views
How to load XML file from url with pugixml
I'm trying to load an XML file from an URL using pugixml parser. The problem is that if you want to load a file from URL you have to load it from memory which it's very confusing for me. This is what ...
0
votes
1
answer
479
views
Deleting a node based on child value in Pugixml
What I have so far can delete all the children of the actual node I want to delete but not the node itself.
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file("config/config.xml");
...
0
votes
1
answer
95
views
Simple XPath program doesn't work
XML file tree.xml:
<?xml version="1.0"?>
<mesh name="mesh_root">
some text
<![CDATA[someothertext]]>
some more text
<node attr1="value1" attr2="value2" />
&...
0
votes
0
answers
392
views
Array representation in XML
I have an XML node that I want to represent two integer values and an integer array. I have chosen to do it like this:
<MyNode a="4" b="8">
<c_array>
<c_value>"1"</...
1
vote
1
answer
276
views
Compress data from pugixml
I'm trying to compress data from a pugi::xml_document. This is what I tried :
template<class T> void save(const T &object, const QString &path)
{
pugi::xml_document doc;
object....
2
votes
1
answer
4k
views
CMake and pugixml
I am new to CMake and having trouble understanding how to use it.
I have a cross-platform c++ project. It builds using CMake and my CMakeLists.txt lives in a folder called MyProject along with the ...
0
votes
2
answers
2k
views
C++ serialize an object list to XML with for loop
I have an object list and wanna serialize it to xml. My object is:
struct PingLogDto
{
int PingLogID;
int HardwareHostID;
std::string PingLogRoundtripTime;
};
And here i make my list ...
0
votes
1
answer
1k
views
Pugi XML: How to set the precision for float numbers
I use pugi::XML parser and i want to set the precision for the floating point numbers. I have already used the rounding function on the float variable, but while printing with pugi::xml, it is printed ...
0
votes
1
answer
950
views
PugiXML extracting data from recursive xml_tree_walker
I'm trying to extract data from an XML that looks as shown in the image below using pugiXML traverse function. i'm able to print out all the data from the XML file using this function, however im not ...
0
votes
1
answer
476
views
How do I avoid `already defined` linking error with pugixml if two static libs contain pugixml objs?
So I have 2 static libs defined like this:
StaticLib1
// StaticLib1.h
#pragma once
class StaticLib1
{
public:
void doSomething1();
};
cpp:
// StaticLib1.cpp
#include "pugixml.hpp"
#include "...
2
votes
1
answer
536
views
Reading a list of xml nodes causes segmentation fault
I try to develop a package system for a game server engine i use, so, upon start i read a XML file and add the nodes to a list so i can use later. I can read the list after i created it, in same ...
1
vote
1
answer
540
views
Change a node to be a comment node
I have a reference to an xml_node. Is there a way to change it to be a comment type node (node_comment)? Essentially to comment the node out.