From 21f924fa1dc622fc53da7267a114b780b10e8c47 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 15 Jul 2011 15:21:04 +1000 Subject: [PATCH] 352176 - xml parsing on startElement should be more flexible on using qName or localName --- VERSION.txt | 1 + .../main/java/org/eclipse/jetty/xml/XmlParser.java | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index c6b16cac638..4cda4f4a2a9 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -2,6 +2,7 @@ jetty-7.5.0-SNAPSHOT + 351516 Refactored sessions to better support nosql session managers + 351576 Do not use deprecated method File.toURL() + 352046 Need try/catch around features set in XmlParser + + 352176 xml parsing on startElement should be more flexible on using qName or localName jetty-7.4.4.v20110707 July 7th 2011 + 308851 Converted all jetty-client module tests to JUnit 4 diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java index 6dc6cbbe788..32e8fdd380e 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java @@ -70,7 +70,6 @@ public class XmlParser boolean validating_dft = factory.getClass().toString().startsWith("org.apache.xerces."); String validating_prop = System.getProperty("org.eclipse.jetty.xml.XmlParser.Validating", validating_dft ? "true" : "false"); boolean validating = Boolean.valueOf(validating_prop).booleanValue(); - setValidating(validating); } @@ -110,11 +109,12 @@ public class XmlParser _parser.getXMLReader().setFeature("http://xml.org/sax/features/namespace-prefixes", false); try { - _parser.getXMLReader().setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", validating); + if (validating) + _parser.getXMLReader().setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", validating); } catch (Exception e) { - Log.warn(Log.EXCEPTION, e); + Log.warn(e.getMessage()); } } catch (Exception e) @@ -296,7 +296,13 @@ public class XmlParser /* ------------------------------------------------------------ */ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { - String name = (uri == null || uri.equals("")) ? qName : localName; + String name = null; + if (_parser.isNamespaceAware()) + name = localName; + + if (name == null || "".equals(name)) + name = qName; + Node node = new Node(_context, name, attrs);