Allow InsertAndUpdateNode to Work With Attributes and Value
Posted: April 17th, 2023, 5:18 pm
InsertAndUpdateNode is a great way for finding and editing the child of a specific node in XML, but there are no good options when dealing with attributes or values of nodes. It could be useful if InsertAndUpdateNode was expanded on to allow these cases as well.
Suggestion
Add special node names to target aspects of a node other than its children:
"text()" and "@[attribute name]" are part of the XML specification for targeting text and attribute nodes respectively.
Attribute Example
Given the following service:
An InsertAndUpdateNode can be configured like so to add a "charCount" attribute containing the character count of each node:
Suggestion
Add special node names to target aspects of a node other than its children:
- "#text" or "text()" - Sets the text value directly stored in the parent node
- "@[attribute name]" - Sets the value of an attribute with a name that matches "[attribute name]"
"text()" and "@[attribute name]" are part of the XML specification for targeting text and attribute nodes respectively.
Attribute Example
Given the following service:
An InsertAndUpdateNode can be configured like so to add a "charCount" attribute containing the character count of each node: