1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Nov 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22
23 package com.sun.org.apache.xalan.internal.xsltc.trax;
29 import javax.xml.parsers.DocumentBuilder;
30 import javax.xml.parsers.DocumentBuilderFactory;
31 import javax.xml.parsers.ParserConfigurationException;
32 import org.w3c.dom.Comment;
33 import org.w3c.dom.Document;
34 import org.w3c.dom.Element;
35 import org.w3c.dom.Node;
36 import org.w3c.dom.ProcessingInstruction;
37 import org.w3c.dom.Text;
38 import org.xml.sax.Attributes;
39 import org.xml.sax.ContentHandler;
40 import org.xml.sax.Locator;
41 import org.xml.sax.SAXException;
42 import org.xml.sax.ext.LexicalHandler;
43 import org.xml.sax.ext.Locator2;
44
45 /**
46 * @author G. Todd Miller
47 * @author Sunitha Reddy
48 * @author Huizhe Wang
49 */
50 public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
51
52 private Node _root = null;
53 private Document _document = null;
54 private Node _nextSibling = null;
55 private Stack<Node> _nodeStk = new Stack<>();
56 private List<String> _namespaceDecls = null;
57 private Node _lastSibling = null;
58 private Locator locator = null;
59 private boolean needToSetDocumentInfo = true;
60
61 //Replace StringBuffer with StringBuilder now that we no long support jdk1.4
62 private StringBuilder _textBuffer = new StringBuilder();
63 private Node _nextSiblingCache = null;
64 /**
65 * JAXP document builder factory. Create a single instance and use
66 * synchronization because the Javadoc is not explicit about
67 * thread safety.
68 */
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21
22 package com.sun.org.apache.xalan.internal.xsltc.trax;
28 import javax.xml.parsers.DocumentBuilder;
29 import javax.xml.parsers.DocumentBuilderFactory;
30 import javax.xml.parsers.ParserConfigurationException;
31 import org.w3c.dom.Comment;
32 import org.w3c.dom.Document;
33 import org.w3c.dom.Element;
34 import org.w3c.dom.Node;
35 import org.w3c.dom.ProcessingInstruction;
36 import org.w3c.dom.Text;
37 import org.xml.sax.Attributes;
38 import org.xml.sax.ContentHandler;
39 import org.xml.sax.Locator;
40 import org.xml.sax.SAXException;
41 import org.xml.sax.ext.LexicalHandler;
42 import org.xml.sax.ext.Locator2;
43
44 /**
45 * @author G. Todd Miller
46 * @author Sunitha Reddy
47 * @author Huizhe Wang
48 * @LastModified: Nov 2017
49 */
50 public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
51
52 private Node _root = null;
53 private Document _document = null;
54 private Node _nextSibling = null;
55 private Stack<Node> _nodeStk = new Stack<>();
56 private List<String> _namespaceDecls = null;
57 private Node _lastSibling = null;
58 private Locator locator = null;
59 private boolean needToSetDocumentInfo = true;
60
61 //Replace StringBuffer with StringBuilder now that we no long support jdk1.4
62 private StringBuilder _textBuffer = new StringBuilder();
63 private Node _nextSiblingCache = null;
64 /**
65 * JAXP document builder factory. Create a single instance and use
66 * synchronization because the Javadoc is not explicit about
67 * thread safety.
68 */
|