Hello,

I'm new to android but not to java and now facing an odd problem.

Parsing of the same xml document works fine on jdk but fails on
android. I need to find a solution to build a Document object, any
workaround is appreciated.

BR
toki

-----------------------------
This throws a SAXException
-----------------------------
int rID = getResources().getIdentifier("tki.andro:raw/hbciplus", null,
null);
            InputStream syntaxStream =
getResources().openRawResource(rID);
            DocumentBuilderFactory
dbf=DocumentBuilderFactory.newInstance();

            dbf.setIgnoringComments(true);
            dbf.setNamespaceAware(true);
            dbf.setValidating(false);
            DocumentBuilder db = dbf.newDocumentBuilder();
            //final AssetManager assetManager =
ActivitySingleton.getInstance().currentActivity.getAssets();
            Document syntax = db.parse(syntaxStream);   // <-- here
the exception is thrown
            syntaxStream.close();

-----------------------------
This test works: jdk 1.6
-----------------------------

public class ParserTest {
   public static void main(String args[]) throws
ParserConfigurationException, SAXException, IOException {

       InputStream syntaxStream = new FileInputStream(new File("/Users/
toki/Workspace/AndroidTest/res/raw/hbciplus.xml"));
       DocumentBuilderFactory
dbf=DocumentBuilderFactory.newInstance();

       dbf.setIgnoringComments(true);
       dbf.setNamespaceAware(true);
       dbf.setValidating(false);
       DocumentBuilder db = dbf.newDocumentBuilder();
       //final AssetManager assetManager =
ActivitySingleton.getInstance().currentActivity.getAssets();
       Document syntax = db.parse(syntaxStream);
       syntaxStream.close();

       System.out.println("success");
   }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to