/*
*/
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author Eric Ye, IBM
* @author Andy Clark, IBM
* @author Jeffrey Rodriguez IBM
* @author Neil Graham, IBM
* @author Sunitha Reddy, Sun Microsystems
*/
public class DTDGrammarUtil {
/** Property identifier: symbol table. */
/** Compile to true to debug attributes. */
private static final boolean DEBUG_ATTRIBUTES = false;
/** Compile to true to debug element children. */
private static final boolean DEBUG_ELEMENT_CHILDREN = false;
/** Namespaces. */
protected boolean fNamespaces;
/** Symbol table. */
/** Current element index. */
/** Current content spec type. */
/** Content spec type stack. */
/** Element depth. */
/** True if inside of element content. */
private boolean fInElementContent = false;
/** Temporary atribute declaration. */
/** Temporary qualified name. */
/** Temporary string buffers. */
/** Default constructor. */
}
}
}
/*
* Resets the component. The component can query the component manager
* about any features and properties that affect the operation of the
* component.
*
* @param componentManager The component manager.
*
* @throws SAXException Thrown by component on finitialization error.
* For example, if a feature or property is
* required for the operation of the component, the
* component manager may throw a
* SAXNotRecognizedException or a
* SAXNotSupportedException.
*/
throws XMLConfigurationException {
fDTDGrammar = null;
fInElementContent = false;
fCurrentElementIndex = -1;
fCurrentContentSpecType = -1;
fElementDepth = -1;
}
/**
* The start of an element.
*
* @param element The name of the element.
* @param attributes The element attributes.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
}
/**
* The end of an element.
*
* @param element The name of the element.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
}
/**
* The start of a CDATA section.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
}
/**
* The end of a CDATA section.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
}
/** Add default attributes and validate. */
throws XNIException {
int elementIndex;
// is there anything to do?
return;
}
//
// Check after all specified attrs are scanned
// (1) report error for REQUIRED attrs that are missing (V_TAGc)
// (2) add default attrs (FIXED and NOT_FIXED)
//
while (attlistIndex != -1) {
if (DEBUG_ATTRIBUTES) {
if (fTempAttDecl != null) {
);
}
}
}
boolean specified = false;
//check whether attribute is a namespace declaration
if (pos != -1) {
} else {
prefix = attRawName;
}
}
specified = true;
} else {
for (int i = 0; i < attrCount; i++) {
specified = true;
break;
}
}
}
}
if (!specified) {
if (fNamespaces) {
if (index != -1) {
}
}
attValue);
}
}
}
// now iterate through the expanded attributes for
// 1. if every attribute seen is declared in the DTD
// 2. check if the VC: default_fixed holds
// 3. validate every attribute.
for (int i = 0; i < attrCount; i++) {
boolean declared = false;
int position =
while (position != -1) {
// found the match att decl,
declared = true;
break;
}
}
if (!declared) {
continue;
}
boolean changedByNormalization = false;
}
} // for all attributes
} // addDTDDefaultAttrsAndValidate(int,XMLAttrList)
/**
* Normalize the attribute value of a non CDATA attributes collapsing
* sequences of space characters (x20)
*
* @param attributes The list of attributes
* @param index The index of the attribute to normalize
*/
// vars
boolean leadingSpace = true;
boolean spaceStart = false;
boolean readingNonSpace = false;
int count = 0;
int eaten = 0;
if (attValue[i] == ' ') {
// now the tricky part
if (readingNonSpace) {
spaceStart = true;
readingNonSpace = false;
}
if (spaceStart && !leadingSpace) {
spaceStart = false;
count++;
} else {
if (leadingSpace || !spaceStart) {
eaten++;
}
}
} else {
readingNonSpace = true;
spaceStart = false;
leadingSpace = false;
count++;
}
}
// check if the last appended character is a space.
}
}
/** convert attribute type from ints to strings */
case XMLSimpleType.TYPE_ENTITY: {
}
case XMLSimpleType.TYPE_ENUMERATION: {
if (i > 0) {
}
}
}
case XMLSimpleType.TYPE_ID: {
return XMLSymbols.fIDSymbol;
}
case XMLSimpleType.TYPE_IDREF: {
}
case XMLSimpleType.TYPE_NMTOKEN: {
}
case XMLSimpleType.TYPE_NOTATION: {
return XMLSymbols.fNOTATIONSymbol;
}
}
return XMLSymbols.fCDATASymbol;
}
/** ensure element stack capacity */
}
}
/** Handle element
* @return true if validator is removed from the pipeline
*/
if (fDTDGrammar == null) {
fCurrentElementIndex = -1;
fCurrentContentSpecType = -1;
fInElementContent = false;
return;
} else {
//handleDTDDefaultAttrs(element,attributes);
}
}
/** Handle end element. */
if (fDTDGrammar == null) return;
if (fElementDepth < -1) {
throw new RuntimeException("FWK008 Element stack underflow");
}
if (fElementDepth < 0) {
fCurrentElementIndex = -1;
fCurrentContentSpecType = -1;
fInElementContent = false;
return;
}
}
public boolean isInElementContent() {
return fInElementContent;
}
if (isInElementContent()) {
return false;
}
}
return true;
}
return false;
}
}