1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
32 import javax.xml.transform.dom.DOMSource; |
32 import javax.xml.transform.dom.DOMSource; |
33 import javax.xml.transform.sax.SAXResult; |
33 import javax.xml.transform.sax.SAXResult; |
34 |
34 |
35 import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; |
35 import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; |
36 |
36 |
|
37 import com.sun.xml.internal.bind.v2.util.XmlFactory; |
|
38 import javax.xml.parsers.DocumentBuilderFactory; |
37 import org.w3c.dom.Document; |
39 import org.w3c.dom.Document; |
38 import org.w3c.dom.Element; |
40 import org.w3c.dom.Element; |
39 import org.xml.sax.Locator; |
41 import org.xml.sax.Locator; |
40 import org.xml.sax.helpers.LocatorImpl; |
42 import org.xml.sax.helpers.LocatorImpl; |
41 import org.xml.sax.helpers.XMLFilterImpl; |
43 import org.xml.sax.helpers.XMLFilterImpl; |
74 |
76 |
75 Locator location = null; |
77 Locator location = null; |
76 |
78 |
77 ResultImpl() { |
79 ResultImpl() { |
78 try { |
80 try { |
79 s2d = new SAX2DOMEx(); |
81 DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI |
|
82 s2d = new SAX2DOMEx(factory); |
80 } catch (ParserConfigurationException e) { |
83 } catch (ParserConfigurationException e) { |
81 throw new AssertionError(e); // impossible |
84 throw new AssertionError(e); // impossible |
82 } |
85 } |
83 |
86 |
84 XMLFilterImpl f = new XMLFilterImpl() { |
87 XMLFilterImpl f = new XMLFilterImpl() { |
|
88 @Override |
85 public void setDocumentLocator(Locator locator) { |
89 public void setDocumentLocator(Locator locator) { |
86 super.setDocumentLocator(locator); |
90 super.setDocumentLocator(locator); |
87 location = new LocatorImpl(locator); |
91 location = new LocatorImpl(locator); |
88 } |
92 } |
89 }; |
93 }; |