I got it...
I'll post how I did...
Thanks
Em quinta-feira, 30 de agosto de 2012 16h42min36s UTC-3, Guilherme Bernardi
escreveu:
>
> Hi.
>
> I'm trying to append an Xml Data File.
>
> The structure of Xml is:
>
> <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
> <clientes>
>
> <cliente4>
>
> <Empresa>1</Empresa>
>
> <Codigo>5</Codigo>
>
> <Nome>gsdf</Nome>
>
> <Endereco>ags</Endereco>
>
> <Bairro>gasd</Bairro>
>
> </cliente4>
>
> </clientes>
>
> I need to add another record. I got it, but the new record was inserted
> like this:
>
> <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
> <clientes>
>
> <cliente4>
>
> <Empresa>1</Empresa>
>
> <Codigo>5</Codigo>
>
> <Nome>gsdf</Nome>
>
> <Endereco>ags</Endereco>
>
> <Bairro>gasd</Bairro>
>
> </cliente4>
>
> </clientes>*
> <cliente6><TESTE>testando</TESTE></cliente6><cliente6><TESTE>testando</TESTE></cliente6><cliente6><TESTE>testando</TESTE></cliente6>
> *
> *
> *
> How can I get the position of </cliente4> and append the new record or can
> I delete the EndTag </clientes> and add the new record and set the EndTag
> again?
>
> To appending the file I'm using:
>
> OutputStream is = openFileOutput("cliente.xml", MODE_APPEND);
>
> XmlSerializer serializer = Xml.newSerializer();
> serializer.setOutput(is, "UTF-8");
> serializer.startTag(null, "cliente6");
> serializer.startTag(null, "TESTE");
> serializer.text("testando");
> serializer.endTag(null, "TESTE");
> serializer.endTag(null,"cliente6");
> serializer.endDocument();
> serializer.flush();
> is.close();
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en