src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/SAX2DOMEx.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/SAX2DOMEx.java	Thu Apr 04 19:05:24 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/SAX2DOMEx.java	Tue Apr 09 14:51:13 2013 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -23,11 +23,6 @@
    1.11   * questions.
    1.12   */
    1.13  
    1.14 -/*
    1.15 - * SAX2DOMEx.java
    1.16 - *
    1.17 - * Created on February 22, 2002, 1:55 PM
    1.18 - */
    1.19  package com.sun.xml.internal.bind.marshaller;
    1.20  
    1.21  import java.util.Stack;
    1.22 @@ -38,6 +33,7 @@
    1.23  import com.sun.xml.internal.bind.util.Which;
    1.24  import com.sun.istack.internal.FinalArrayList;
    1.25  
    1.26 +import com.sun.xml.internal.bind.v2.util.XmlFactory;
    1.27  import org.w3c.dom.Document;
    1.28  import org.w3c.dom.Element;
    1.29  import org.w3c.dom.Node;
    1.30 @@ -90,9 +86,19 @@
    1.31      /**
    1.32       * Creates a fresh empty DOM document and adds nodes under this document.
    1.33       */
    1.34 +    public SAX2DOMEx(DocumentBuilderFactory f) throws ParserConfigurationException {
    1.35 +        f.setValidating(false);
    1.36 +        document = f.newDocumentBuilder().newDocument();
    1.37 +        node = document;
    1.38 +        nodeStack.push(document);
    1.39 +    }
    1.40 +
    1.41 +    /**
    1.42 +     * Creates a fresh empty DOM document and adds nodes under this document.
    1.43 +     * @deprecated
    1.44 +     */
    1.45      public SAX2DOMEx() throws ParserConfigurationException {
    1.46 -        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    1.47 -        factory.setNamespaceAware(true);
    1.48 +        DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false);
    1.49          factory.setValidating(false);
    1.50  
    1.51          document = factory.newDocumentBuilder().newDocument();
    1.52 @@ -143,7 +149,7 @@
    1.53      public void startElement(String namespace, String localName, String qName, Attributes attrs) {
    1.54          Node parent = nodeStack.peek();
    1.55  
    1.56 -        // some broken DOM implementatino (we confirmed it with SAXON)
    1.57 +        // some broken DOM implementation (we confirmed it with SAXON)
    1.58          // return null from this method.
    1.59          Element element = document.createElementNS(namespace, qName);
    1.60  
    1.61 @@ -158,7 +164,7 @@
    1.62  
    1.63          // process namespace bindings
    1.64          for (int i = 0; i < unprocessedNamespaces.size(); i += 2) {
    1.65 -            String prefix = unprocessedNamespaces.get(i + 0);
    1.66 +            String prefix = unprocessedNamespaces.get(i);
    1.67              String uri = unprocessedNamespaces.get(i + 1);
    1.68  
    1.69              namespace(element, prefix, uri);

mercurial