summaryrefslogtreecommitdiffstats
path: root/xml/src/main
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-03-19 12:51:43 -0700
committerJesse Wilson <jessewilson@google.com>2010-03-19 13:37:36 -0700
commit4a5c3fdcab5bffc6b8258c8029b02d97b0dd3f9d (patch)
treeca0db7f6200f13a37b0e186106bbdd1e158eeaff /xml/src/main
parent0bd7c8e0333e2e641d1b0a1fafc0e07d0defa761 (diff)
downloadlibcore-4a5c3fdcab5bffc6b8258c8029b02d97b0dd3f9d.zip
libcore-4a5c3fdcab5bffc6b8258c8029b02d97b0dd3f9d.tar.gz
libcore-4a5c3fdcab5bffc6b8258c8029b02d97b0dd3f9d.tar.bz2
Fixing namespace+prefix mode in Expat and removing optional fields from callbacks.
The first part is related to bug 6632: http://code.google.com/p/android/issues/detail?id=6632 I added these optional fields back when I was originally updating the XML parser for Froyo. I've decided to remove them to simplify migrating between Android and the RI. It should also save some object allocations. Note that the RI v5 and the RI v6 behave differently for optional values on attributes; this motivated me to add the otherwise unfortunate assertOneOf() method to the testcase. (We behave more like RI v6, which is to supply the values upon request) Change-Id: Icfa5d29976a86bf194b3ed7c0d9e2275c3bff9dd
Diffstat (limited to 'xml/src/main')
-rw-r--r--xml/src/main/java/org/apache/harmony/xml/ExpatReader.java2
-rw-r--r--xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/xml/src/main/java/org/apache/harmony/xml/ExpatReader.java b/xml/src/main/java/org/apache/harmony/xml/ExpatReader.java
index dbe3a3a..d187456 100644
--- a/xml/src/main/java/org/apache/harmony/xml/ExpatReader.java
+++ b/xml/src/main/java/org/apache/harmony/xml/ExpatReader.java
@@ -244,7 +244,7 @@ public class ExpatReader implements XMLReader {
}
public void parse(InputSource input) throws IOException, SAXException {
- if (processNamespacePrefixes == processNamespaces) {
+ if (processNamespacePrefixes && processNamespaces) {
/*
* Expat has XML_SetReturnNSTriplet, but that still doesn't
* include xmlns attributes like this feature requires. We may
diff --git a/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index 4721800..b893309 100644
--- a/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -628,8 +628,8 @@ static void startElement(void* data, const char* elementName,
jobject javaParser = parsingContext->object;
ExpatElementName e(env, parsingContext, elementName);
- jstring uri = e.uri();
- jstring localName = e.localName();
+ jstring uri = parsingContext->processNamespaces ? e.uri() : emptyString;
+ jstring localName = parsingContext->processNamespaces ? e.localName() : emptyString;
jstring qName = e.qName();
stringStackPush(parsingContext, qName);