325N/A/*
325N/A * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.xml.internal.stream.buffer;
325N/A
325N/Aimport java.util.Map;
325N/A
325N/A/**
325N/A * A mark into a buffer.
325N/A *
325N/A * <p>
325N/A * A mark can be processed in the same manner as a XMLStreamBuffer.
325N/A *
325N/A * <p>
325N/A * A mark will share a sub set of information of the buffer that is
325N/A * marked. If the buffer is directly or indirectly associated with a
325N/A * (mutable) {@link XMLStreamBuffer} which is reset and/or re-created
325N/A * then this will invalidate the mark and processing behvaiour of the mark
325N/A * is undefined. It is the responsibility of the application to manage the
325N/A * relationship between the marked XMLStreamBuffer and one or more marks.
325N/A */
325N/Apublic class XMLStreamBufferMark extends XMLStreamBuffer {
325N/A
325N/A /**
325N/A * Create a mark from the buffer that is being created.
325N/A *
325N/A * <p>
325N/A * A mark will be created from the current position of creation of the
325N/A * {@link XMLStreamBuffer} that is being created by a {@link AbstractCreator}.
325N/A *
325N/A * @param inscopeNamespaces
325N/A * The in-scope namespaces on the fragment of XML infoset that is
325N/A * to be marked.
325N/A *
325N/A * @param src
325N/A * The {@link AbstractCreator} or {@link AbstractProcessor} from which the current
325N/A * position of creation of the XMLStreamBuffer will be taken as the mark.
325N/A */
325N/A public XMLStreamBufferMark(Map<String,String> inscopeNamespaces, AbstractCreatorProcessor src) {
325N/A if(inscopeNamespaces != null) {
325N/A _inscopeNamespaces = inscopeNamespaces;
325N/A }
325N/A
325N/A _structure = src._currentStructureFragment;
325N/A _structurePtr = src._structurePtr;
325N/A
325N/A _structureStrings = src._currentStructureStringFragment;
325N/A _structureStringsPtr = src._structureStringsPtr;
325N/A
325N/A _contentCharactersBuffer = src._currentContentCharactersBufferFragment;
325N/A _contentCharactersBufferPtr = src._contentCharactersBufferPtr;
325N/A
325N/A _contentObjects = src._currentContentObjectFragment;
325N/A _contentObjectsPtr = src._contentObjectsPtr;
325N/A treeCount = 1; // TODO: define a way to create a mark over a forest
325N/A }
325N/A}