01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the "License"). You may not use this file except
05: * in compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://jwsdp.dev.java.net/CDDLv1.0.html
09: * See the License for the specific language governing
10: * permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL
13: * HEADER in each file and include the License file at
14: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
15: * add the following below this CDDL HEADER, with the
16: * fields enclosed by brackets "[]" replaced with your
17: * own identifying information: Portions Copyright [yyyy]
18: * [name of copyright owner]
19: */
20: package com.sun.xml.stream.buffer;
21:
22: import java.util.Map;
23:
24: /**
25: * A mark into a buffer.
26: *
27: * <p>
28: * A mark can be processed in the same manner as a XMLStreamBuffer.
29: *
30: * <p>
31: * A mark will share a sub set of information of the buffer that is
32: * marked. If the buffer is directly or indirectly associated with a
33: * (mutable) {@link XMLStreamBuffer} which is reset and/or re-created
34: * then this will invalidate the mark and processing behvaiour of the mark
35: * is undefined. It is the responsibility of the application to manage the
36: * relationship between the marked XMLStreamBuffer and one or more marks.
37: */
38: public class XMLStreamBufferMark extends XMLStreamBuffer {
39:
40: /**
41: * Create a mark from the buffer that is being created.
42: *
43: * <p>
44: * A mark will be created from the current position of creation of the
45: * {@link XMLStreamBuffer} that is being created by a {@link AbstractCreator}.
46: *
47: * @param inscopeNamespaces
48: * The in-scope namespaces on the fragment of XML infoset that is
49: * to be marked.
50: *
51: * @param src
52: * The {@link AbstractCreator} or {@link AbstractProcessor} from which the current
53: * position of creation of the XMLStreamBuffer will be taken as the mark.
54: */
55: public XMLStreamBufferMark(Map<String, String> inscopeNamespaces,
56: AbstractCreatorProcessor src) {
57: _inscopeNamespaces = inscopeNamespaces;
58:
59: _structure = src._currentStructureFragment;
60: _structurePtr = src._structurePtr;
61:
62: _structureStrings = src._currentStructureStringFragment;
63: _structureStringsPtr = src._structureStringsPtr;
64:
65: _contentCharactersBuffer = src._currentContentCharactersBufferFragment;
66: _contentCharactersBufferPtr = src._contentCharactersBufferPtr;
67:
68: _contentObjects = src._currentContentObjectFragment;
69: _contentObjectsPtr = src._contentObjectsPtr;
70: treeCount = 1; // TODO: define a way to create a mark over a forest
71: }
72: }
|