How to find specific XML node with just attribute value [on hold]












-2












$begingroup$


If I have a (fragment of) xml like this:



<flowreferences>
<ref>123</ref>
<ref>563</ref>
<ref>902</ref>
<ref>674</ref>
<ref>295</ref>
<ref>887</ref>
<ref>371</ref>
</flowreferences>
<object1 id="123">
......
</object1>
<object1 id="563">
......
</object2>
<object2 id="887">
......
</object2>
<object3 id="674">
......
</object3>
<object4 id="295">
......
</object4>
<object5 id="907">
......
</object5>
<object6 id="371">
......
</object6>


Is there a Xpath query to return the object node given JUST the attribute value? In other words, if I know the id value (907), how do I find the object5 node?










share|improve this question







New contributor




stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as off-topic by Zeta, πάντα ῥεῖ, Sᴀᴍ Onᴇᴌᴀ, Mike Brant, Jamal 2 hours ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Zeta, πάντα ῥεῖ, Sᴀᴍ Onᴇᴌᴀ, Mike Brant, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 1




    $begingroup$
    Welcome to Code Review. Unfortunately, we don't provide code, we review code you've written. Depending on your problem, another site of the StackExchange network can help you. Please see our help center for more information.
    $endgroup$
    – Zeta
    8 hours ago










  • $begingroup$
    It would be something like //*[@*='907'], but this question really belongs on stackoverflow.com.
    $endgroup$
    – Daniel Haley
    8 hours ago












  • $begingroup$
    Thanks for the pointer, I will go there and ask
    $endgroup$
    – stoneyowl
    4 hours ago
















-2












$begingroup$


If I have a (fragment of) xml like this:



<flowreferences>
<ref>123</ref>
<ref>563</ref>
<ref>902</ref>
<ref>674</ref>
<ref>295</ref>
<ref>887</ref>
<ref>371</ref>
</flowreferences>
<object1 id="123">
......
</object1>
<object1 id="563">
......
</object2>
<object2 id="887">
......
</object2>
<object3 id="674">
......
</object3>
<object4 id="295">
......
</object4>
<object5 id="907">
......
</object5>
<object6 id="371">
......
</object6>


Is there a Xpath query to return the object node given JUST the attribute value? In other words, if I know the id value (907), how do I find the object5 node?










share|improve this question







New contributor




stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as off-topic by Zeta, πάντα ῥεῖ, Sᴀᴍ Onᴇᴌᴀ, Mike Brant, Jamal 2 hours ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Zeta, πάντα ῥεῖ, Sᴀᴍ Onᴇᴌᴀ, Mike Brant, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 1




    $begingroup$
    Welcome to Code Review. Unfortunately, we don't provide code, we review code you've written. Depending on your problem, another site of the StackExchange network can help you. Please see our help center for more information.
    $endgroup$
    – Zeta
    8 hours ago










  • $begingroup$
    It would be something like //*[@*='907'], but this question really belongs on stackoverflow.com.
    $endgroup$
    – Daniel Haley
    8 hours ago












  • $begingroup$
    Thanks for the pointer, I will go there and ask
    $endgroup$
    – stoneyowl
    4 hours ago














-2












-2








-2





$begingroup$


If I have a (fragment of) xml like this:



<flowreferences>
<ref>123</ref>
<ref>563</ref>
<ref>902</ref>
<ref>674</ref>
<ref>295</ref>
<ref>887</ref>
<ref>371</ref>
</flowreferences>
<object1 id="123">
......
</object1>
<object1 id="563">
......
</object2>
<object2 id="887">
......
</object2>
<object3 id="674">
......
</object3>
<object4 id="295">
......
</object4>
<object5 id="907">
......
</object5>
<object6 id="371">
......
</object6>


Is there a Xpath query to return the object node given JUST the attribute value? In other words, if I know the id value (907), how do I find the object5 node?










share|improve this question







New contributor




stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




If I have a (fragment of) xml like this:



<flowreferences>
<ref>123</ref>
<ref>563</ref>
<ref>902</ref>
<ref>674</ref>
<ref>295</ref>
<ref>887</ref>
<ref>371</ref>
</flowreferences>
<object1 id="123">
......
</object1>
<object1 id="563">
......
</object2>
<object2 id="887">
......
</object2>
<object3 id="674">
......
</object3>
<object4 id="295">
......
</object4>
<object5 id="907">
......
</object5>
<object6 id="371">
......
</object6>


Is there a Xpath query to return the object node given JUST the attribute value? In other words, if I know the id value (907), how do I find the object5 node?







node.js xml






share|improve this question







New contributor




stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 8 hours ago









stoneyowlstoneyowl

11




11




New contributor




stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






stoneyowl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by Zeta, πάντα ῥεῖ, Sᴀᴍ Onᴇᴌᴀ, Mike Brant, Jamal 2 hours ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Zeta, πάντα ῥεῖ, Sᴀᴍ Onᴇᴌᴀ, Mike Brant, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.







put on hold as off-topic by Zeta, πάντα ῥεῖ, Sᴀᴍ Onᴇᴌᴀ, Mike Brant, Jamal 2 hours ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Zeta, πάντα ῥεῖ, Sᴀᴍ Onᴇᴌᴀ, Mike Brant, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    $begingroup$
    Welcome to Code Review. Unfortunately, we don't provide code, we review code you've written. Depending on your problem, another site of the StackExchange network can help you. Please see our help center for more information.
    $endgroup$
    – Zeta
    8 hours ago










  • $begingroup$
    It would be something like //*[@*='907'], but this question really belongs on stackoverflow.com.
    $endgroup$
    – Daniel Haley
    8 hours ago












  • $begingroup$
    Thanks for the pointer, I will go there and ask
    $endgroup$
    – stoneyowl
    4 hours ago














  • 1




    $begingroup$
    Welcome to Code Review. Unfortunately, we don't provide code, we review code you've written. Depending on your problem, another site of the StackExchange network can help you. Please see our help center for more information.
    $endgroup$
    – Zeta
    8 hours ago










  • $begingroup$
    It would be something like //*[@*='907'], but this question really belongs on stackoverflow.com.
    $endgroup$
    – Daniel Haley
    8 hours ago












  • $begingroup$
    Thanks for the pointer, I will go there and ask
    $endgroup$
    – stoneyowl
    4 hours ago








1




1




$begingroup$
Welcome to Code Review. Unfortunately, we don't provide code, we review code you've written. Depending on your problem, another site of the StackExchange network can help you. Please see our help center for more information.
$endgroup$
– Zeta
8 hours ago




$begingroup$
Welcome to Code Review. Unfortunately, we don't provide code, we review code you've written. Depending on your problem, another site of the StackExchange network can help you. Please see our help center for more information.
$endgroup$
– Zeta
8 hours ago












$begingroup$
It would be something like //*[@*='907'], but this question really belongs on stackoverflow.com.
$endgroup$
– Daniel Haley
8 hours ago






$begingroup$
It would be something like //*[@*='907'], but this question really belongs on stackoverflow.com.
$endgroup$
– Daniel Haley
8 hours ago














$begingroup$
Thanks for the pointer, I will go there and ask
$endgroup$
– stoneyowl
4 hours ago




$begingroup$
Thanks for the pointer, I will go there and ask
$endgroup$
– stoneyowl
4 hours ago










0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?