1

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() ?

1
  • Remember to always add a language tag like c++ to get a wider audience to your question. Commented Jun 2, 2021 at 13:19

1 Answer 1

6

The xml_node class has a logical bool operator overload that allows you to check that it exists by simply calling

if (child) { ... }

and similarly an operator! for checking if it doesn't exist with

if (!child) { ... }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.