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.dom2dtm;
23
45 import org.w3c.dom.Document;
46 import org.w3c.dom.DocumentType;
47 import org.w3c.dom.Element;
48 import org.w3c.dom.Entity;
49 import org.w3c.dom.NamedNodeMap;
50 import org.w3c.dom.Node;
51 import org.xml.sax.ContentHandler;
52
53 /** The <code>DOM2DTM</code> class serves up a DOM's contents via the
54 * DTM API.
55 *
56 * Note that it doesn't necessarily represent a full Document
57 * tree. You can wrap a DOM2DTM around a specific node and its subtree
58 * and the right things should happen. (I don't _think_ we currently
59 * support DocumentFrgment nodes as roots, though that might be worth
60 * considering.)
61 *
62 * Note too that we do not currently attempt to track document
63 * mutation. If you alter the DOM after wrapping DOM2DTM around it,
64 * all bets are off.
65 * */
66 public class DOM2DTM extends DTMDefaultBaseIterators
67 {
68 static final boolean JJK_DEBUG=false;
69 static final boolean JJK_NEWCODE=true;
70
71 /** Manefest constant
72 */
73 static final String NAMESPACE_DECL_NS="http://www.w3.org/XML/1998/namespace";
74
75 /** The current position in the DOM tree. Last node examined for
76 * possible copying to DTM. */
77 transient private Node m_pos;
78 /** The current position in the DTM tree. Who children get appended to. */
79 private int m_last_parent=0;
80 /** The current position in the DTM tree. Who children reference as their
81 * previous sib. */
82 private int m_last_kid=NULL;
83
84 /** The top of the subtree.
85 * %REVIEW%: 'may not be the same as m_context if "//foo" pattern.'
|
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.dom2dtm;
22
44 import org.w3c.dom.Document;
45 import org.w3c.dom.DocumentType;
46 import org.w3c.dom.Element;
47 import org.w3c.dom.Entity;
48 import org.w3c.dom.NamedNodeMap;
49 import org.w3c.dom.Node;
50 import org.xml.sax.ContentHandler;
51
52 /** The <code>DOM2DTM</code> class serves up a DOM's contents via the
53 * DTM API.
54 *
55 * Note that it doesn't necessarily represent a full Document
56 * tree. You can wrap a DOM2DTM around a specific node and its subtree
57 * and the right things should happen. (I don't _think_ we currently
58 * support DocumentFrgment nodes as roots, though that might be worth
59 * considering.)
60 *
61 * Note too that we do not currently attempt to track document
62 * mutation. If you alter the DOM after wrapping DOM2DTM around it,
63 * all bets are off.
64 *
65 * @LastModified: Oct 2017
66 */
67 public class DOM2DTM extends DTMDefaultBaseIterators
68 {
69 static final boolean JJK_DEBUG=false;
70 static final boolean JJK_NEWCODE=true;
71
72 /** Manefest constant
73 */
74 static final String NAMESPACE_DECL_NS="http://www.w3.org/XML/1998/namespace";
75
76 /** The current position in the DOM tree. Last node examined for
77 * possible copying to DTM. */
78 transient private Node m_pos;
79 /** The current position in the DTM tree. Who children get appended to. */
80 private int m_last_parent=0;
81 /** The current position in the DTM tree. Who children reference as their
82 * previous sib. */
83 private int m_last_kid=NULL;
84
85 /** The top of the subtree.
86 * %REVIEW%: 'may not be the same as m_context if "//foo" pattern.'
|