Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove class= attribute

Tags:

I'm using simple xml library: http://simple.sourceforge.net/home.php

I have a problem with @ElementList annotation: if I use this annotation like this:

@ElementList protected List<Element> elements; 

My XML file has one more attribute:

<elements class="java.util.ArrayList"> 

how to remove the attribute class="....." ?

like image 966
user1610075 Avatar asked Aug 24 '12 16:08

user1610075


People also ask

How do I delete a class attribute?

removeAttr() method. With jQuery, you can use the . removeAttr() method to remove the class attribute from an element. It is equivalent to the JavaScript's removeAttribute() method.

How do I remove attributes?

The removeAttribute() method removes an attribute, and does not have a return value. The removeAttributeNode() method removes an Attr object, and returns the removed object.

How do you remove a class from a function?

The removeClass() method removes one or more class names from the selected elements. Note: If no parameter is specified, this method will remove ALL class names from the selected elements.

How do I remove a class from a div?

Use the classList. remove() method to remove a class from a div element, e.g. box. classList. remove('my-class') .


1 Answers

The class Attribute tells Simple which implementation of List you use. If it's missing, Simple will look for a proper class itself.

One solution is to use ArrayList instead of List:

@ElementList protected ArrayList<Element> elements; 

Now Simple wont add the class-Attribute.

Another way:

@Path("elements") @ElementList(inline=true) protected List<Element> elements; 

This inlines your List (no elements-Tag is used) but puts it into a "new" elements-Tag

like image 149
ollo Avatar answered Sep 22 '22 06:09

ollo