Try import jars to your project 在 2009 年 10 29 日,10:45 上午,"launchpadtt" <christopher.yee...@gmail.com>编写:
Hello, I have this app that's reading in an xml file into a document object. usually with code like this. Java: InputStream in=openFileInput("file.xml"); DocumentBuilder builder=DocumentBuilderFactory.newInstance ().newDocumentBuilder(); Document doc=builder.parse(in, null); certainelements=doc.getElementsByTagName("elementname"); then i would make changes to the some of the element attributes. But I'd like to save it back to a file. The snippets I've found on the net involve some of the following packages import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.xml.serialize.XMLSerializer; none of which seem to be a part of android (at least according to eclipse) my question is how do I save the contents of the document object back to a file then? I'd like to save only the changes I made but I don't mind if I overwrite the whole file. I was thinking I could output it to a string and just use the Working with Files tutorial to save that string back to the file, but I don't know how to do that either. Any assistance is appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---