How do I remove an attribute from XML element?
Category: org.jdom, viewed: 1521 time(s).
The following example shows you how to remove attributes from an XML element. We will remove attribute named userid from the <row> element. To remove an attribute you can call the removeAttribute(String name) method of the Element object.
The program will output the following result to the console:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<row userid="alice">
<firstname>Alice</firstname>
<lastname>Starbuzz</lastname>
</row>
</root>
<?xml version="1.0" encoding="UTF-8"?>
<root>
<row>
<firstname>Alice</firstname>
<lastname>Starbuzz</lastname>
</row>
</root>
Can't find what you are looking for? Join our FORUMS and ask some questions!
Download Hundreds of Complimentary Industry Resources
Get hundreds of popular Industry magazines, white papers, webinars, podcasts, and more;
all available at no cost to you. With more than 600 complimentary offers, you'll find
plenty of titles to suit your professional interests and needs.
Click Here and Sign up today!
