1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Oct 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 package com.sun.org.apache.xml.internal.dtm.ref;
23
43 * to store information from the xml document in an array based
44 * dtm table structure. This informtion is used later for document navigation,
45 * query, and SAX event dispatch functions. The DTM can also be used directly as a
46 * document composition model for an application. The requests received are:
47 * <ul>
48 * <li>initiating DTM to set the doc handle</li>
49 * <li>resetting DTM for data structure reuse</li>
50 * <li>hinting the end of document to adjust the end of data structure pointers</li>
51 * <li>createnodes (element, comment, text, attribute, ....)</li>
52 * <li>hinting the end of an element to patch parent and siblings<li>
53 * <li>setting application provided symbol name stringpool data structures</li>
54 * </ul>
55 * <p>State: In progress!!</p>
56 *
57 * %REVIEW% I _think_ the SAX convention is that "no namespace" is expressed
58 * as "" rather than as null (which is the DOM's convention). What should
59 * DTM expect? What should it do with the other?
60 *
61 * <p>Origin: the implemention is a composite logic based on the DTM of XalanJ1 and
62 * DocImpl, DocumentImpl, ElementImpl, TextImpl, etc. of XalanJ2</p>
63 */
64 public class DTMDocumentImpl
65 implements DTM, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler
66 {
67
68 // Number of lower bits used to represent node index.
69 protected static final byte DOCHANDLE_SHIFT = 22;
70 // Masks the lower order of node handle.
71 // Same as {@link DTMConstructor.IDENT_NODE_DEFAULT}
72 protected static final int NODEHANDLE_MASK = (1 << (DOCHANDLE_SHIFT + 1)) - 1;
73 // Masks the higher order Document handle
74 // Same as {@link DTMConstructor.IDENT_DOC_DEFAULT}
75 protected static final int DOCHANDLE_MASK = -1 - NODEHANDLE_MASK;
76
77 int m_docHandle = NULL; // masked document handle for this dtm document
78 int m_docElement = NULL; // nodeHandle to the root of the actual dtm doc content
79
80 // Context for parse-and-append operations
81 int currentParent = 0; // current parent - default is document root
82 int previousSibling = 0; // previous sibling - no previous sibling
|
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 package com.sun.org.apache.xml.internal.dtm.ref;
22
42 * to store information from the xml document in an array based
43 * dtm table structure. This informtion is used later for document navigation,
44 * query, and SAX event dispatch functions. The DTM can also be used directly as a
45 * document composition model for an application. The requests received are:
46 * <ul>
47 * <li>initiating DTM to set the doc handle</li>
48 * <li>resetting DTM for data structure reuse</li>
49 * <li>hinting the end of document to adjust the end of data structure pointers</li>
50 * <li>createnodes (element, comment, text, attribute, ....)</li>
51 * <li>hinting the end of an element to patch parent and siblings<li>
52 * <li>setting application provided symbol name stringpool data structures</li>
53 * </ul>
54 * <p>State: In progress!!</p>
55 *
56 * %REVIEW% I _think_ the SAX convention is that "no namespace" is expressed
57 * as "" rather than as null (which is the DOM's convention). What should
58 * DTM expect? What should it do with the other?
59 *
60 * <p>Origin: the implemention is a composite logic based on the DTM of XalanJ1 and
61 * DocImpl, DocumentImpl, ElementImpl, TextImpl, etc. of XalanJ2</p>
62 *
63 * @LastModified: Oct 2017
64 */
65 public class DTMDocumentImpl
66 implements DTM, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler
67 {
68
69 // Number of lower bits used to represent node index.
70 protected static final byte DOCHANDLE_SHIFT = 22;
71 // Masks the lower order of node handle.
72 // Same as {@link DTMConstructor.IDENT_NODE_DEFAULT}
73 protected static final int NODEHANDLE_MASK = (1 << (DOCHANDLE_SHIFT + 1)) - 1;
74 // Masks the higher order Document handle
75 // Same as {@link DTMConstructor.IDENT_DOC_DEFAULT}
76 protected static final int DOCHANDLE_MASK = -1 - NODEHANDLE_MASK;
77
78 int m_docHandle = NULL; // masked document handle for this dtm document
79 int m_docElement = NULL; // nodeHandle to the root of the actual dtm doc content
80
81 // Context for parse-and-append operations
82 int currentParent = 0; // current parent - default is document root
83 int previousSibling = 0; // previous sibling - no previous sibling
|