XOM を使用して Android で XML を作成しましたが、うまくいきましたが、XOM の Builder でいくつかの xml を解析しようとすると、エラーが発生します。
11-28 22:00:11.290: I/dalvikvm(26548): Could not find method org.apache.xerces.impl.Version.getVersion, referenced from method nu.xom.Builder.<clinit>
11-28 22:00:11.290: W/dalvikvm(26548): VFY: unable to resolve static method 5819: Lorg/apache/xerces/impl/Version;.getVersion ()Ljava/lang/String;
11-28 22:00:11.290: D/dalvikvm(26548): VFY: replacing opcode 0x71 at 0x000f
11-28 22:00:11.295: W/dalvikvm(26548): Unable to resolve superclass of Lnu/xom/XML1_0Parser; (921)
11-28 22:00:11.295: W/dalvikvm(26548): Link of class 'Lnu/xom/XML1_0Parser;' failed
11-28 22:00:11.295: E/dalvikvm(26548): Could not find class 'nu.xom.XML1_0Parser', referenced from method nu.xom.Builder.findParser
11-28 22:00:11.295: W/dalvikvm(26548): VFY: unable to resolve new-instance 699 (Lnu/xom/XML1_0Parser;) in Lnu/xom/Builder;
11-28 22:00:11.295: D/dalvikvm(26548): VFY: replacing opcode 0x22 at 0x0000
11-28 22:00:11.300: W/dalvikvm(26548): Unable to resolve superclass of Lnu/xom/XML1_0Parser; (921)
11-28 22:00:11.300: W/dalvikvm(26548): Link of class 'Lnu/xom/XML1_0Parser;' failed
11-28 22:00:11.300: D/dalvikvm(26548): DexOpt: unable to opt direct call 0x1160 at 0x02 in Lnu/xom/Builder;.findParser
11-28 22:00:11.300: W/dalvikvm(26548): Unable to resolve superclass of Lnu/xom/JDK15XML1_0Parser; (461)
11-28 22:00:11.300: W/dalvikvm(26548): Link of class 'Lnu/xom/JDK15XML1_0Parser;' failed
11-28 22:00:11.325: D/dalvikvm(26548): GC_CONCURRENT freed 377K, 4% free 11719K/12167K, paused 2ms+4ms
11-28 22:00:11.325: W/System.err(26548): nu.xom.XMLException: Could not find a suitable SAX2 parser
11-28 22:00:11.325: W/System.err(26548): at nu.xom.Builder.findParser(Unknown Source)
11-28 22:00:11.325: W/System.err(26548): at nu.xom.Builder.<init>(Unknown Source)
11-28 22:00:11.325: W/System.err(26548): at nu.xom.Builder.<init>(Unknown Source)
11-28 22:00:11.325: W/System.err(26548): at com.rkovalev.first.app.MainActivity$UpdateTask.onProgressUpdate(MainActivity.java:294)
11-28 22:00:11.325: W/System.err(26548): at com.rkovalev.first.app.MainActivity$UpdateTask.onProgressUpdate(MainActivity.java:1)
11-28 22:00:11.325: W/System.err(26548): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:618)
11-28 22:00:11.325: W/System.err(26548): at android.os.Handler.dispatchMessage(Handler.java:99)
11-28 22:00:11.325: W/System.err(26548): at android.os.Looper.loop(Looper.java:137)
11-28 22:00:11.325: W/System.err(26548): at android.app.ActivityThread.main(ActivityThread.java:4511)
11-28 22:00:11.325: W/System.err(26548): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 22:00:11.325: W/System.err(26548): at java.lang.reflect.Method.invoke(Method.java:511)
11-28 22:00:11.325: W/System.err(26548): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
11-28 22:00:11.325: W/System.err(26548): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
11-28 22:00:11.325: W/System.err(26548): at dalvik.system.NativeStart.main(Native Method)
11-28 22:00:11.325: W/System.err(26548): Caused by: org.xml.sax.SAXException: Can't create default XMLReader; is system property org.xml.sax.driver set?
11-28 22:00:11.325: W/System.err(26548): at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:156)
11-28 22:00:11.325: W/System.err(26548): ... 14 more
コードを使って実験する:
Builder parser = new Builder();
nu.xom.Document doc = parser.build("<greeting>Hello World!</greeting>", "http://www.example.org/");
そのため、org.xml.sax 名前空間にドライバー プロパティが見つかりませんでした。