change attributes operation

ptoegel
Posts: 2
Joined: Wed Nov 25, 2020 3:50 pm

change attributes operation

Post by ptoegel »

Hi,

i am building an oxygen framework to annotate xml files using the TEI-namespace. In the author mode i created an action to use the ChangeAttributesOperation (screenshot), but i can't figure out how. I always get the error "The attribute name is not valid XML" (translated from German, see photo). I tried without ", with ' around the namespace and attribute name and several other options.

Code:
({"http://www.tei-c.org/ns/1.0"}ref)
({"http://www.tei-c.org/ns/1.0"}corresp)
({"http://www.tei-c.org/ns/1.0"}when)

Regards,

Philipp
errorMessage.PNG
errorMessage.PNG (69.76 KiB) Viewed 5479 times
changeAttributeOperation.png
changeAttributeOperation.png (110.59 KiB) Viewed 5479 times
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: change attributes operation

Post by Radu »

Hi,

Usually XML attributes are in no namespace, even if XML elements themselves are in a namespace.
So for your case you simply need to write:

Code: Select all

ref
corresp
when
https://en.wikipedia.org/wiki/XML_namespace
Attributes are never subject to the default namespace. An attribute without an explicit namespace prefix is considered not to be in any namespace.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
ptoegel
Posts: 2
Joined: Wed Nov 25, 2020 3:50 pm

Re: change attributes operation

Post by ptoegel »

Hi,

thank you very much. I was mislead by the information in the desciption of the argument, suggesting the use of a namespace:

"The names of the attributes to change/insert/remove, each on a new line. The provided values can be local names or Clark notations ({attribute_namespace}attibute_name)."

Regards,

Philipp
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: change attributes operation

Post by Radu »

Hi Philipp,

Right, I will correct the description of the parameter, the clark notation should be inserted directly as {namespace}name and not with extra () parenthesis around it.
But in the case of TEI almost all TEI attributes are in no namespace, they do not have an explicit namespace (as they do not inherit the namespace of the TEI elements).
There are only a couple of attributes which are namespaced and they all have prefixes like "xml:space". If you will ever want to set value for the "xml:*" attributes in TEI the clark notations will be for example {http://www.w3.org/XML/1998/namespace}space because according to the XML specification the "xml" prefix is always bound to the ttp://www.w3.org/XML/1998/namespace namespace.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply