operaska wrote:
>Hello
>
>My name is Jose, i'm try to modify an attribute, but a specific
>attribute see this
>
><xml>
> <field1>
> <internal_field1 name="example" date="01-06-05:12:00"/>
> </field1>
>
>How i cant to modify the attribute date ?
>
>are there some like this ?
>while (EventType != XmlPullParser.END_DOCUMENT) {
>.
>.
>.
> if(xpp.getName().equals("internal_field1")){
> //I don't know some like this
> if(xpp.getAttributeName(i).equals("date")){
> setAttribute("12-12-05:12:00:00");
> }
> }
>}
>
>
>
>
XmlPullParser parser can not modify anything (it is only reading) - you
need XmlSerializer (to write), check this example:
http://xmlpull.org/v1/download/unpacked/src/java/samples/Roundtrip.java
and modify writeStartTag to write your attribute anyway you want, that
may work:
for (int i = 0; i < parser.getAttributeCount (); i++) {
if(xpp.getAttributeName(i).equals("date")){
serializer.attribute
(parser.getAttributeNamespace (i),
parser.getAttributeName (i),
"12-12-05:12:00:00");
} else {
serializer.attribute
(parser.getAttributeNamespace (i),
parser.getAttributeName (i),
parser.getAttributeValue (i));
}
}
HTH,
alek
--
The best way to predict the future is to invent it - Alan Kay