diff options
author | Matthias Klose <doko@gcc.gnu.org> | 2007-08-04 10:53:49 +0000 |
---|---|---|
committer | Matthias Klose <doko@gcc.gnu.org> | 2007-08-04 10:53:49 +0000 |
commit | f06a83c0b2f7761510836194a6c9a8a72000937c (patch) | |
tree | 871b70a606d87369d5aa9d6f621baedc13b49eba /libjava/classpath/gnu/xml/dom | |
parent | 2c3de459b647a72fc35d66adeda274ba0f14347b (diff) | |
download | gcc-f06a83c0b2f7761510836194a6c9a8a72000937c.zip gcc-f06a83c0b2f7761510836194a6c9a8a72000937c.tar.gz gcc-f06a83c0b2f7761510836194a6c9a8a72000937c.tar.bz2 |
Import GNU Classpath (libgcj-import-20070727).
libjava/
2007-08-04 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (libgcj-import-20070727).
* Regenerate class and header files.
* Regenerate auto* files.
* include/jvm.h:
* jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type.
* jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise.
* jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA,
_Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA,
_Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA,
_Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify
jvalue parameter.
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise.
* java/lang/VMFloat.java (toString, parseFloat): New.
* gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported,
isModalExclusionTypeSupported): New (stub only).
* gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise.
* gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages,
updateFocusableWindowState, setModalBlocked, getBoundsPrivate,
setAlwaysOnTop): Likewise.
* gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature.
* scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer,
ignore javax.sound.sampled.spi.MixerProvider, ignore .in files.
* HACKING: Mention --enable-gstreamer-peer, removal of generated files.
libjava/classpath/
2007-08-04 Matthias Klose <doko@ubuntu.com>
* java/util/EnumMap.java (clone): Add cast.
From-SVN: r127204
Diffstat (limited to 'libjava/classpath/gnu/xml/dom')
-rw-r--r-- | libjava/classpath/gnu/xml/dom/DomDocument.java | 23 | ||||
-rw-r--r-- | libjava/classpath/gnu/xml/dom/DomElement.java | 2 | ||||
-rw-r--r-- | libjava/classpath/gnu/xml/dom/DomNamedNodeMap.java | 8 | ||||
-rw-r--r-- | libjava/classpath/gnu/xml/dom/DomNode.java | 45 | ||||
-rw-r--r-- | libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java | 2 |
5 files changed, 58 insertions, 22 deletions
diff --git a/libjava/classpath/gnu/xml/dom/DomDocument.java b/libjava/classpath/gnu/xml/dom/DomDocument.java index 5d06a42..bcc7293 100644 --- a/libjava/classpath/gnu/xml/dom/DomDocument.java +++ b/libjava/classpath/gnu/xml/dom/DomDocument.java @@ -87,6 +87,7 @@ public class DomDocument 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 class DomDocument public void setCheckingCharacters(boolean flag) { checkingCharacters = flag; - } + } + + /** + * Sets whether to default attributes for new elements. + */ + public void setDefaultAttributes(boolean flag) + { + defaultAttributes = flag; + } /** * <b>DOM L1</b> @@ -607,7 +616,8 @@ public class DomDocument domElement.localName = null; element = domElement; } - defaultAttributes(element, name); + if (defaultAttributes) + setDefaultAttributes(element, name); return element; } @@ -652,11 +662,12 @@ public class DomDocument } 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 @@ public class DomDocument 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 = ""; diff --git a/libjava/classpath/gnu/xml/dom/DomElement.java b/libjava/classpath/gnu/xml/dom/DomElement.java index f55b084..9fd81e9 100644 --- a/libjava/classpath/gnu/xml/dom/DomElement.java +++ b/libjava/classpath/gnu/xml/dom/DomElement.java @@ -124,7 +124,7 @@ public class DomElement node.attributes = new DomNamedNodeMap(node, Node.ATTRIBUTE_NODE); for (DomNode ctx = attributes.first; ctx != null; ctx = ctx.next) { - node.attributes.setNamedItemNS(ctx.cloneNode(true)); + node.attributes.setNamedItem(ctx.cloneNode(true), true, true); } } return node; diff --git a/libjava/classpath/gnu/xml/dom/DomNamedNodeMap.java b/libjava/classpath/gnu/xml/dom/DomNamedNodeMap.java index e3f08e4..e37cc3d 100644 --- a/libjava/classpath/gnu/xml/dom/DomNamedNodeMap.java +++ b/libjava/classpath/gnu/xml/dom/DomNamedNodeMap.java @@ -148,7 +148,7 @@ public class DomNamedNodeMap */ public Node setNamedItem(Node arg) { - return setNamedItem(arg, false); + return setNamedItem(arg, false, false); } /** @@ -160,10 +160,10 @@ public class DomNamedNodeMap */ public Node setNamedItemNS(Node arg) { - return setNamedItem(arg, true); + return setNamedItem(arg, true, false); } - Node setNamedItem(Node arg, boolean ns) + Node setNamedItem(Node arg, boolean ns, boolean cloning) { if (readonly) { @@ -171,7 +171,7 @@ public class DomNamedNodeMap } DomNode node = (DomNode) arg; - if (node.owner != owner.owner) + if (!cloning && node.owner != owner.owner) { throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR); } diff --git a/libjava/classpath/gnu/xml/dom/DomNode.java b/libjava/classpath/gnu/xml/dom/DomNode.java index 9af3f3e..1cbdc2a 100644 --- a/libjava/classpath/gnu/xml/dom/DomNode.java +++ b/libjava/classpath/gnu/xml/dom/DomNode.java @@ -1108,26 +1108,47 @@ public abstract class DomNode */ public Node cloneNode(boolean deep) { - DomNode node = (DomNode) clone(); - if (deep) { - DomDocument doc = (nodeType == DOCUMENT_NODE) ? - (DomDocument) node : node.owner; - boolean building = doc.building; + return cloneNodeDeepInternal(true, null); + } + + DomNode node = (DomNode) clone(); + if (nodeType == ENTITY_REFERENCE_NODE) + { + node.makeReadonly(); + } + notifyUserDataHandlers(UserDataHandler.NODE_CLONED, this, node); + return node; + } + + /** + * Returns a deep clone of this node. + */ + private DomNode cloneNodeDeepInternal(boolean root, DomDocument doc) + { + DomNode node = (DomNode) clone(); + boolean building = false; // Never used unless root is true + if (root) + { + doc = (nodeType == DOCUMENT_NODE) ? (DomDocument) node : node.owner; + building = doc.building; doc.building = true; // Permit certain structural rules - for (DomNode ctx = first; ctx != null; ctx = ctx.next) - { - DomNode newChild = (DomNode) ctx.cloneNode(deep); - newChild.setOwner(doc); - node.appendChild(newChild); - } - doc.building = building; + } + node.owner = doc; + for (DomNode ctx = first; ctx != null; ctx = ctx.next) + { + DomNode newChild = ctx.cloneNodeDeepInternal(false, doc); + node.appendChild(newChild); } if (nodeType == ENTITY_REFERENCE_NODE) { node.makeReadonly(); } + if (root) + { + doc.building = building; + } notifyUserDataHandlers(UserDataHandler.NODE_CLONED, this, node); return node; } diff --git a/libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java b/libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java index 364c576..0a165aa 100644 --- a/libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java +++ b/libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java @@ -138,6 +138,7 @@ public class SAXEventSink 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 @@ public class SAXEventSink { doc.setStrictErrorChecking(true); doc.setBuilding(false); + doc.setDefaultAttributes(true); DomDoctype doctype = (DomDoctype) doc.getDoctype(); if (doctype != null) { |