dwd / rapidxml Goto Github PK
View Code? Open in Web Editor NEWRapidXML fork; XML namespacing, per-element parsing, etc
License: Other
RapidXML fork; XML namespacing, per-element parsing, etc
License: Other
At least one cast (and possible others) will cause "increases required alignment of target type [-Werror=cast-alig]" when compiling on ARM/RaspberryPi.
I saw the error in line 672: header *new_header = reinterpret_cast<header *>(pool);
With gcc, I change to:
// __builtin_assume_aligned is a GCC directive; this paper -
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0886r0.pdf
// - outlines the directives for some other compilers. Looks
// like we can use std::assume_aligned from C++2020 onwards:
// https://en.cppreference.com/w/cpp/memory/assume_aligned
header *new_header = reinterpret_cast<header *>(__builtin_assume_aligned(pool, RAPIDXML_ALIGNMENT));
That made my code compile.
I imagine there may be other places where __builtin_assume_aligned is needed in rapidxml.hpp
GCC 6.1 (and Clang) complained about typename keyword in node_iterator and attribute_iterator typedefs. Removing typename fix the problem.
Pull Request:
#6
Using exceptions is the only way to parse xml and have it not crash the program on a formatting error. So if we can't use exceptions, rapidxml becomes unusable if you want to gracefully handle bad formatting.
The usage of a globally linked error handler is also problematic, multiple places in the code using rapidxml w/o exceptions will cause linking problems, and it requires workarounds to wrap the #include <rapidxml.hpp> in a namespace so multiple error handlers can be provided.
Ideally a function pointer object could be provided to rapidxml that would allow us to do our own exception handling, that could contain user data where we can map to our own local information, so the filename and such can be printed in a thread-safe manner.
error parsing xml word document inside the zip
doc.zip
Hi all,
I found the following issue: I am parsing my XML as following
vector xml_copy(input_xml.begin(), input_xml.end());
xml_copy.push_back('\0');
xml_document<> doc;
doc.parse<parse_declaration_node>(&xml_copy[0]); // just get the XML declaration
By doing so, I am able to see all my object as well with the CDATA, but if I try to modify some value with the value() method, then only the print() method does not reflect it. However, at node level using the value() method the changes seems to be taken.
I found this issue working at the python binding at the following repository:
https://github.com/Arzaroth/python_rapidxml
Moreover, in the following link I found the following information:
http://www.setnode.com/blog/quick-notes-on-how-to-use-rapidxml/
// we are choosing to parse the XML declaration
// parse_no_data_nodes prevents RapidXML from using the somewhat surprising
// behavior of having both values and data nodes, and having data nodes take
// precedence over values when printing
// >>> note that this will skip parsing of CDATA nodes <<<
doc.parse<parse_declaration_node | parse_no_data_nodes>(&xml_copy[0]);
// alternatively, use one of the two commented lines below to parse CDATA nodes,
// but please note the above caveat about surprising interactions between
// values and data nodes (also read http://www.setnode.com/blog/a-rapidxml-gotcha/)
// if you use one of these two declarations try to use data nodes exclusively and
// avoid using value()
//doc.parse<parse_declaration_node>(&xml_copy[0]); // just get the XML declaration
//doc.parse<parse_full>(&xml_copy[0]); // parses everything (slowest)
Currently, I do not need to generate an XML using the parse_declaration_node, therefore I am not going to work on it straight after. However, I guess I might be nice to fix this misbehavior.
Regards,
Amedeo
Could you add a quick README with build instructions?
I tried copying rapidxml.hpp
into test/
and running:
gcc -std=c++11 simple.cpp
but I get many errors like this:
/tmp/ccDIYmHD.o: In function `main':
simple.cpp:(.text+0xd2): undefined reference to `std::allocator<char>::allocator()'
simple.cpp:(.text+0xed): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
This is with gcc 4.7.3 on Ubuntu. Does it require a 4.8 gcc?
Thanks!
Hi,
I am using rapidxml in my project. it is working fine with small files but once the file size increases more then 65KB then searching first node gives segmentation fault error
GCC 6.1.1 complained about ptrdiff_t in xmlns_lookup. Changing it to std::ptrdiff_t resolved the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.