This content has been marked as final. Show 2 replies
I have the same error in:
If I understand at least the first case correctly you are trying to create a element from an attribute. This is not legal and the DOM implementation in 9.2.x should not have allowed this in the first place
Attribute => Node => Attribute : Legal
Attribute => Node => Element : Illegal
Element => Node => Attribute : Illegal
Element => Node => Element : Legal
If you were casting an attribute to an element what would you expect to happen to the attribute value.
If you are trying to make a element with the same name as the attribute you'll need to create a new element (createElement). Assuming you want to presever the value of the attribute you will also need to create a text node (createTextNode) and then set the value of the text node to the value of the attribute and then append the textnode to the element.
If the objective here is to convert all the attributes in a document to element a XSL or XQuery approach may be better