Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Examples please #189

Open
hhirsch opened this issue Jul 9, 2014 · 6 comments
Open

More Examples please #189

hhirsch opened this issue Jul 9, 2014 · 6 comments

Comments

@hhirsch
Copy link

hhirsch commented Jul 9, 2014

More examples please especially how to go through something like all the items of a list.

@ghost
Copy link

ghost commented Aug 4, 2014

your question is rather vague...
but, you might be looking for:

for(tinyxml2::XMLElement* node=doc.FirstChildElement( "Root" )->FirstChildElement("InsideRoot");
node;
node=node->NextSiblingElement("InsideRoot")){
        //do something
}

@hhirsch
Copy link
Author

hhirsch commented Aug 4, 2014

Hello,

using the library is not the problem. I don't get it set up. I am using cmake and using libxml is straight forward but with libxml2 the inclusion or the linking does not work. I don't remember correctly. It has been too long.

Regards
Henry

@ghost
Copy link

ghost commented Aug 4, 2014

add_library(mylib STATIC include/tinyxml2.cpp)
add_executable(main src/main.cpp)
target_link_libraries(main mylib)

You don't have to do a Static library, you can of course do shared...

@hhirsch
Copy link
Author

hhirsch commented Aug 4, 2014

Thanks. How do I include the headers in the C++ files?

@leethomason
Copy link
Owner

Also, if it works for you, I still maintain that the easiest way to use TinyXML-2 is not as a library, but simply add the tinyxml2.cpp file directly into your project and just compile it with the rest of your code.

@ghost
Copy link

ghost commented Aug 4, 2014

I actually lump it in with all my libraries and make one big static library containing everything, but I want to eventually use the system libraries, though something didn't work right (i think GetText() was broken) so I just put it in with everything else.
Do you help maintain the Debian/Ubuntu libraries, or is it something someone else does?
p.s. thanks for making easy XML tools!
@hhirsch
I am not entirely sure what you mean...
do you mean:

#include "path/to/tinyxml2.h"

or are you asking about including things in a CmakeLists.txt file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants