XPath doesn't match when desired element contains child elements?XPath - Find elements by attribute namespaceRegEx match open tags except XHTML self-contained tagsXPath to select element based on childs child valueXML element has namespace, my XPATH does not workXSLT generated SVG with right namespaceCannot query using XPath when data element has attribute **xmlns=“…”**Selenium XPath “[@value]” Doesn't Match Element With ValueSelenium cannot find Xpath when “xmlns” attribute is includedUnable to determine the XPATH used with nested SVG elements that do not contain IDsHow to create a valid svg element with javascript
Why is getting a PhD considered "financially irresponsible"?
How were medieval castles built in swamps or marshes without draining them?
Can I get a PhD for developing an educational software?
How to say "I only speak one which is English." in French?
How much does Commander Data weigh?
How many birds in the bush?
What stops you from using fixed income in developing countries?
"There were either twelve sexes or none."
How is linear momentum conserved in case of a freely falling body?
Can you board the plane when your passport is valid less than 3 months?
Tex Quotes(UVa 272)
How to get trace to get a cylinder when I rotate a rectangle?
I don't have the theoretical background in my PhD topic. I can't justify getting the degree
Is Max Pooling and Conv used on anything else but images?
Why should a self-financing strategy be previsible?
Who was the most successful German spy against Great Britain in WWII, from the contemporary German perspective?
about to retire but not retired yet, employed but not working any more
Why is "dyadic" the only word with the prefix "dy-"?
Set orthographic view using python?
How do you capitalize agile costs with less mature teams?
Semantic difference between regular and irregular 'backen'
Is this password scheme legit?
How to read Microware OS-9 RBF Filesystem under Windows / Linux?
What are these white rings in the Undead parish?
XPath doesn't match when desired element contains child elements?
XPath - Find elements by attribute namespaceRegEx match open tags except XHTML self-contained tagsXPath to select element based on childs child valueXML element has namespace, my XPATH does not workXSLT generated SVG with right namespaceCannot query using XPath when data element has attribute **xmlns=“…”**Selenium XPath “[@value]” Doesn't Match Element With ValueSelenium cannot find Xpath when “xmlns” attribute is includedUnable to determine the XPATH used with nested SVG elements that do not contain IDsHow to create a valid svg element with javascript
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have the following XPath expression:
//a[@attribute='my-attribute']
When I have the following element in the HTML that XPath is searching, it matches as expected:
<a attribute="my-attribute">Some text</a>
But if there is an <svg>
tag under that element, XPath returns no match:
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
Why doesn't XPath match in this case? Is there a way I can modify my expression to make it match?
EDIT:
Apparently it has to do with the namespace on the <svg>
element. Using the local-name()
function makes it match in the XPath tester I'm using:
//*[local-name()='a' and @attribute='my-attribute']
However, this still doesn't match when running through Selenium WebDriver. Any idea of how to get this working with Selenium?
html xml selenium selenium-webdriver xpath
add a comment |
I have the following XPath expression:
//a[@attribute='my-attribute']
When I have the following element in the HTML that XPath is searching, it matches as expected:
<a attribute="my-attribute">Some text</a>
But if there is an <svg>
tag under that element, XPath returns no match:
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
Why doesn't XPath match in this case? Is there a way I can modify my expression to make it match?
EDIT:
Apparently it has to do with the namespace on the <svg>
element. Using the local-name()
function makes it match in the XPath tester I'm using:
//*[local-name()='a' and @attribute='my-attribute']
However, this still doesn't match when running through Selenium WebDriver. Any idea of how to get this working with Selenium?
html xml selenium selenium-webdriver xpath
Is there any specific question for us to answer or you are looking for generic ideas?
– DebanjanB
Mar 27 at 21:16
1
What is the selenium outcome with//*[local-name()='a' and @attribute='my-attribute']
when you have onlya
tag withoutsvg
.
– supputuri
Mar 27 at 21:22
1
It has nothing to do with namespaces and childsvg
element as long as you're trying to select anchor node
– JaSON
Mar 27 at 21:40
@JaSON I would have thought the same thing, but removing thexmlns
attribute from thesvg
tag causes the//a[@attribute='my-attribute']
expression to match.
– Andrew Mairose
Mar 28 at 13:07
As you can see, your problem cannot be reproduced in xpathtester.com/xpath/91e66f48ea100183e9e3b1958ceed7b5
– Alejandro
Mar 28 at 22:23
add a comment |
I have the following XPath expression:
//a[@attribute='my-attribute']
When I have the following element in the HTML that XPath is searching, it matches as expected:
<a attribute="my-attribute">Some text</a>
But if there is an <svg>
tag under that element, XPath returns no match:
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
Why doesn't XPath match in this case? Is there a way I can modify my expression to make it match?
EDIT:
Apparently it has to do with the namespace on the <svg>
element. Using the local-name()
function makes it match in the XPath tester I'm using:
//*[local-name()='a' and @attribute='my-attribute']
However, this still doesn't match when running through Selenium WebDriver. Any idea of how to get this working with Selenium?
html xml selenium selenium-webdriver xpath
I have the following XPath expression:
//a[@attribute='my-attribute']
When I have the following element in the HTML that XPath is searching, it matches as expected:
<a attribute="my-attribute">Some text</a>
But if there is an <svg>
tag under that element, XPath returns no match:
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
Why doesn't XPath match in this case? Is there a way I can modify my expression to make it match?
EDIT:
Apparently it has to do with the namespace on the <svg>
element. Using the local-name()
function makes it match in the XPath tester I'm using:
//*[local-name()='a' and @attribute='my-attribute']
However, this still doesn't match when running through Selenium WebDriver. Any idea of how to get this working with Selenium?
html xml selenium selenium-webdriver xpath
html xml selenium selenium-webdriver xpath
edited Mar 27 at 22:31
kjhughes
71.1k14 gold badges103 silver badges147 bronze badges
71.1k14 gold badges103 silver badges147 bronze badges
asked Mar 27 at 19:59
Andrew MairoseAndrew Mairose
5,7318 gold badges42 silver badges76 bronze badges
5,7318 gold badges42 silver badges76 bronze badges
Is there any specific question for us to answer or you are looking for generic ideas?
– DebanjanB
Mar 27 at 21:16
1
What is the selenium outcome with//*[local-name()='a' and @attribute='my-attribute']
when you have onlya
tag withoutsvg
.
– supputuri
Mar 27 at 21:22
1
It has nothing to do with namespaces and childsvg
element as long as you're trying to select anchor node
– JaSON
Mar 27 at 21:40
@JaSON I would have thought the same thing, but removing thexmlns
attribute from thesvg
tag causes the//a[@attribute='my-attribute']
expression to match.
– Andrew Mairose
Mar 28 at 13:07
As you can see, your problem cannot be reproduced in xpathtester.com/xpath/91e66f48ea100183e9e3b1958ceed7b5
– Alejandro
Mar 28 at 22:23
add a comment |
Is there any specific question for us to answer or you are looking for generic ideas?
– DebanjanB
Mar 27 at 21:16
1
What is the selenium outcome with//*[local-name()='a' and @attribute='my-attribute']
when you have onlya
tag withoutsvg
.
– supputuri
Mar 27 at 21:22
1
It has nothing to do with namespaces and childsvg
element as long as you're trying to select anchor node
– JaSON
Mar 27 at 21:40
@JaSON I would have thought the same thing, but removing thexmlns
attribute from thesvg
tag causes the//a[@attribute='my-attribute']
expression to match.
– Andrew Mairose
Mar 28 at 13:07
As you can see, your problem cannot be reproduced in xpathtester.com/xpath/91e66f48ea100183e9e3b1958ceed7b5
– Alejandro
Mar 28 at 22:23
Is there any specific question for us to answer or you are looking for generic ideas?
– DebanjanB
Mar 27 at 21:16
Is there any specific question for us to answer or you are looking for generic ideas?
– DebanjanB
Mar 27 at 21:16
1
1
What is the selenium outcome with
//*[local-name()='a' and @attribute='my-attribute']
when you have only a
tag without svg
.– supputuri
Mar 27 at 21:22
What is the selenium outcome with
//*[local-name()='a' and @attribute='my-attribute']
when you have only a
tag without svg
.– supputuri
Mar 27 at 21:22
1
1
It has nothing to do with namespaces and child
svg
element as long as you're trying to select anchor node– JaSON
Mar 27 at 21:40
It has nothing to do with namespaces and child
svg
element as long as you're trying to select anchor node– JaSON
Mar 27 at 21:40
@JaSON I would have thought the same thing, but removing the
xmlns
attribute from the svg
tag causes the //a[@attribute='my-attribute']
expression to match.– Andrew Mairose
Mar 28 at 13:07
@JaSON I would have thought the same thing, but removing the
xmlns
attribute from the svg
tag causes the //a[@attribute='my-attribute']
expression to match.– Andrew Mairose
Mar 28 at 13:07
As you can see, your problem cannot be reproduced in xpathtester.com/xpath/91e66f48ea100183e9e3b1958ceed7b5
– Alejandro
Mar 28 at 22:23
As you can see, your problem cannot be reproduced in xpathtester.com/xpath/91e66f48ea100183e9e3b1958ceed7b5
– Alejandro
Mar 28 at 22:23
add a comment |
1 Answer
1
active
oldest
votes
You may be confused by how the XPath hosting environment is presenting the selected a
elements.
Adding an svg
element to the a
element will not affect what's selected by
//a[@attribute='my-attribute']
In the case of
<a attribute="my-attribute">Some text</a>
the a
element has a string value consisting of more than just white space characters, but with
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
the a
element has a string value that consists only of whites space, so for text results of the selection, you wouldn't see anything selected.
If you evaluate count(//a[@attribute='my-attribute'])
, you'll likely see the same results for both cases.
From a generic perspective this answer should address OP's concerns.
– DebanjanB
Mar 28 at 6:13
@kjhughes I'm not trying to select the text of thea
element. I'm trying to select thea
element itself. Adding thesvg
element on its own doesn't affect what is selected by the//a[@attribute='my-attribute']
, but it is thexmlns
attribute on thesvg
element. Removing thexmlns
attribute causes the xpath expression to match thea
tag, but with thexmlns
on thesvg
element, the expression yields no results.
– Andrew Mairose
Mar 28 at 13:03
Adding ansvg
element does affect what's selected by that expression if thesvg
element has axmlns
attribute. I have verified this in an XPath tester. That is the entire reason for me asking this question.
– Andrew Mairose
Mar 28 at 13:11
No, that would not happen. You've omitted some important detail, and the burden is on you to provide a true minimal reproducible example that exhibits the impossible results you're describing. You will likely find your mistake in the course of producing such an MCVE because you won't be able to construct a complete and verifiable example that behaves as you describe.
– kjhughes
Mar 28 at 13:19
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385520%2fxpath-doesnt-match-when-desired-element-contains-child-elements%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You may be confused by how the XPath hosting environment is presenting the selected a
elements.
Adding an svg
element to the a
element will not affect what's selected by
//a[@attribute='my-attribute']
In the case of
<a attribute="my-attribute">Some text</a>
the a
element has a string value consisting of more than just white space characters, but with
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
the a
element has a string value that consists only of whites space, so for text results of the selection, you wouldn't see anything selected.
If you evaluate count(//a[@attribute='my-attribute'])
, you'll likely see the same results for both cases.
From a generic perspective this answer should address OP's concerns.
– DebanjanB
Mar 28 at 6:13
@kjhughes I'm not trying to select the text of thea
element. I'm trying to select thea
element itself. Adding thesvg
element on its own doesn't affect what is selected by the//a[@attribute='my-attribute']
, but it is thexmlns
attribute on thesvg
element. Removing thexmlns
attribute causes the xpath expression to match thea
tag, but with thexmlns
on thesvg
element, the expression yields no results.
– Andrew Mairose
Mar 28 at 13:03
Adding ansvg
element does affect what's selected by that expression if thesvg
element has axmlns
attribute. I have verified this in an XPath tester. That is the entire reason for me asking this question.
– Andrew Mairose
Mar 28 at 13:11
No, that would not happen. You've omitted some important detail, and the burden is on you to provide a true minimal reproducible example that exhibits the impossible results you're describing. You will likely find your mistake in the course of producing such an MCVE because you won't be able to construct a complete and verifiable example that behaves as you describe.
– kjhughes
Mar 28 at 13:19
add a comment |
You may be confused by how the XPath hosting environment is presenting the selected a
elements.
Adding an svg
element to the a
element will not affect what's selected by
//a[@attribute='my-attribute']
In the case of
<a attribute="my-attribute">Some text</a>
the a
element has a string value consisting of more than just white space characters, but with
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
the a
element has a string value that consists only of whites space, so for text results of the selection, you wouldn't see anything selected.
If you evaluate count(//a[@attribute='my-attribute'])
, you'll likely see the same results for both cases.
From a generic perspective this answer should address OP's concerns.
– DebanjanB
Mar 28 at 6:13
@kjhughes I'm not trying to select the text of thea
element. I'm trying to select thea
element itself. Adding thesvg
element on its own doesn't affect what is selected by the//a[@attribute='my-attribute']
, but it is thexmlns
attribute on thesvg
element. Removing thexmlns
attribute causes the xpath expression to match thea
tag, but with thexmlns
on thesvg
element, the expression yields no results.
– Andrew Mairose
Mar 28 at 13:03
Adding ansvg
element does affect what's selected by that expression if thesvg
element has axmlns
attribute. I have verified this in an XPath tester. That is the entire reason for me asking this question.
– Andrew Mairose
Mar 28 at 13:11
No, that would not happen. You've omitted some important detail, and the burden is on you to provide a true minimal reproducible example that exhibits the impossible results you're describing. You will likely find your mistake in the course of producing such an MCVE because you won't be able to construct a complete and verifiable example that behaves as you describe.
– kjhughes
Mar 28 at 13:19
add a comment |
You may be confused by how the XPath hosting environment is presenting the selected a
elements.
Adding an svg
element to the a
element will not affect what's selected by
//a[@attribute='my-attribute']
In the case of
<a attribute="my-attribute">Some text</a>
the a
element has a string value consisting of more than just white space characters, but with
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
the a
element has a string value that consists only of whites space, so for text results of the selection, you wouldn't see anything selected.
If you evaluate count(//a[@attribute='my-attribute'])
, you'll likely see the same results for both cases.
You may be confused by how the XPath hosting environment is presenting the selected a
elements.
Adding an svg
element to the a
element will not affect what's selected by
//a[@attribute='my-attribute']
In the case of
<a attribute="my-attribute">Some text</a>
the a
element has a string value consisting of more than just white space characters, but with
<a attribute="my-attribute">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
viewBox="0 0 24 24" focusable="false"></svg>
</a>
the a
element has a string value that consists only of whites space, so for text results of the selection, you wouldn't see anything selected.
If you evaluate count(//a[@attribute='my-attribute'])
, you'll likely see the same results for both cases.
edited Mar 27 at 22:40
answered Mar 27 at 22:30
kjhugheskjhughes
71.1k14 gold badges103 silver badges147 bronze badges
71.1k14 gold badges103 silver badges147 bronze badges
From a generic perspective this answer should address OP's concerns.
– DebanjanB
Mar 28 at 6:13
@kjhughes I'm not trying to select the text of thea
element. I'm trying to select thea
element itself. Adding thesvg
element on its own doesn't affect what is selected by the//a[@attribute='my-attribute']
, but it is thexmlns
attribute on thesvg
element. Removing thexmlns
attribute causes the xpath expression to match thea
tag, but with thexmlns
on thesvg
element, the expression yields no results.
– Andrew Mairose
Mar 28 at 13:03
Adding ansvg
element does affect what's selected by that expression if thesvg
element has axmlns
attribute. I have verified this in an XPath tester. That is the entire reason for me asking this question.
– Andrew Mairose
Mar 28 at 13:11
No, that would not happen. You've omitted some important detail, and the burden is on you to provide a true minimal reproducible example that exhibits the impossible results you're describing. You will likely find your mistake in the course of producing such an MCVE because you won't be able to construct a complete and verifiable example that behaves as you describe.
– kjhughes
Mar 28 at 13:19
add a comment |
From a generic perspective this answer should address OP's concerns.
– DebanjanB
Mar 28 at 6:13
@kjhughes I'm not trying to select the text of thea
element. I'm trying to select thea
element itself. Adding thesvg
element on its own doesn't affect what is selected by the//a[@attribute='my-attribute']
, but it is thexmlns
attribute on thesvg
element. Removing thexmlns
attribute causes the xpath expression to match thea
tag, but with thexmlns
on thesvg
element, the expression yields no results.
– Andrew Mairose
Mar 28 at 13:03
Adding ansvg
element does affect what's selected by that expression if thesvg
element has axmlns
attribute. I have verified this in an XPath tester. That is the entire reason for me asking this question.
– Andrew Mairose
Mar 28 at 13:11
No, that would not happen. You've omitted some important detail, and the burden is on you to provide a true minimal reproducible example that exhibits the impossible results you're describing. You will likely find your mistake in the course of producing such an MCVE because you won't be able to construct a complete and verifiable example that behaves as you describe.
– kjhughes
Mar 28 at 13:19
From a generic perspective this answer should address OP's concerns.
– DebanjanB
Mar 28 at 6:13
From a generic perspective this answer should address OP's concerns.
– DebanjanB
Mar 28 at 6:13
@kjhughes I'm not trying to select the text of the
a
element. I'm trying to select the a
element itself. Adding the svg
element on its own doesn't affect what is selected by the //a[@attribute='my-attribute']
, but it is the xmlns
attribute on the svg
element. Removing the xmlns
attribute causes the xpath expression to match the a
tag, but with the xmlns
on the svg
element, the expression yields no results.– Andrew Mairose
Mar 28 at 13:03
@kjhughes I'm not trying to select the text of the
a
element. I'm trying to select the a
element itself. Adding the svg
element on its own doesn't affect what is selected by the //a[@attribute='my-attribute']
, but it is the xmlns
attribute on the svg
element. Removing the xmlns
attribute causes the xpath expression to match the a
tag, but with the xmlns
on the svg
element, the expression yields no results.– Andrew Mairose
Mar 28 at 13:03
Adding an
svg
element does affect what's selected by that expression if the svg
element has a xmlns
attribute. I have verified this in an XPath tester. That is the entire reason for me asking this question.– Andrew Mairose
Mar 28 at 13:11
Adding an
svg
element does affect what's selected by that expression if the svg
element has a xmlns
attribute. I have verified this in an XPath tester. That is the entire reason for me asking this question.– Andrew Mairose
Mar 28 at 13:11
No, that would not happen. You've omitted some important detail, and the burden is on you to provide a true minimal reproducible example that exhibits the impossible results you're describing. You will likely find your mistake in the course of producing such an MCVE because you won't be able to construct a complete and verifiable example that behaves as you describe.
– kjhughes
Mar 28 at 13:19
No, that would not happen. You've omitted some important detail, and the burden is on you to provide a true minimal reproducible example that exhibits the impossible results you're describing. You will likely find your mistake in the course of producing such an MCVE because you won't be able to construct a complete and verifiable example that behaves as you describe.
– kjhughes
Mar 28 at 13:19
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385520%2fxpath-doesnt-match-when-desired-element-contains-child-elements%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is there any specific question for us to answer or you are looking for generic ideas?
– DebanjanB
Mar 27 at 21:16
1
What is the selenium outcome with
//*[local-name()='a' and @attribute='my-attribute']
when you have onlya
tag withoutsvg
.– supputuri
Mar 27 at 21:22
1
It has nothing to do with namespaces and child
svg
element as long as you're trying to select anchor node– JaSON
Mar 27 at 21:40
@JaSON I would have thought the same thing, but removing the
xmlns
attribute from thesvg
tag causes the//a[@attribute='my-attribute']
expression to match.– Andrew Mairose
Mar 28 at 13:07
As you can see, your problem cannot be reproduced in xpathtester.com/xpath/91e66f48ea100183e9e3b1958ceed7b5
– Alejandro
Mar 28 at 22:23