Well... I can use DOM parser, but by DOM parser I can get the nodes? remove nodes? and append the records?
Em quinta-feira, 30 de agosto de 2012 17h03min10s UTC-3, Jacky Alciné escreveu: > > Why not use a DOM parser? > > On Thu, Aug 30, 2012 at 3:42 PM, Guilherme Bernardi > <[email protected]<javascript:> > > wrote: > >> 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]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > > -- > Jacky Alcine > Blog <http://blog.jalcine.me> | Launchpad<https://launchpad.net/~jackyalcine> > > -- 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

