Added advanced removeAttributes tag

This commit is contained in:
Vhati 2017-12-11 15:54:59 -05:00
parent 93b9c9b1b0
commit d912ee10b7
2 changed files with 10 additions and 0 deletions

View file

@ -184,6 +184,10 @@ Advanced XML
<mod:setAttributes a="1" b="2" /> <mod:setAttributes a="1" b="2" />
Sets/adds one or more attributes on the context tag. Sets/adds one or more attributes on the context tag.
<mod:removeAttributes a="" b="" />
Removes one or more attributes on the context tag (the values here
will be ignored). This was introduced in SMM 1.7.
<mod:removeTag /> <mod:removeTag />
Removes the context tag entirely. Removes the context tag entirely.

View file

@ -379,6 +379,12 @@ public class XMLPatcher {
contextNode.setAttribute( attrib.clone() ); contextNode.setAttribute( attrib.clone() );
} }
} }
else if ( cmdNode.getName().equals( "removeAttributes" ) ) {
handled = true;
for ( Attribute attrib : cmdNode.getAttributes() ) {
contextNode.removeAttribute( attrib.getName() );
}
}
else if ( cmdNode.getName().equals( "setValue" ) ) { else if ( cmdNode.getName().equals( "setValue" ) ) {
handled = true; handled = true;
contextNode.setText( cmdNode.getTextTrim() ); contextNode.setText( cmdNode.getTextTrim() );