diff --git a/proposal/mutant/lib/parser/xercesImpl.jar b/proposal/mutant/lib/parser/xercesImpl.jar new file mode 100644 index 000000000..205138a5c Binary files /dev/null and b/proposal/mutant/lib/parser/xercesImpl.jar differ diff --git a/proposal/mutant/lib/parser/xml-apis.jar b/proposal/mutant/lib/parser/xml-apis.jar new file mode 100644 index 000000000..8331d27f1 Binary files /dev/null and b/proposal/mutant/lib/parser/xml-apis.jar differ diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ElementHandler.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ElementHandler.java index 2eb56f960..21fb851e6 100755 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ElementHandler.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ElementHandler.java @@ -341,10 +341,15 @@ public abstract class ElementHandler extends DefaultHandler { } String localName = attributes.getLocalName(i); String qName = attributes.getQName(i); - if (uri == null && qName.indexOf(":") != -1) { - // try to resolve through known namespaces - uri = context.resolveNamespace(qName); - localName = qName.substring(qName.indexOf(":") + 1); + + if (uri == null) { + if (qName.indexOf(":") != -1) { + // try to resolve through known namespaces + uri = context.resolveNamespace(qName); + localName = qName.substring(qName.indexOf(":") + 1); + } else { + localName = qName; + } } String attributeValue = attributes.getValue(i); diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ParseContext.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ParseContext.java index 20bcdbdf6..2f5a36eff 100755 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ParseContext.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ParseContext.java @@ -86,8 +86,19 @@ public class ParseContext { = new CircularDependencyChecker("parsing XML"); /** The factory used to create SAX parsers. */ - private SAXParserFactory parserFactory = SAXParserFactory.newInstance(); + private SAXParserFactory parserFactory; + public ParseContext() { + Thread thread = Thread.currentThread(); + ClassLoader currentContextLoader = thread.getContextClassLoader(); + try { + ClassLoader thisLoader = this.getClass().getClassLoader(); + thread.setContextClassLoader(thisLoader); + parserFactory = SAXParserFactory.newInstance(); + } finally { + thread.setContextClassLoader(currentContextLoader); + } + } /** * Parse a URL using the given root handler @@ -119,7 +130,18 @@ public class ParseContext { checker.visitNode(source); // create a parser for this source - SAXParser saxParser = parserFactory.newSAXParser(); + SAXParser saxParser = null; + + Thread thread = Thread.currentThread(); + ClassLoader currentContextLoader = thread.getContextClassLoader(); + try { + ClassLoader thisLoader = this.getClass().getClassLoader(); + thread.setContextClassLoader(thisLoader); + saxParser = parserFactory.newSAXParser(); + } finally { + thread.setContextClassLoader(currentContextLoader); + } + XMLReader xmlReader = saxParser.getXMLReader(); // create a root handler for this