How to find specific XML node with just attribute value [on hold]
$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?
node.js xml
New contributor
$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.
add a comment |
$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?
node.js xml
New contributor
$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
add a comment |
$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?
node.js xml
New contributor
$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
node.js xml
New contributor
New contributor
New contributor
asked 8 hours ago
stoneyowlstoneyowl
11
11
New contributor
New contributor
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
add a comment |
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
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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