XMLTokenFactory.java revision fb379c70e3fd8a537f311b99be4759ae41e02750
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * The contents of this file are subject to the terms
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * of the Common Development and Distribution License
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * (the License). You may not use this file except in
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * compliance with the License.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * You can obtain a copy of the License at
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * https://opensso.dev.java.net/public/CDDLv1.0.html or
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * See the License for the specific language governing
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * permission and limitations under the License.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * When distributing Covered Code, include this CDDL
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Header Notice in each file and include the License file
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * If applicable, add the following below the CDDL Header,
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * with the fields enclosed by brackets [] replaced by
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * your own identifying information:
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * "Portions Copyrighted [year] [name of copyright owner]"
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * $Id: XMLTokenFactory.java,v 1.2 2008/06/25 05:51:32 qcheng Exp $
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * A token factory is responsible for the creation of the associated token
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * handlers or <code>Token</code> objects given string fragments as parsed
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * from the XML document source. This factory is used by the parser to generate
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * the tokens when strings matching the syntactic rules of XML are identified
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * during the first parsing or scanning phase. The token factory is also
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * responsible for assigning unique identification index numbers to tokens that
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * is used by the parser and later by the document itself in order to create
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * new elements for addition as necessary.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncpublic class XMLTokenFactory implements IXMLUtilsConstants {
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Returns a <code>Token</code> handler which can be used to model the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * given token string.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * @param tokenString
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * the string fragment that needs to be processed for the second
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * phase of parsing
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * @return a <code>Token</code> object which is nothing but a handler for
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * the given string fragment which can be used to further handle
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * the given string framgment.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * @throws Exception
return result;
int getNextTokenIndex() {
return tokenIndex++;