OSDN Git Service

Including proper prefixes and qualified names in the Expat parser.
authorJesse Wilson <jessewilson@google.com>
Sat, 23 Jan 2010 08:49:53 +0000 (00:49 -0800)
committerJesse Wilson <jessewilson@google.com>
Tue, 26 Jan 2010 20:24:24 +0000 (12:24 -0800)
commit0e2380935a5ea8d1ae3e59cfad6c4e5cbfcb54d9
tree6d400871e3bca2dc7edf8480d2064569ca39f9c0
parent573960f63056125a12b05dcb624cbfa420ce64d5
Including proper prefixes and qualified names in the Expat parser.
Also changing our SAX codepath to always include values for optional parameters.

In testing Xalan's javax.xml.transform packages with the Expat source code, the
emitted documents were malformed. The underlying problem was that Xalan was
expecting optional parameters to be populated, but Expat was not populating them.

The spec says,
  "Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:
  * the Namespace URI and local name are required when the namespaces property is true (the default), and are optional when the namespaces property is false (if one is specified, both must be);
  * the qualified name is required when the namespace-prefixes property is true, and is optional when the namespace-prefixes property is false (the default).

Although Xalan is technically at fault here, it may take forever to find all of
the places where these optional parameters are assumed to be present. Instead,
I'll just supply them which adds little overhead anyway.

See http://code.google.com/p/android/issues/detail?id=990
libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
libcore/xml/src/test/java/org/apache/harmony/xml/ExpatParserTest.java