Fields Summary |
---|
protected static final String | ERROR_REPORTERProperty identifier: error handler. |
protected static final String | GRAMMAR_POOLProperty identifier: grammar pool . |
protected static final String | ENTITY_RESOLVERProperty identifier: grammar pool . |
protected static final String | XPOINTER_SCHEMA |
private static final String[] | RECOGNIZED_FEATURESRecognized features. |
private static final Boolean[] | FEATURE_DEFAULTSFeature defaults. |
private static final String[] | RECOGNIZED_PROPERTIESRecognized properties. |
private static final Object[] | PROPERTY_DEFAULTSProperty defaults. |
protected XMLDocumentHandler | fDocumentHandler |
protected XMLDocumentSource | fDocumentSource |
protected XIncludeHandler | fParentXIncludeHandler |
protected XMLLocator | fDocLocation |
protected XIncludeNamespaceSupport | fNamespaceContext |
protected XMLErrorReporter | fErrorReporter |
protected XMLGrammarPool | fGrammarPool |
protected XMLGrammarDescription | fGrammarDesc |
protected DTDGrammar | fDTDGrammar |
protected XMLEntityResolver | fEntityResolver |
protected ParserConfigurationSettings | fSettings |
protected StringBuffer | fPointer |
private int | elemCount |
private int | fDepth |
private int | fRootDepth |
private static final int | INITIAL_SIZE |
private boolean[] | fSawInclude |
private boolean[] | fSawFallback |
private int[] | fState |
QName | foundElement |
boolean | skip |
String | fSchemaName |
String | fSchemaPointer |
boolean | fSubResourceIdentified |
Stack | fPointerToken |
int | fCurrentTokenint |
String | fCurrentTokenString |
int | fCurrentTokenType |
Stack | ftempCurrentElement |
int | fElementCount |
int | fCurrentToken |
boolean | includeElement |
Methods Summary |
---|
public void | addQName(com.sun.org.apache.xerces.internal.xni.QName element)
QName cacheQName = new QName(element);
ftempCurrentElement.push(cacheQName);
|
public void | characters(com.sun.org.apache.xerces.internal.xni.XMLString text, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null && includeElement) {
fDocumentHandler.characters(text, augs);
}
|
public boolean | checkIntegerToken(com.sun.org.apache.xerces.internal.xni.QName element)
if(!skip){
fElementCount++;
if(fCurrentTokenint == fElementCount){
if(hasMoreToken()){
fElementCount=0;
fCurrentTokenType = 0;
return true;
}
else{
foundElement = element;
includeElement = true;
fCurrentTokenType = 0;
fElementCount=0;
fSubResourceIdentified =true;
return true;
}
}else{
addQName(element);
skip = true;
return false;
}
}
return false;
|
public boolean | checkStringToken(com.sun.org.apache.xerces.internal.xni.QName element, com.sun.org.apache.xerces.internal.xni.XMLAttributes attributes)
QName cacheQName = null;
String id =null;
String rawname =null;
QName attrName = new QName();
String attrType = null;
String attrValue = null;
int attrCount = attributes.getLength();
for (int i = 0; i < attrCount; i++) {
Augmentations aaugs = attributes.getAugmentations(i);
attributes.getName(i,attrName);
attrType = attributes.getType(i);
attrValue = attributes.getValue(i);
if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
if(hasMoreToken()){
fCurrentTokenType = 0;
fCurrentTokenString = null;
return true;
}
else{
foundElement = element;
includeElement = true;
fCurrentTokenType = 0;
fCurrentTokenString = null;
fSubResourceIdentified = true;
return true;
}
}
}
return false;
|
public void | comment(com.sun.org.apache.xerces.internal.xni.XMLString text, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null && includeElement) {
fDocumentHandler.comment(text, augs);
}
|
public void | doctypeDecl(java.lang.String rootElement, java.lang.String publicId, java.lang.String systemId, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
|
public void | emptyElement(com.sun.org.apache.xerces.internal.xni.QName element, com.sun.org.apache.xerces.internal.xni.XMLAttributes attributes, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if(fDocumentHandler != null && includeElement){
fDocumentHandler.emptyElement(element, attributes, augs);
}
|
public void | endCDATA(com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null && includeElement) {
fDocumentHandler.endCDATA(augs);
}
|
public void | endDocument(com.sun.org.apache.xerces.internal.xni.Augmentations augs)
|
public void | endElement(com.sun.org.apache.xerces.internal.xni.QName element, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if(includeElement && foundElement != null ){
if(elemCount >0 )elemCount --;
fDocumentHandler.endElement(element, augs);
if(elemCount == 0)includeElement = false;
}else if(!ftempCurrentElement.empty()){
QName name = (QName)ftempCurrentElement.peek();
if(name.equals(element)){
ftempCurrentElement.pop();
skip = false;
}
}
|
public void | endGeneralEntity(java.lang.String name, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null) {
fDocumentHandler.endGeneralEntity(name, augs);
}
|
public com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler | getDocumentHandler()
return fDocumentHandler;
|
public com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource | getDocumentSource()
return fDocumentSource;
|
public java.lang.Boolean | getFeatureDefault(java.lang.String featureId)Returns the default state for a feature, or null if this
component does not want to report a default value for this
feature.
for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
if (RECOGNIZED_FEATURES[i].equals(featureId)) {
return FEATURE_DEFAULTS[i];
}
}
return null;
|
public boolean | getNextToken()
Object currentToken;
if (!fPointerToken.isEmpty()){
currentToken = fPointerToken.pop();
if(currentToken instanceof Integer){
fCurrentTokenint = ((Integer)currentToken).intValue();
fCurrentTokenType = 1;
}
else{
fCurrentTokenString = ((String)currentToken).toString();
fCurrentTokenType = 2;
}
return true;
}
else {
return false;
}
|
public java.lang.Object | getParent()return the Parent Contenthandler
return fParentXIncludeHandler;
|
public java.lang.Object | getPropertyDefault(java.lang.String propertyId)Returns the default state for a property, or null if this
component does not want to report a default value for this
property.
for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
return PROPERTY_DEFAULTS[i];
}
}
return null;
|
public java.lang.String[] | getRecognizedFeatures()Returns a list of feature identifiers that are recognized by
this component. This method may return null if no features
are recognized by this component.
return RECOGNIZED_FEATURES;
|
public java.lang.String[] | getRecognizedProperties()Returns a list of property identifiers that are recognized by
this component. This method may return null if no properties
are recognized by this component.
return RECOGNIZED_PROPERTIES;
|
public void | getTokens()// 0 Notype; 1 for integer; 2 for string.
fSchemaPointer = fSchemaPointer.substring(fSchemaPointer.indexOf("(")+1, fSchemaPointer.length());
StringTokenizer st = new StringTokenizer(fSchemaPointer, "/");
String tempToken;
Integer integerToken =null;
Stack tempPointerToken = new Stack();
if(fPointerToken == null){
fPointerToken = new Stack();
}
while(st.hasMoreTokens()){
tempToken=st.nextToken();
try {
integerToken = Integer.valueOf(tempToken);
tempPointerToken.push(integerToken);
}catch(NumberFormatException e){
tempPointerToken.push(tempToken);
}
}
while(!tempPointerToken.empty()){
fPointerToken.push(tempPointerToken.pop());
}
|
public java.lang.String | getXPointerSchemaPointer()Return the XPointer Schema.
return fSchemaPointer;
|
public java.lang.String | getXpointerSchemaName()Return Schema Name eg element , xpointer
return fSchemaName;
|
public boolean | hasMoreToken()
if(fPointerToken.isEmpty())
return false;
else
return true;
|
public void | ignorableWhitespace(com.sun.org.apache.xerces.internal.xni.XMLString text, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null && includeElement) {
fDocumentHandler.ignorableWhitespace(text, augs);
}
|
private boolean | isIdAttribute(com.sun.org.apache.xerces.internal.xni.XMLAttributes attributes, com.sun.org.apache.xerces.internal.xni.Augmentations augs, int index)
Object o = augs.getItem(Constants.ID_ATTRIBUTE);
if( o instanceof Boolean )
return ((Boolean)o).booleanValue();
return "ID".equals(attributes.getType(index));
|
protected boolean | isRootDocument()
return this.fParentXIncludeHandler == null;
|
public boolean | isSubResourceIndentified()
return fSubResourceIdentified;
|
public void | processingInstruction(java.lang.String target, com.sun.org.apache.xerces.internal.xni.XMLString data, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null && includeElement) {
fDocumentHandler.processingInstruction(target, data, augs);
}
|
protected void | reportFatalError(java.lang.String key)
this.reportFatalError(key, null);
|
protected void | reportFatalError(java.lang.String key, java.lang.Object[] args)
if (fErrorReporter != null) {
fErrorReporter.reportError(
fDocLocation,
XIncludeMessageFormatter.XINCLUDE_DOMAIN,
key,
args,
XMLErrorReporter.SEVERITY_FATAL_ERROR);
}
// we won't worry about when error reporter is null, since there should always be
// at least the default error reporter
|
public void | reset()
elemCount =0;
fPointerToken = null;
fCurrentTokenint=0;
fCurrentTokenString=null;
fCurrentTokenType=0 ;
fElementCount =0;
fCurrentToken =0;
includeElement = false;
foundElement = null;
skip = false;
fSubResourceIdentified=false;
|
public void | reset(com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager componentManager)
fNamespaceContext = null;
elemCount =0;
fDepth = 0;
fRootDepth = 0;
fPointerToken = null;
fCurrentTokenint=0;
fCurrentTokenString=null;
fCurrentTokenType=0 ;
foundElement = null;
includeElement = false;
skip = false;
fSubResourceIdentified=false;
try {
setErrorReporter(
(XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER));
}
catch (XMLConfigurationException e) {
fErrorReporter = null;
}
try {
fGrammarPool =
(XMLGrammarPool)componentManager.getProperty(GRAMMAR_POOL);
}
catch (XMLConfigurationException e) {
fGrammarPool = null;
}
try {
fEntityResolver =
(XMLEntityResolver)componentManager.getProperty(
ENTITY_RESOLVER);
}
catch (XMLConfigurationException e) {
fEntityResolver = null;
}
fSettings = new ParserConfigurationSettings();
Enumeration xercesFeatures = Constants.getXercesFeatures();
while (xercesFeatures.hasMoreElements()) {
String featureId = (String)xercesFeatures.nextElement();
fSettings.addRecognizedFeatures(new String[] { featureId });
try {
fSettings.setFeature(
featureId,
componentManager.getFeature(featureId));
}
catch (XMLConfigurationException e) {
// componentManager doesn't support this feature,
// so we won't worry about it
}
}
/* try{
dtdValidator = (XMLDTDValidator)componentManager.getProperty( Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_VALIDATOR_PROPERTY);
}Catch(Exception ex){
ex.printStackTrace();
}*/
|
public void | setDocumentHandler(com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler handler)
fDocumentHandler = handler;
|
public void | setDocumentSource(com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource source)
fDocumentSource = source;
|
private void | setErrorReporter(com.sun.org.apache.xerces.internal.impl.XMLErrorReporter reporter)
fErrorReporter = reporter;
if (fErrorReporter != null) {
fErrorReporter.putMessageFormatter(
XIncludeMessageFormatter.XINCLUDE_DOMAIN,
new XIncludeMessageFormatter());
}
|
public void | setFeature(java.lang.String featureId, boolean state)Sets the state of a feature. This method is called by the component
manager any time after reset when a feature changes state.
Note: Components should silently ignore features
that do not affect the operation of the component.
if (fSettings != null) {
fSettings.setFeature(featureId, state);
}
|
public void | setParent(java.lang.Object parent)Parent Contenhandler for the this contenthandler.
// not sure about the parameter type. It can be Contenthandler instead of Object type.
fParentXIncludeHandler = (XIncludeHandler)parent;
|
public void | setProperty(java.lang.String propertyId, java.lang.Object value)Sets the value of a property. This method is called by the component
manager any time after reset when a property changes value.
Note: Components should silently ignore properties
that do not affect the operation of the component.
if (propertyId.equals(ERROR_REPORTER)) {
setErrorReporter((XMLErrorReporter)value);
}
if (propertyId.equals(GRAMMAR_POOL)) {
fGrammarPool = (XMLGrammarPool)value;
}
if (propertyId.equals(ENTITY_RESOLVER)) {
fEntityResolver = (XMLEntityResolver)value;
}
|
public void | setXPointerSchemaName(java.lang.String schemaName)set the Schema Name eg element , xpointer
fSchemaName = schemaName;
|
public void | setXPointerSchemaPointer(java.lang.String content)Content of the XPointer Schema. Xpath to be resolved.
fSchemaPointer = content;
|
public void | startCDATA(com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null && includeElement) {
fDocumentHandler.startCDATA(augs);
}
|
public void | startDocument(com.sun.org.apache.xerces.internal.xni.XMLLocator locator, java.lang.String encoding, com.sun.org.apache.xerces.internal.xni.NamespaceContext namespaceContext, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
getTokens();
|
public void | startElement(com.sun.org.apache.xerces.internal.xni.QName element, com.sun.org.apache.xerces.internal.xni.XMLAttributes attributes, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
boolean requiredToken=false;
if(fCurrentTokenType == 0)
getNextToken();
if(fCurrentTokenType ==1)
requiredToken = checkIntegerToken(element);
else if (fCurrentTokenType ==2)
requiredToken = checkStringToken(element, attributes);
if(requiredToken && hasMoreToken())
getNextToken();
if(fDocumentHandler != null && includeElement){
elemCount++;
fDocumentHandler.startElement(element, attributes, augs);
}
|
public void | startGeneralEntity(java.lang.String name, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier resId, java.lang.String encoding, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null && includeElement) {
fDocumentHandler.startGeneralEntity(name, resId, encoding, augs);
}
|
public void | textDecl(java.lang.String version, java.lang.String encoding, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null && includeElement) {
fDocumentHandler.textDecl(version, encoding, augs);
}
|
public void | xmlDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
|