drcallaway / regexml

Java library for writing regular expressions in XML
0 stars 0 forks source link

Make code (XML parsing) Android compatible #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When trying to use the library on a Android 2.1 device (Nexus One), I got
the following errors - which boils down to javax/xml/stream classes not
found. Perhaps use another XML parser that is also available in Android?

I/dalvikvm(13640): Could not find method
javax.xml.stream.XMLInputFactory.newInstance, referenced from method
org.regexml.ExpressionFactory.<init>
W/dalvikvm(13640): VFY: unable to resolve static method 1093:
Ljavax/xml/stream/XMLInputFactory;.newInstance
()Ljavax/xml/stream/XMLInputFactory;
D/dalvikvm(13640): VFY: replacing opcode 0x71 at 0x000a
D/dalvikvm(13640): Making a copy of Lorg/regexml/ExpressionFactory;.<init>
code (112 bytes)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/StartElement;)
I/dalvikvm(13640): Could not find method
javax.xml.stream.events.StartElement.getAttributes, referenced from method
org.regexml.ExpressionFactory.handleEndAnchorElement
W/dalvikvm(13640): VFY: unable to resolve interface method 1098:
Ljavax/xml/stream/events/StartElement;.getAttributes ()Ljava/util/Iterator;
D/dalvikvm(13640): VFY: replacing opcode 0x72 at 0x0001
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.handleEndAnchorElement code (172 bytes)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/EndElement;)
I/dalvikvm(13640): Could not find method
javax.xml.stream.events.EndElement.getName, referenced from method
org.regexml.ExpressionFactory.handleEndElement
W/dalvikvm(13640): VFY: unable to resolve interface method 1097:
Ljavax/xml/stream/events/EndElement;.getName ()Ljavax/xml/namespace/QName;
D/dalvikvm(13640): VFY: replacing opcode 0x72 at 0x0000
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.handleEndElement code (80 bytes)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/EndElement;)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/StartElement;)
I/dalvikvm(13640): Could not find method
javax.xml.stream.events.StartElement.getAttributes, referenced from method
org.regexml.ExpressionFactory.handleExpressionElementStart
W/dalvikvm(13640): VFY: unable to resolve interface method 1098:
Ljavax/xml/stream/events/StartElement;.getAttributes ()Ljava/util/Iterator;
D/dalvikvm(13640): VFY: replacing opcode 0x72 at 0x0006
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.handleExpressionElementStart code (224 bytes)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/EndElement;)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/StartElement;)
I/dalvikvm(13640): Could not find method
javax.xml.stream.events.StartElement.getAttributes, referenced from method
org.regexml.ExpressionFactory.handleGroupElementStart
W/dalvikvm(13640): VFY: unable to resolve interface method 1098:
Ljavax/xml/stream/events/StartElement;.getAttributes ()Ljava/util/Iterator;
D/dalvikvm(13640): VFY: replacing opcode 0x72 at 0x001f
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.handleGroupElementStart code (860 bytes)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/StartElement;)
I/dalvikvm(13640): Could not find method
javax.xml.stream.events.StartElement.getAttributes, referenced from method
org.regexml.ExpressionFactory.handleMatchElement
W/dalvikvm(13640): VFY: unable to resolve interface method 1098:
Ljavax/xml/stream/events/StartElement;.getAttributes ()Ljava/util/Iterator;
D/dalvikvm(13640): VFY: replacing opcode 0x78 at 0x001d
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.handleMatchElement code (1612 bytes)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/StartElement;)
I/dalvikvm(13640): Could not find method
javax.xml.stream.events.StartElement.getAttributes, referenced from method
org.regexml.ExpressionFactory.handleRegexmlElement
W/dalvikvm(13640): VFY: unable to resolve interface method 1098:
Ljavax/xml/stream/events/StartElement;.getAttributes ()Ljava/util/Iterator;
D/dalvikvm(13640): VFY: replacing opcode 0x72 at 0x0000
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.handleRegexmlElement code (116 bytes)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/StartElement;)
I/dalvikvm(13640): Could not find method
javax.xml.stream.events.StartElement.getAttributes, referenced from method
org.regexml.ExpressionFactory.handleStartAnchorElement
W/dalvikvm(13640): VFY: unable to resolve interface method 1098:
Ljavax/xml/stream/events/StartElement;.getAttributes ()Ljava/util/Iterator;
D/dalvikvm(13640): VFY: replacing opcode 0x72 at 0x0000
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.handleStartAnchorElement code (144 bytes)
W/dalvikvm(13640): VFY: unable to find class referenced in signature
(Ljavax/xml/stream/events/StartElement;)
I/dalvikvm(13640): Could not find method
javax.xml.stream.events.StartElement.getName, referenced from method
org.regexml.ExpressionFactory.handleStartElement
W/dalvikvm(13640): VFY: unable to resolve interface method 1099:
Ljavax/xml/stream/events/StartElement;.getName ()Ljavax/xml/namespace/QName;
D/dalvikvm(13640): VFY: replacing opcode 0x72 at 0x0000
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.handleStartElement code (176 bytes)
I/dalvikvm(13640): Could not find method
javax.xml.stream.XMLInputFactory.createXMLEventReader, referenced from
method org.regexml.ExpressionFactory.processExpressions
W/dalvikvm(13640): VFY: unable to resolve virtual method 1092:
Ljavax/xml/stream/XMLInputFactory;.createXMLEventReader
(Ljava/io/Reader;)Ljavax/xml/stream/XMLEventReader;
D/dalvikvm(13640): VFY: replacing opcode 0x6e at 0x0002
D/dalvikvm(13640): Making a copy of
Lorg/regexml/ExpressionFactory;.processExpressions code (145 bytes)
W/dalvikvm(13640): VFY: unable to resolve exception class 313
(Ljavax/xml/stream/XMLStreamException;)
W/dalvikvm(13640): VFY: unable to find exception handler at addr 0x1e
W/dalvikvm(13640): VFY:  rejected
Lorg/regexml/ExpressionFactory;.processExpressions (Ljava/io/Reader;)V
W/dalvikvm(13640): VFY:  rejecting opcode 0x0d at 0x001e
W/dalvikvm(13640): VFY:  rejected
Lorg/regexml/ExpressionFactory;.processExpressions (Ljava/io/Reader;)V
W/dalvikvm(13640): Verifier rejected class Lorg/regexml/ExpressionFactory;
W/dalvikvm(13640): Exception Ljava/lang/VerifyError; thrown during
Lxxx;.<clinit>

Original issue reported on code.google.com by andreas....@gmail.com on 6 May 2010 at 2:50

GoogleCodeExporter commented 9 years ago
Regexml uses the standard Java StAX pull parser. I didn't realize that it wasn't
available on Android. I looked into this and discovered the following:

"Java's Simple API for XML (SAX) and the Document Object Model (DOM) are both
available on Android. Both of these APIs have been part of Java technology for 
many
years. The newer Streaming API for XML (StAX) is not available in Android. 
However,
Android provides a functionally equivalent library."
http://www.ibm.com/developerworks/opensource/library/x-android/index.html

It looks like the Regexml library would need to switch from StAX to SAX in 
order to
support Android. This will be considered for future releases.

Original comment by drcalla...@gmail.com on 6 May 2010 at 3:52