elena 2002/08/26 14:53:30
Modified: java/src/org/apache/xerces/parsers AbstractDOMParser.java
DOMBuilderImpl.java
java/src/org/apache/xml/serialize DOMWriterImpl.java
Log:
Update according to the latest draft:
http://www.w3.org/TR/2002/WD-DOM-Level-3-LS-20020725/
Revision Changes Path
1.71 +16 -16
xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java
Index: AbstractDOMParser.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- AbstractDOMParser.java 20 Aug 2002 22:11:55 -0000 1.70
+++ AbstractDOMParser.java 26 Aug 2002 21:53:29 -0000 1.71
@@ -627,13 +627,13 @@
case DOMBuilderFilter.FILTER_INTERRUPT:{
throw new RuntimeException("The normal processing of the
document was interrupted.");
}
- case NodeFilter.FILTER_REJECT:{
+ case DOMBuilderFilter.FILTER_REJECT:{
// REVISIT: the constant FILTER_REJECT should be changed
when new
// DOM LS specs gets published
// fall through to SKIP since comment has no children.
}
- case NodeFilter.FILTER_SKIP: {
+ case DOMBuilderFilter.FILTER_SKIP: {
// REVISIT: the constant FILTER_SKIP should be changed when
new
// DOM LS specs gets published
fCurrentNode.removeChild(comment);
@@ -709,10 +709,10 @@
case DOMBuilderFilter.FILTER_INTERRUPT:{
throw new RuntimeException("The normal processing of the
document was interrupted.");
}
- case NodeFilter.FILTER_REJECT:{
+ case DOMBuilderFilter.FILTER_REJECT:{
// fall through to SKIP since PI has no children.
}
- case NodeFilter.FILTER_SKIP: {
+ case DOMBuilderFilter.FILTER_SKIP: {
fCurrentNode.removeChild(pi);
// fFirstChunk must be set to true so that data
// won't be lost in the case where the child before PI is
@@ -981,17 +981,17 @@
setCharacterData(false);
// filter nodes
if (fDOMFilter != null) {
- short code = fDOMFilter.startContainer(el);
+ short code = fDOMFilter.startElement(el);
switch (code) {
case DOMBuilderFilter.FILTER_INTERRUPT:{
throw new RuntimeException("The normal processing of the
document was interrupted.");
}
- case NodeFilter.FILTER_REJECT:{
+ case DOMBuilderFilter.FILTER_REJECT:{
fFilterReject = true;
fRejectedElement.setValues(element);
return;
}
- case NodeFilter.FILTER_SKIP: {
+ case DOMBuilderFilter.FILTER_SKIP: {
fSkippedElemStack.push(element);
return;
}
@@ -1264,13 +1264,13 @@
case DOMBuilderFilter.FILTER_INTERRUPT:{
throw new RuntimeException("The normal processing of
the document was interrupted.");
}
- case NodeFilter.FILTER_REJECT:{
+ case DOMBuilderFilter.FILTER_REJECT:{
Node parent = fCurrentNode.getParentNode();
parent.removeChild(fCurrentNode);
fCurrentNode = parent;
return;
}
- case NodeFilter.FILTER_SKIP: {
+ case DOMBuilderFilter.FILTER_SKIP: {
// make sure that if any char data is available
// the fFirstChunk is true, so that if the next event
// is characters(), and the last node is text, we will
copy
@@ -1354,10 +1354,10 @@
case DOMBuilderFilter.FILTER_INTERRUPT:{
throw new RuntimeException("The normal processing of
the document was interrupted.");
}
- case NodeFilter.FILTER_REJECT:{
+ case DOMBuilderFilter.FILTER_REJECT:{
// fall through to SKIP since CDATA section has no
children.
}
- case NodeFilter.FILTER_SKIP: {
+ case DOMBuilderFilter.FILTER_SKIP: {
Node parent = fCurrentNode.getParentNode();
parent.removeChild(fCurrentCDATASection);
fCurrentNode = parent;
@@ -1467,14 +1467,14 @@
case DOMBuilderFilter.FILTER_INTERRUPT:{
throw new RuntimeException("The normal processing of
the document was interrupted.");
}
- case NodeFilter.FILTER_REJECT:{
+ case DOMBuilderFilter.FILTER_REJECT:{
Node parent = fCurrentNode.getParentNode();
parent.removeChild(fCurrentNode);
fCurrentNode = parent;
return;
}
- case NodeFilter.FILTER_SKIP: {
+ case DOMBuilderFilter.FILTER_SKIP: {
// make sure we don't loose chars if next event is
characters()
fFirstChunk = true;
removeEntityRef = true;
@@ -2488,10 +2488,10 @@
case DOMBuilderFilter.FILTER_INTERRUPT:{
throw new RuntimeException("The normal processing of
the document was interrupted.");
}
- case NodeFilter.FILTER_REJECT:{
+ case DOMBuilderFilter.FILTER_REJECT:{
// fall through to SKIP since Comment has no children.
}
- case NodeFilter.FILTER_SKIP: {
+ case DOMBuilderFilter.FILTER_SKIP: {
fCurrentNode.removeChild(child);
return;
}
1.21 +2 -2
xml-xerces/java/src/org/apache/xerces/parsers/DOMBuilderImpl.java
Index: DOMBuilderImpl.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMBuilderImpl.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- DOMBuilderImpl.java 23 Aug 2002 20:14:39 -0000 1.20
+++ DOMBuilderImpl.java 26 Aug 2002 21:53:30 -0000 1.21
@@ -525,7 +525,7 @@
* <code>DOMInputSource</code>.
*
*/
- public Document parse(DOMInputSource is) throws Exception {
+ public Document parse(DOMInputSource is) {
// need to wrap the DOMInputSource with an XMLInputSource
XMLInputSource xmlInputSource = dom2xmlInputSource(is);
1.7 +13 -11 xml-xerces/java/src/org/apache/xml/serialize/DOMWriterImpl.java
Index: DOMWriterImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/DOMWriterImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DOMWriterImpl.java 23 Aug 2002 20:14:40 -0000 1.6
+++ DOMWriterImpl.java 26 Aug 2002 21:53:30 -0000 1.7
@@ -69,6 +69,7 @@
import org.w3c.dom.ls.DOMWriterFilter;
import org.w3c.dom.traversal.NodeFilter;
+import org.apache.xerces.dom.DOMErrorImpl;
import org.apache.xerces.impl.Constants;
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.util.XMLSymbols;
@@ -267,14 +268,10 @@
* @return Returns <code>true</code> if <code>node</code> was
* successfully serialized and <code>false</code> in case a failure
* occured and the failure wasn't canceled by the error handler.
- * @exception DOMSystemException
- * This exception will be raised in response to any sort of IO or system
- * error that occurs while writing to the destination. It may wrap an
- * underlying system exception.
+ * @exception none
*/
public boolean writeNode(java.io.OutputStream destination,
- Node wnode)
- throws Exception {
+ Node wnode) {
checkAllFeatures();
try {
reset();
@@ -289,10 +286,15 @@
serializer.serialize((Element)wnode);
else
return false;
- } catch (NullPointerException npe) {
- throw npe;
- } catch (IOException ioe) {
- throw ioe;
+ } catch (Exception e) {
+ if (serializer.fDOMErrorHandler != null) {
+ DOMErrorImpl error = new DOMErrorImpl();
+ error.fException = e;
+ error.fMessage = e.getMessage();
+ error.fSeverity = error.SEVERITY_ERROR;
+ serializer.fDOMErrorHandler.handleError(error);
+
+ }
}
return true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]