# XPath attribute with colon fails to validate

**URL:** <https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699>\
**Category:** KNIME Analytics Platform\
**Created:** [August 14, 2023, 1:06pm UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699 "2023-08-14T13:06:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwiegand](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mwiegand/32/66896_2.png) [@mwiegand](https://forum.knime.com/u/mwiegand)\
**Post date:** [August 14, 2023, 1:06pm UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699/1 "2023-08-14T13:06:56Z")

</div>

Hi,

while working on XMP Meta Data I noticed that the XPath node fails to validate the XPath which references an attribute with a colon. Interestingly, the XPath actually the one which the node suggests to use, though:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/6/e/6e055f112020c14d05e93ca16094c9b47f73900f.png)

Here is the test workflow. Please note that I have NOT tested other characters which should, theoretically, be valid to use!

> **[XPath attribute with colon fails to validate – mwiegand](https://hub.knime.com/mwiegand/spaces/Public/latest/Bugs/XPath%20attribute%20with%20colon%20fails%20to%20validate~AhPlvPI4Ajdr9FpM)**
>
> Solutions for data science: find workflows, nodes and components, and collaborate in spaces.

Best  
Mike

---

<div class="post-metadata">

**Author:** ![armingrudd](https://forum-cdn.knime.com/user_avatar/forum.knime.com/armingrudd/32/84633_2.png) [@armingrudd](https://forum.knime.com/u/armingrudd)\
**Post date:** [August 16, 2023, 12:08pm UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699/2 "2023-08-16T12:08:29Z")

</div>

Hi @mwiegand,

To get the value of the attribute with a colon, you can use `@*[name()='<attribute:name>']`. e.g.:  
`/rdf:Description/@*[name()='aux:Firmware']`

> <https://stackoverflow.com/questions/10894696/how-to-retrieve-value-of-an-attribute-which-contains-colon-in-the-attribute-name>

---

<div class="post-metadata">

**Author:** ![mwiegand](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mwiegand/32/66896_2.png) [@mwiegand](https://forum.knime.com/u/mwiegand)\
**Post date:** [August 16, 2023, 3:51pm UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699/3 "2023-08-16T15:51:45Z")

</div>

Yes, that is the „fallback“ approach I integrated in my example workflow. I was under the impression, since a colon is supported in the path declaration for leaves, it‘s a bug.

---

<div class="post-metadata">

**Author:** ![armingrudd](https://forum-cdn.knime.com/user_avatar/forum.knime.com/armingrudd/32/84633_2.png) [@armingrudd](https://forum.knime.com/u/armingrudd)\
**Post date:** [August 16, 2023, 5:15pm UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699/4 "2023-08-16T17:15:51Z")

</div>

Yes, I didn’t notice the “fallback” in your workflow and I think it’s a good idea to share it with the community.

I’ll discuss this internally and will come back to you soon.

---

<div class="post-metadata">

**Author:** ![armingrudd](https://forum-cdn.knime.com/user_avatar/forum.knime.com/armingrudd/32/84633_2.png) [@armingrudd](https://forum.knime.com/u/armingrudd)\
**Post date:** [August 17, 2023, 8:18am UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699/5 "2023-08-17T08:18:47Z")

</div>

Dear @mwiegand,

I created a ticket for the issue you have mentioned here. (AP-20866)

About the “leaves” or elements, colons are used after the namespaces. So, they are not part of the element name. The reason I have doubts not to consider this issue as a bug is the same fact that typically, colons in XML indicate namespace demarcation ([e.g.](https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/xml/names-of-declared-xml-elements-and-attributes)). Yet, as I promised, I discussed it internally and we decided to have a ticket for it and investigate it further.

---

<div class="post-metadata">

**Author:** ![mwiegand](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mwiegand/32/66896_2.png) [@mwiegand](https://forum.knime.com/u/mwiegand)\
**Post date:** [August 17, 2023, 9:01am UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699/6 "2023-08-17T09:01:45Z")

</div>

Thanks. Doesn’t the name space declaration using colons only apply for doubled colons “::”? Anyways, leaving it to you guys. Cheers and thanks again!

---

<div class="post-metadata">

**Author:** ![armingrudd](https://forum-cdn.knime.com/user_avatar/forum.knime.com/armingrudd/32/84633_2.png) [@armingrudd](https://forum.knime.com/u/armingrudd)\
**Post date:** [August 17, 2023, 9:06am UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699/7 "2023-08-17T09:06:09Z")

</div>

> [@mwiegand](#):
>
> Doesn’t the name space declaration using colons only apply for doubled colons “::”?

I don’t think so! 🙂

> **[XML Namespaces](https://www.w3schools.com/xml/xml_namespaces.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [August 24, 2023, 9:06am UTC](https://forum.knime.com/t/xpath-attribute-with-colon-fails-to-validate/71699/8 "2023-08-24T09:06:29Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
