That leads me to another question.

I looked for a .jar that has the Transformer class and found xml-
apis-2.0.2.jar here 
http://www.findjar.com/jar/xml-apis/jars/xml-apis-2.0.2.jar.html
s...
I downloaded it and imported it via Build Path -> Configure Build
Path... -> Libraries -> Add External JARs... in Eclipse

And then the Console in Eclipse told me this

[2009-11-01 11:21:02 - Quiz]
trouble processing "javax/xml/parsers/DocumentBuilder.class":
[2009-11-01 11:21:02 - Quiz]
Attempt to include a core VM class in something other than a core
library.
It is likely that you have attempted to include the core library from
a desktop
virtual machine into an application, which will most assuredly not
work. If
you really intend to build a core library -- which is only appropriate
as
part of creating a full virtual machine binary, as opposed to
compiling an
application -- then use the "--core-library" option to suppress this
error
message. If you go ahead and use "--core-library" but are in fact
building
an application, then please be aware that your build will still fail
at some
point; you will simply be denied the pleasure of reading this helpful
error
message.
[2009-11-01 11:21:02 - Quiz]1 error; aborting
[2009-11-01 11:21:02 - Quiz]Conversion to Dalvik format failed with
error 1

At which point my question becomes how do you exclude certain classes
from being included from a jar? I'm inclined to believe that that's
not possible.

I also assume that this means that I won't be able to find a jar on
the net for any of the required classes since they've been compiled
for desktop Java, thus the only way that I could add those classes is
to compile them for Dalvik which definitely sounds outside my
skillset. Is this actually doable though?

Is there are other alternative to getting the javax.xml.transform
classes into Android?

On Oct 28, 11:39 pm, Xu Bill <billfight...@gmail.com> wrote:
> 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

Reply via email to