I need to remove attributes from the node body in some parsed HTML (converted to XML).
Call attributes() on the element that contains the attribute, and then call remove('attr name') , as shown below.
attributes()
remove('attr name')
attributes().remove('attr name')
Here you can read more detailed information.
/** * Remove all attributes from the root body tag */ def removeBodyAttributes() { def attributeNames = bodyXml.attributes().collect {it.key} println attributeNames println bodyXml.attributes() attributeNames.each {bodyXml.attributes().remove(it)} println bodyXml.attributes() }
Source: https://habr.com/ru/post/904199/More articles:Getting NullPointException with Jersey REST Client on Android - androidMultiple WebViews in ScrollView giving problems (Android) - androidAndroid ICS: What does Force GPU Rendering really do? - androidGetting the last two lines in a text file - c #MongoDB + web application: a database for each user - mongodbSearch String Algorithms - searchQuerying the existence of a nested list in Mongo - javascriptcan't get "rail console" to work on ubuntu 11.10 - ruby-on-rails-3jQuery 1.7 clientX / pageX undefined - jqueryProblems creating a video file in MATLAB - animationAll Articles