To create the XML file, I did this:
XmlSerializer serializer = Xml.newSerializer();
serializer.setOutput(fileos, "UTF-8");
serializer.startDocument(null, Boolean.valueOf(true));
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output",
true);
serializer.startTag(null, "produtos");
for (int currentProperty = 0; currentProperty <
propertyResultCount; currentProperty++) {
SoapObject obj = (SoapObject)
objSoapObject.getProperty(currentProperty);
int attributeResultCount = obj.getPropertyCount();
serializer.startTag(null,
"produto"+currentProperty);
for (int index = 0; index < attributeResultCount;
index++){
PropertyInfo pi = new PropertyInfo();
obj.getPropertyInfo(index, pi);
String tag = pi.name;
String value =
obj.getPropertyAsString(index).toString();
serializer.startTag(null, tag);
serializer.text(value);
serializer.endTag(null, tag);
}
serializer.endTag(null,"produto"+currentProperty);
}
serializer.endTag(null,"produtos");
serializer.endDocument();
serializer.flush();
fileos.close();
I can use the same model to read the file and get every data information
that I need?
Another doubt, when I create the file, I need to use the explicit address,
for example:
File newxmlfile = new File("/data/data/dataplus.application/produto.xml");
Because I got some exceptions...
Why I can't access my Internal Storage or External Storage?
I set the permissions on the Manifest file...
Em terça-feira, 28 de agosto de 2012 17h04min26s UTC-3, Kristopher Micinski
escreveu:
>
> That's not what Lew is talking about...
>
> DOM is easy, but heavy, by contrast things like SAX are lightweight
> and won't kill memory usage on the device. (Easier to do than you
> might think...)
>
> You should also look into using XmlPullParser.
>
> As a quick note, this isn't really specific to Android: these are the
> same technologies you would use in Java..
>
> kris
>
> On Tue, Aug 28, 2012 at 3:38 PM, Guilherme Bernardi
> <[email protected] <javascript:>> wrote:
> > FileInputStream is a good choise?
> >
> > Em segunda-feira, 27 de agosto de 2012 17h06min26s UTC-3, Lew escreveu:
> >>
> >> Guilherme Bernardi wrote:
> >>>
> >>> I'm developing an application that uses XML data...
> >>>
> >>> I consumed an wcf web service with SOAP, convert the object to a basic
> >>> XML and save on sdcard, but now I need to read this data file to edit,
> >>> confer and save?
> >>>
> >>> How can I do that? Can anyone help me?
> >>
> >>
> >> bob wrote:
> >>>
> >>> I would use Document Object Model (DOM).
> >>
> >>
> >> Sometimes. Sometimes it's better to use a stream-processing model.
> >>
> >> --
> >> Lew
> >>
> >
> > --
> > 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
>
--
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