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

Implemented function to find sub nodes from root node #96

Merged
merged 5 commits into from
Oct 16, 2020

Conversation

jontje
Copy link
Contributor

@jontje jontje commented Sep 1, 2020

As per title.

Copy link
Member

@gavanderhoorn gavanderhoorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

High-level question: does Poco XML not support xpath queries?

include/abb_librws/rws_common.h Outdated Show resolved Hide resolved
include/abb_librws/rws_common.h Outdated Show resolved Hide resolved
src/rws_common.cpp Show resolved Hide resolved
src/rws_common.cpp Show resolved Hide resolved
@jontje
Copy link
Contributor Author

jontje commented Sep 1, 2020

High-level question: does Poco XML not support xpath queries?

Don't know, and to be honest, I haven't used xpath queries before.

I just built upon implementations I did 5-6 years ago, and I haven't look for other solutions.

Copy link
Member

@gavanderhoorn gavanderhoorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok as-is, but please take a look at the comments.

*
* \return std::vector<Poco::XML::Node*> with the children (empty if none are found, or if the root node is nullptr).
*/
std::vector<Poco::XML::Node*> xmlFindNodes(Poco::XML::Node* p_root, const XMLAttribute& attribute);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this function is not expected to change anything in p_root, then perhaps we should make it a const ptr and accept the Node also only as const?

Suggested change
std::vector<Poco::XML::Node*> xmlFindNodes(Poco::XML::Node* p_root, const XMLAttribute& attribute);
std::vector<Poco::XML::Node*> xmlFindNodes(Poco::XML::Node const* const p_root, const XMLAttribute& attribute);

I don't know whether Poco::XML::NodeIterator accepts that though.

Related question: perhaps pass a const& instead? I realise you work with pointers elsewhere, but passing const& may actually be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know whether Poco::XML::NodeIterator accepts that though.

I just tested, and it didn't accept it.

Related question: perhaps pass a const& instead? I realise you work with pointers elsewhere, but passing const& may actually be better.

I just created #103 to track this.

src/rws_common.cpp Show resolved Hide resolved
@jontje jontje merged commit 711ee67 into ros-industrial:master Oct 16, 2020
@jontje
Copy link
Contributor Author

jontje commented Oct 16, 2020

Thanks for the review @gavanderhoorn 👍

@jontje jontje deleted the find_xml_sub_nodes branch November 9, 2020 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants