src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/SAX2DOMEx.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 21,45 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
- /*
- * SAX2DOMEx.java
- *
- * Created on February 22, 2002, 1:55 PM
- */
package com.sun.xml.internal.bind.marshaller;
import java.util.Stack;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import com.sun.xml.internal.bind.util.Which;
import com.sun.istack.internal.FinalArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
import org.xml.sax.Attributes;
--- 21,41 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.bind.marshaller;
import java.util.Stack;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import com.sun.xml.internal.bind.util.Which;
import com.sun.istack.internal.FinalArrayList;
+ import com.sun.xml.internal.bind.v2.util.XmlFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
import org.xml.sax.Attributes;
*** 88,100 ****
}
/**
* Creates a fresh empty DOM document and adds nodes under this document.
*/
public SAX2DOMEx() throws ParserConfigurationException {
! DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
! factory.setNamespaceAware(true);
factory.setValidating(false);
document = factory.newDocumentBuilder().newDocument();
node = document;
nodeStack.push(document);
--- 84,106 ----
}
/**
* Creates a fresh empty DOM document and adds nodes under this document.
*/
+ public SAX2DOMEx(DocumentBuilderFactory f) throws ParserConfigurationException {
+ f.setValidating(false);
+ document = f.newDocumentBuilder().newDocument();
+ node = document;
+ nodeStack.push(document);
+ }
+
+ /**
+ * Creates a fresh empty DOM document and adds nodes under this document.
+ * @deprecated
+ */
public SAX2DOMEx() throws ParserConfigurationException {
! DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false);
factory.setValidating(false);
document = factory.newDocumentBuilder().newDocument();
node = document;
nodeStack.push(document);
*** 141,151 ****
}
public void startElement(String namespace, String localName, String qName, Attributes attrs) {
Node parent = nodeStack.peek();
! // some broken DOM implementatino (we confirmed it with SAXON)
// return null from this method.
Element element = document.createElementNS(namespace, qName);
if (element == null) {
// if so, report an user-friendly error message,
--- 147,157 ----
}
public void startElement(String namespace, String localName, String qName, Attributes attrs) {
Node parent = nodeStack.peek();
! // some broken DOM implementation (we confirmed it with SAXON)
// return null from this method.
Element element = document.createElementNS(namespace, qName);
if (element == null) {
// if so, report an user-friendly error message,
*** 156,166 ****
Which.which(document.getClass())));
}
// process namespace bindings
for (int i = 0; i < unprocessedNamespaces.size(); i += 2) {
! String prefix = unprocessedNamespaces.get(i + 0);
String uri = unprocessedNamespaces.get(i + 1);
namespace(element, prefix, uri);
}
unprocessedNamespaces.clear();
--- 162,172 ----
Which.which(document.getClass())));
}
// process namespace bindings
for (int i = 0; i < unprocessedNamespaces.size(); i += 2) {
! String prefix = unprocessedNamespaces.get(i);
String uri = unprocessedNamespaces.get(i + 1);
namespace(element, prefix, uri);
}
unprocessedNamespaces.clear();