286N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 286N/A * Copyright 2005 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * A DTD grammar. This class implements the XNI handler interfaces 286N/A * for DTD information so that it can build the approprate validation 286N/A * structures automatically from the callbacks. 286N/A * @author Jeffrey Rodriguez, IBM 286N/A * @author Andy Clark, IBM 286N/A * @author Neil Graham, IBM 286N/A /** Top level scope (-1). */ 286N/A /** Chunk shift (8). */ 286N/A /** Chunk size (1 << CHUNK_SHIFT). */ 286N/A /** Chunk mask (CHUNK_SIZE - 1). */ 286N/A /** Initial chunk count (1 << (10 - CHUNK_SHIFT)). */ 286N/A /** List flag (0x80). */ 286N/A /** List mask (~LIST_FLAG). */ 286N/A /** Debug DTDGrammar. */ 286N/A /** Current element index. */ 286N/A /** Current attribute index. */ 286N/A /** fReadingExternalDTD */ 286N/A // element declarations 286N/A /** Number of element declarations. */ 286N/A /** Element declaration name. */ 286N/A * Element declaration type. 286N/A /** First attribute declaration of an element declaration. */ 286N/A /** Last attribute declaration of an element declaration. */ 286N/A // attribute declarations 286N/A /** Number of attribute declarations. */ 286N/A /** Attribute declaration name. */ 286N/A * Attribute declaration type. 286N/A * @see XMLAttributeDecl 286N/A /** Attribute declaration enumeration values. */ 286N/A /** Element index mapping table. */ 286N/A /** Temporary qualified name. */ 286N/A /** Temporary Attribute decl. */ 286N/A /** Element declaration. */ 286N/A /** table of XMLElementDecl */ 286N/A /** Default constructor. */ 286N/A * The start of the DTD. 286N/A * @param locator The document locator, or null if the document 286N/A * location cannot be reported during the parsing of 286N/A * the document DTD. However, it is <em>strongly</em> 286N/A * recommended that a locator be supplied that can 286N/A * at least report the base system identifier of the 286N/A * @param augs Additional information that may include infoset 286N/A * @throws XNIException Thrown by handler to signal an error. 286N/A }
// startDTD(XMLLocator) 286N/A // startExternalSubset(Augmentations) 286N/A // endExternalSubset(Augmentations) 286N/A * An element declaration. 286N/A * @param name The name of the element. 286N/A * @param contentModel The element content model. 286N/A * @param augs Additional information that may include infoset 286N/A * @throws XNIException Thrown by handler to signal an error. 286N/A // duplicate element, ignored. 286N/A //add(or set) this elementDecl to the local cache 286N/A * An attribute declaration. 286N/A * @param elementName The name of the element that this attribute 286N/A * @param attributeName The name of the attribute. 286N/A * @param type The attribute type. This value will be one of 286N/A * the following: "CDATA", "ENTITY", "ENTITIES", 286N/A * "ENUMERATION", "ID", "IDREF", "IDREFS", 286N/A * "NMTOKEN", "NMTOKENS", or "NOTATION". 286N/A * @param enumeration If the type has the value "ENUMERATION", this 286N/A * array holds the allowed attribute values; 286N/A * otherwise, this array is null. 286N/A * @param defaultType The attribute default type. This value will be 286N/A * one of the following: "#FIXED", "#IMPLIED", 286N/A * "#REQUIRED", or null. 286N/A * @param defaultValue The attribute default value, or null if no 286N/A * default value is specified. 286N/A * @param nonNormalizedDefaultValue The attribute default value with no normalization 286N/A * performed, or null if no default value is specified. 286N/A * @param augs Additional information that may include infoset 286N/A * @throws XNIException Thrown by handler to signal an error. 286N/A //if ElementDecl has already being created in the Grammar then remove from table, 286N/A //this.fElementDeclTab.remove( (String) elementName ); 286N/A // then it is forward reference to a element decl, create the elementDecl first. 286N/A //add(or set) this elementDecl to the local cache 286N/A //set internal structure 286N/A //Get Grammar index to grammar array 286N/A //return, when more than one definition is provided for the same attribute of given element type 286N/A //only the first declaration is binding and later declarations are ignored 286N/A // REVISIT: Report error message. -Ac 286N/A // REVISIT: The datatype should be stored with the attribute value 286N/A // and not special-cased in the XMLValidator. -Ac 286N/A //fSimpleType.datatypeValidator = fDatatypeValidatorFactory.createDatatypeValidator(type, null, facets, fSimpleType.list); 286N/A }
// attributeDecl(String,String,String,String[],String,XMLString,XMLString, Augmentations) 286N/A /** Returns the symbol table. */ 286N/A }
// getSymbolTable():SymbolTable 286N/A * Returns the index of the first element declaration. This index 286N/A * is then used to query more information about the element declaration. 286N/A * @see #getNextElementDeclIndex 286N/A }
// getFirstElementDeclIndex():int 286N/A * Returns the next index of the element declaration following the 286N/A * specified element declaration. 286N/A * @param elementDeclIndex The element declaration index. 286N/A }
// getNextElementDeclIndex(int):int 286N/A * @param elementDeclName 286N/A * @return index of the elementDeclName in scope 286N/A //System.out.println("getElementDeclIndex("+elementDeclName+") -> "+mapping); 286N/A }
// getElementDeclIndex(String):int 286N/A /** Returns the element decl index. 286N/A * @param elementDeclQName qualilfied name of the element 286N/A }
// getElementDeclIndex(QName):int 286N/A /** make separate function for getting contentSpecType of element. 286N/A * we can avoid setting of the element values. 286N/A * @param elementDeclIndex 286N/A * @param elementDecl The values of this structure are set by this call. 286N/A * @return True if find the element, False otherwise. 286N/A * getFirstAttributeDeclIndex 286N/A * @param elementDeclIndex 286N/A * @return index of the first attribute for element declaration elementDeclIndex 286N/A }
// getFirstAttributeDeclIndex 286N/A * getNextAttributeDeclIndex 286N/A * @param attributeDeclIndex 286N/A * @return index of the next attribute of the attribute at attributeDeclIndex 286N/A * @param attributeDeclIndex 286N/A * @param attributeDecl The values of this structure are set by this call. 286N/A * @return true if getAttributeDecl was able to fill in the value of attributeDecl 286N/A * Returns whether the given attribute is of type CDATA or not 286N/A * @param elName The element name. 286N/A * @param atName The attribute name. 286N/A * @return true if the attribute is of type CDATA 286N/A }
// printAttribute(int) 286N/A * A simple Hashtable implementation that takes a tuple (String, String) 286N/A * as the key and a int as value. 286N/A * @author Andy Clark, IBM 286N/A /** Initial bucket size (4). */ 286N/A // NOTE: Changed previous hashtable size from 512 to 101 so 286N/A // that we get a better distribution for hashing. -Ac 286N/A /** Hashtable size (101). */ 286N/A /** Associates the given value with the specified key tuple. */ 286N/A // REVISIT: Why +2? -Ac 286N/A //System.out.println("put("+key+" -> "+value+')'); 286N/A //System.out.println("get("+key+") -> "+get(key)); 286N/A }
// put(int,String,String,int) 286N/A /** Returns the value associated with the specified key tuple. */ 286N/A }
// get(int,String,String) 286N/A /** Returns a hash value for the specified symbol. */ 286N/A }
// class QNameHashtable 286N/A * Normalize the attribute value of a non CDATA default attribute 286N/A * collapsing sequences of space characters (x20) 286N/A * @param value The value to normalize 286N/A * @return Whether the value was changed or not. 286N/A // take the first whitespace as a space and skip the others 286N/A // simply shift non space chars if needed 286N/A // if we finished on a space trim it 286N/A // set the new value length