-12

Question: XPath to select all elements with a specified name

I got here from a Google search with the same exact question. I found the top-voted answer with a try this, see if it works. There isn't any indication if it actually does or not.

I saw the answer below that confirms it does work and adds an extension on to it for how to accomplish it more.

I go to upvote the lower answer.

I discover it's a moderator-deleted answer (by a former moderator, so I can actually vote to undelete).

I see the from review comment saying it isn't good. Well, if the review had showed the other answer I think it would have gone differently.

Should it actually be undeleted? I can edit it to fix a bit of poor verbiage.

10
  • 7
    "No indication if it actually [works] or not." What do you mean? 1) It was accepted by the OP. 2) It got upvoted 61 times, with 0 downvotes. 3) The first comment, starts with "Perfect, that's exactly what I was looking for.". How much more indication do you need? And why would you vote to undelete an answer that explains how to find attributes when the question ask how to find elements? Commented Jul 12, 2023 at 1:32
  • @RobbyCornelissen: 1) I can't see accepted very well due to ada bugs in stackoverflow. 2) I see the upvotes. 3) Shouldn't the answer stand by itself? "find attributes...") wow that's a perfect example of umwelt. I already knew how to find element in immediate children, but didn't know how to recurse so I had to look up the syntax.
    – Joshua
    Commented Jul 12, 2023 at 1:39
  • 2
    The answer does stand by itself. If you have found a bug (don't know what "ada bugs" are) that prevents people from seeing the accepted mark, you should report that. Also, even though I do speak German, I have no idea what you mean by "wow that's a perfect example of umwelt". Commented Jul 12, 2023 at 1:56
  • 3
    It's an answer to a different question. I understand the argument for letting it exist if it's a common followup for the question that was actually asked... but without quality standards this site wouldn't function all that well.
    – Kevin B
    Commented Jul 12, 2023 at 1:56
  • @RobbyCornelissen: Umwelt explainxkcd.com/wiki/index.php/1037:_Umwelt ; a different original perspective results in a very different interpretation
    – Joshua
    Commented Jul 12, 2023 at 2:00
  • 2
    It doesn't read as a me too answer to me, but as an addition to the accepted answer. But as @KevinB mentioned, the answer doesn't answer the question, but a closely related one. Commented Jul 12, 2023 at 6:29
  • @Robby By "ada bugs" they presumably mean "ADA", as in, accessibility issues with the page, that apparently prevent or inhibit conveying which answer is accepted to OP's accessibility tools (like a screen reader, for example).
    – zcoop98
    Commented Jul 12, 2023 at 15:13
  • @ayhan: Done...
    – Joshua
    Commented Jul 12, 2023 at 16:11
  • 2
    @Joshua Editing an attempt to answer into someone else's "answer" post that doesn't already have an attempt to answer the actual question and which was deleted, both from review and by a moderator when the user edited it and undeleted it without adding an attempt to answer the actual question doesn't seem useful.
    – Makyen Mod
    Commented Jul 12, 2023 at 17:28
  • 2
    If the information in that answer is useful, then it should be put as an answer to a question that actually asks a question about that, so that other people can find it, and not just be shoehorned into an answer on a question which is marginally related, but definitely not asking about it.
    – Makyen Mod
    Commented Jul 12, 2023 at 17:34

1 Answer 1

10

No, it should not be undeleted, because it doesn't answer the original question. The question clearly asks (highlighting mine):

I have a node handed to my function, from somewhere deep inside an XML document, and I want to select all descendant elements of this node that have a specific name [...]

The deleted answer that you seem to consider to be "the best answer" starts off with (again, highlighting mine):

I was looking for something similar, but wanted only the values of a certain attribute of all descendent nodes.

In XML, elements and attributes are two different node types, and as such the deleted answer does not answer the question.

As you argue in your comment:

Shouldn't the answer stand by itself?

Indeed. And this answer does not. It was correctly flagged by review and deleted by a moderator. You even admit as much in your question as you suggest that review might have gone differently if the other answer had been shown alongside the flagged one, indicating the need for context.

As for your reasoning that an accepted answer, with 61 upvotes and no downvotes, and a comment from the OP starting with "Perfect, that's exactly what I was looking for", somehow doesn't provide any indication that the proposed solution actually works... What more do you need? Insisting that all working answers are actually followed up with additional answers confirming that they work, is completely at odds with the intended usage of Stack Overflow.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .