Index: gnu/xml/dom/DomDocument.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocument.java,v retrieving revision 1.12 diff -u -r1.12 DomDocument.java --- gnu/xml/dom/DomDocument.java 24 Apr 2006 15:58:21 -0000 1.12 +++ gnu/xml/dom/DomDocument.java 4 May 2007 12:14:14 -0000 @@ -87,6 +87,7 @@ private final DOMImplementation implementation; private boolean checkingCharacters = true; boolean checkingWellformedness = true; + private boolean defaultAttributes = true; boolean building; // if true, skip mutation events in the tree @@ -155,7 +156,15 @@ public void setCheckingCharacters(boolean flag) { checkingCharacters = flag; - } + } + + /** + * Sets whether to default attributes for new elements. + */ + public void setDefaultAttributes(boolean flag) + { + defaultAttributes = flag; + } /** * DOM L1 @@ -607,7 +616,8 @@ domElement.localName = null; element = domElement; } - defaultAttributes(element, name); + if (defaultAttributes) + setDefaultAttributes(element, name); return element; } @@ -652,11 +662,12 @@ } Element element = new DomElement(this, namespaceURI, name); - defaultAttributes(element, name); + if (defaultAttributes) + setDefaultAttributes(element, name); return element; } - private void defaultAttributes(Element element, String name) + private void setDefaultAttributes(Element element, String name) { DomDoctype doctype = (DomDoctype) getDoctype(); if (doctype == null) @@ -671,9 +682,11 @@ for (Iterator i = info.attributes(); i != null && i.hasNext(); ) { DTDAttributeTypeInfo attr = (DTDAttributeTypeInfo) i.next(); + String value = attr.value; + if ("#IMPLIED".equals(attr.mode) && value == null) + continue; DomAttr node = (DomAttr) createAttribute(attr.name); - String value = attr.value; if (value == null) { value = ""; Index: gnu/xml/dom/ls/SAXEventSink.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/ls/SAXEventSink.java,v retrieving revision 1.9 diff -u -r1.9 SAXEventSink.java --- gnu/xml/dom/ls/SAXEventSink.java 19 Feb 2007 09:27:44 -0000 1.9 +++ gnu/xml/dom/ls/SAXEventSink.java 4 May 2007 12:14:14 -0000 @@ -138,6 +138,7 @@ doc = new DomDocument(); doc.setStrictErrorChecking(false); doc.setBuilding(true); + doc.setDefaultAttributes(false); ctx = doc; final String FEATURES = "http://xml.org/sax/features/"; @@ -185,6 +186,7 @@ { doc.setStrictErrorChecking(true); doc.setBuilding(false); + doc.setDefaultAttributes(true); DomDoctype doctype = (DomDoctype) doc.getDoctype(); if (doctype != null) { Index: gnu/xml/stream/XMLParser.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/stream/XMLParser.java,v retrieving revision 1.32 diff -u -r1.32 XMLParser.java --- gnu/xml/stream/XMLParser.java 16 Apr 2007 10:33:51 -0000 1.32 +++ gnu/xml/stream/XMLParser.java 4 May 2007 12:14:15 -0000 @@ -4598,6 +4598,28 @@ } return false; } + + public String toString() + { + StringBuffer buf = new StringBuffer(getClass().getName()); + buf.append('['); + buf.append("name="); + buf.append(name); + if (value != null) + { + buf.append(",value="); + buf.append(value); + } + if (type != null) + { + buf.append(",type="); + buf.append(type); + } + if (specified) + buf.append(",specified"); + buf.append(']'); + return buf.toString(); + } }