Methods Summary |
---|
protected void | addNotation(java.lang.String name, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier identifier, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)Caches a notation.
Notation not = new Notation();
not.name = name;
not.systemId = identifier.getLiteralSystemId();
not.publicId = identifier.getPublicId();
not.baseURI = identifier.getBaseSystemId();
not.augmentations = augmentations;
fNotations.add(not);
|
protected void | addUnparsedEntity(java.lang.String name, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier identifier, java.lang.String notation, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)Caches an unparsed entity.
UnparsedEntity ent = new UnparsedEntity();
ent.name = name;
ent.systemId = identifier.getLiteralSystemId();
ent.publicId = identifier.getPublicId();
ent.baseURI = identifier.getBaseSystemId();
ent.notation = notation;
ent.augmentations = augmentations;
fUnparsedEntities.add(ent);
|
public void | attributeDecl(java.lang.String elementName, java.lang.String attributeName, java.lang.String type, java.lang.String[] enumeration, java.lang.String defaultType, com.sun.org.apache.xerces.internal.xni.XMLString defaultValue, com.sun.org.apache.xerces.internal.xni.XMLString nonNormalizedDefaultValue, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.attributeDecl(
elementName,
attributeName,
type,
enumeration,
defaultType,
defaultValue,
nonNormalizedDefaultValue,
augmentations);
}
|
public void | characters(com.sun.org.apache.xerces.internal.xni.XMLString text, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
// we need to change the depth like this so that modifyAugmentations() works
fDepth++;
augs = modifyAugmentations(augs);
fDocumentHandler.characters(text, augs);
fDepth--;
}
|
protected void | checkAndSendNotation(com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler$Notation not)The purpose of this method is to check if a Notation conflicts with a previously
declared notation in the current pipeline stack. If there is no conflict, the
Notation is sent by the root pipeline.
if (isRootDocument()) {
int index = fNotations.indexOf(not);
if (index == -1) {
// There is no notation with the same name that we have sent.
XMLResourceIdentifier id =
new XMLResourceIdentifierImpl(
not.publicId,
not.systemId,
not.baseURI,
null);
this.addNotation(not.name, id, not.augmentations);
if (fSendUEAndNotationEvents && fDTDHandler != null) {
fDTDHandler.notationDecl(not.name, id, not.augmentations);
}
}
else {
Notation localNotation = (Notation)fNotations.get(index);
if (!not.isDuplicate(localNotation)) {
reportFatalError(
"NonDuplicateNotation",
new Object[] { not.name });
}
}
}
else {
fParentXIncludeHandler.checkAndSendNotation(not);
}
|
protected void | checkAndSendUnparsedEntity(com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler$UnparsedEntity ent)The purpose of this method is to check if an UnparsedEntity conflicts with a previously
declared entity in the current pipeline stack. If there is no conflict, the
UnparsedEntity is sent by the root pipeline.
if (isRootDocument()) {
int index = fUnparsedEntities.indexOf(ent);
if (index == -1) {
// There is no unparsed entity with the same name that we have sent.
// Calling unparsedEntityDecl() will add the entity to our local store,
// and also send the unparsed entity to the DTDHandler
XMLResourceIdentifier id =
new XMLResourceIdentifierImpl(
ent.publicId,
ent.systemId,
ent.baseURI,
null);
this.addUnparsedEntity(
ent.name,
id,
ent.notation,
ent.augmentations);
if (fSendUEAndNotationEvents && fDTDHandler != null) {
fDTDHandler.unparsedEntityDecl(
ent.name,
id,
ent.notation,
ent.augmentations);
}
}
else {
UnparsedEntity localEntity =
(UnparsedEntity)fUnparsedEntities.get(index);
if (!ent.isDuplicate(localEntity)) {
reportFatalError(
"NonDuplicateUnparsedEntity",
new Object[] { ent.name });
}
}
}
else {
fParentXIncludeHandler.checkAndSendUnparsedEntity(ent);
}
|
protected void | checkNotation(java.lang.String notName)Checks if a Notation with the given name was declared in the DTD of the document
for the current pipeline. If so, that Notation is passed to the root pipeline to
be checked for conflicts, and sent to the root DTDHandler
Notation not = new Notation();
not.name = notName;
int index = fNotations.indexOf(not);
if (index != -1) {
not = (Notation)fNotations.get(index);
checkAndSendNotation(not);
}
|
protected void | checkUnparsedEntity(java.lang.String entName)Checks if an UnparsedEntity with the given name was declared in the DTD of the document
for the current pipeline. If so, then the notation for the UnparsedEntity is checked.
If that turns out okay, then the UnparsedEntity is passed to the root pipeline to
be checked for conflicts, and sent to the root DTDHandler.
UnparsedEntity ent = new UnparsedEntity();
ent.name = entName;
int index = fUnparsedEntities.indexOf(ent);
if (index != -1) {
ent = (UnparsedEntity)fUnparsedEntities.get(index);
// first check the notation of the unparsed entity
checkNotation(ent.notation);
checkAndSendUnparsedEntity(ent);
}
|
public void | comment(com.sun.org.apache.xerces.internal.xni.XMLString text, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (!fInDTD) {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
fDepth++;
augs = modifyAugmentations(augs);
fDocumentHandler.comment(text, augs);
fDepth--;
}
}
else if (fDTDHandler != null) {
fDTDHandler.comment(text, augs);
}
|
protected void | copyFeatures(com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager from, com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings to)
Enumeration features = Constants.getXercesFeatures();
copyFeatures1(features, Constants.XERCES_FEATURE_PREFIX, from, to);
features = Constants.getSAXFeatures();
copyFeatures1(features, Constants.SAX_FEATURE_PREFIX, from, to);
|
protected void | copyFeatures(com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager from, com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration to)
Enumeration features = Constants.getXercesFeatures();
copyFeatures1(features, Constants.XERCES_FEATURE_PREFIX, from, to);
features = Constants.getSAXFeatures();
copyFeatures1(features, Constants.SAX_FEATURE_PREFIX, from, to);
|
private void | copyFeatures1(java.util.Enumeration features, java.lang.String featurePrefix, com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager from, com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings to)
while (features.hasMoreElements()) {
String featureId = featurePrefix + (String)features.nextElement();
to.addRecognizedFeatures(new String[] { featureId });
try {
to.setFeature(featureId, from.getFeature(featureId));
}
catch (XMLConfigurationException e) {
// componentManager doesn't support this feature,
// so we won't worry about it
}
}
|
private void | copyFeatures1(java.util.Enumeration features, java.lang.String featurePrefix, com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager from, com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration to)
while (features.hasMoreElements()) {
String featureId = featurePrefix + (String)features.nextElement();
boolean value = from.getFeature(featureId);
try {
to.setFeature(featureId, value);
}
catch (XMLConfigurationException e) {
// componentManager doesn't support this feature,
// so we won't worry about it
}
}
|
protected com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration | createXPointerParser()
XMLParserConfiguration childConfig =
(XMLParserConfiguration)ObjectFactory.newInstance(
XPOINTER_DEFAULT_CONFIGURATION,
ObjectFactory.findClassLoader(),
true);
childConfig.setProperty(ERROR_REPORTER, fErrorReporter);
childConfig.setProperty(
Constants.XERCES_PROPERTY_PREFIX
+ Constants.NAMESPACE_CONTEXT_PROPERTY,
fNamespaceContext);
copyFeatures(fSettings, childConfig);
return childConfig;
|
public void | doctypeDecl(java.lang.String rootElement, java.lang.String publicId, java.lang.String systemId, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (isRootDocument() && fDocumentHandler != null) {
fDocumentHandler.doctypeDecl(rootElement, publicId, systemId, augs);
}
|
public void | elementDecl(java.lang.String name, java.lang.String contentModel, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.elementDecl(name, contentModel, augmentations);
}
|
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)
fDepth++;
setState(getState(fDepth - 1));
// we process the xml:base attributes regardless of what type of element it is
processXMLBaseAttributes(attributes);
if (isIncludeElement(element)) {
boolean success = this.handleIncludeElement(attributes);
if (success) {
setState(STATE_IGNORE);
}
else {
reportFatalError("NoFallback");
}
}
else if (isFallbackElement(element)) {
this.handleFallbackElement();
}
else if (hasXIncludeNamespace(element)) {
if (getSawInclude(fDepth - 1)) {
reportFatalError(
"IncludeChild",
new Object[] { element.rawname });
}
}
else if (
fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
augs = modifyAugmentations(augs);
attributes = processAttributes(attributes);
fDocumentHandler.emptyElement(element, attributes, augs);
}
// reset the out of scope stack elements
setSawFallback(fDepth + 1, false);
setSawInclude(fDepth + 1, false);
// check if an xml:base has gone out of scope
if (baseURIScope.size() > 0 && fDepth == baseURIScope.peek()) {
// pop the values from the stack
restoreBaseURI();
}
fDepth--;
|
public void | endAttlist(com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.endAttlist(augmentations);
}
|
public void | endCDATA(com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
fDocumentHandler.endCDATA(augs);
}
|
public void | endConditional(com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.endConditional(augmentations);
}
|
public void | endDTD(com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.endDTD(augmentations);
}
fInDTD = false;
|
public void | endDocument(com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (isRootDocument() && fDocumentHandler != null) {
fDocumentHandler.endDocument(augs);
}
|
public void | endElement(com.sun.org.apache.xerces.internal.xni.QName element, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (isIncludeElement(element)) {
// if we're ending an include element, and we were expecting a fallback
// we check to see if the children of this include element contained a fallback
if (getState() == STATE_EXPECT_FALLBACK
&& !getSawFallback(fDepth + 1)) {
reportFatalError("NoFallback");
}
}
if (isFallbackElement(element)) {
// the state would have been set to normal processing if we were expecting the fallback element
// now that we're done processing it, we should ignore all the other children of the include element
if (getState() == STATE_NORMAL_PROCESSING) {
setState(STATE_IGNORE);
}
}
else if (
fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
fDocumentHandler.endElement(element, augs);
}
// reset the out of scope stack elements
setSawFallback(fDepth + 1, false);
setSawInclude(fDepth + 1, false);
// check if an xml:base has gone out of scope
if (baseURIScope.size() > 0 && fDepth == baseURIScope.peek()) {
// pop the values from the stack
restoreBaseURI();
}
fDepth--;
|
public void | endExternalSubset(com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.endExternalSubset(augmentations);
}
|
public void | endGeneralEntity(java.lang.String name, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
fDocumentHandler.endGeneralEntity(name, augs);
}
|
public void | endParameterEntity(java.lang.String name, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.endParameterEntity(name, augmentations);
}
|
public void | externalEntityDecl(java.lang.String name, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier identifier, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.externalEntityDecl(name, identifier, augmentations);
}
|
public java.lang.String | getBaseURI(int depth)Gets the base URI that was in use at that depth
int scope = scopeOf(depth);
return (String)expandedSystemID.elementAt(scope);
|
public com.sun.org.apache.xerces.internal.xni.XMLDTDHandler | getDTDHandler()
return fDTDHandler;
|
public com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource | getDTDSource()
return fDTDSource;
|
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;
|
private java.lang.String | getIncludeParentBaseURI()Returns the [base URI] of the include parent.
int depth = getIncludeParentDepth();
if (!isRootDocument() && depth == 0) {
return fParentXIncludeHandler.getIncludeParentBaseURI();
}
else {
return this.getBaseURI(depth);
}
|
private int | getIncludeParentDepth()Returns the depth of the include parent. Here, the include parent is
calculated as the last non-include or non-fallback element. It is assumed
this method is called when the current element is a top level included item.
Returning 0 indicates that the top level element in this document
was an include element.
// We don't start at fDepth, since it is either the top level included item,
// or an include element, when this method is called.
for (int i = fDepth - 1; i >= 0; i--) {
// This technically might not always return the first non-include/fallback
// element that it comes to, since sawFallback() returns true if a fallback
// was ever encountered at that depth. However, if a fallback was encountered
// at that depth, and it wasn't the direct descendant of the current element
// then we can't be in a situation where we're calling this method (because
// we'll always be in STATE_IGNORE)
if (!getSawInclude(i) && !getSawFallback(i)) {
return i;
}
}
// shouldn't get here, since depth 0 should never have an include element or
// a fallback element
return 0;
|
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;
|
protected java.lang.String | getRelativeBaseURI()Returns a URI, relative to the include parent's base URI, of the current
[base URI]. For instance, if the current [base URI] was "dir1/dir2/file.xml"
and the include parent's [base URI] was "dir/", this would return "dir2/file.xml".
int includeParentDepth = getIncludeParentDepth();
String relativeURI = this.getRelativeURI(includeParentDepth);
if (isRootDocument()) {
return relativeURI;
}
else {
if (relativeURI.equals("")) {
relativeURI = fCurrentBaseURI.getLiteralSystemId();
}
if (includeParentDepth == 0) {
if (fParentRelativeURI == null) {
fParentRelativeURI =
fParentXIncludeHandler.getRelativeBaseURI();
}
if (fParentRelativeURI.equals("")) {
return relativeURI;
}
URI uri = new URI("file", fParentRelativeURI);
uri = new URI(uri, relativeURI);
return uri.getPath();
}
else {
return relativeURI;
}
}
|
public java.lang.String | getRelativeURI(int depth)Returns a relative URI, which when resolved against the base URI at the
specified depth, will create the current base URI.
This is accomplished by merged the literal system IDs.
// The literal system id at the location given by "start" is *in focus* at
// the given depth. So we need to adjust it to the next scope, so that we
// only process out of focus literal system ids
int start = scopeOf(depth) + 1;
if (start == baseURIScope.size()) {
// If that is the last system id, then we don't need a relative URI
return "";
}
URI uri = new URI("file", (String)literalSystemID.elementAt(start));
for (int i = start + 1; i < baseURIScope.size(); i++) {
uri = new URI(uri, (String)literalSystemID.elementAt(i));
}
return uri.getPath();
|
protected boolean | getSawFallback(int depth)Returns whether an <fallback> was encountered at the specified depth,
as an ancestor of the current element, or as a sibling of an ancestor of the
current element.
if (depth >= fSawFallback.length) {
return false;
}
return fSawFallback[depth];
|
protected boolean | getSawInclude(int depth)Return whether an <include> was encountered at the specified depth,
as an ancestor of the current item.
if (depth >= fSawInclude.length) {
return false;
}
return fSawInclude[depth];
|
protected int | getState(int depth)
return fState[depth];
|
protected int | getState()
return fState[fDepth];
|
protected void | handleFallbackElement()
setSawInclude(fDepth, false);
fNamespaceContext.setContextInvalid();
if (!getSawInclude(fDepth - 1)) {
reportFatalError("FallbackParent");
}
if (getSawFallback(fDepth)) {
reportFatalError("MultipleFallbacks");
}
else {
setSawFallback(fDepth, true);
}
// Either the state is STATE_EXPECT_FALLBACK or it's STATE_IGNORE.
// If we're ignoring, we want to stay ignoring. But if we're expecting this fallback element,
// we want to signal that we should process the children.
if (getState() == STATE_EXPECT_FALLBACK) {
setState(STATE_NORMAL_PROCESSING);
}
|
protected boolean | handleIncludeElement(com.sun.org.apache.xerces.internal.xni.XMLAttributes attributes)
setSawInclude(fDepth, true);
fNamespaceContext.setContextInvalid();
if (getSawInclude(fDepth - 1)) {
reportFatalError("IncludeChild", new Object[] { XINCLUDE_INCLUDE });
}
if (getState() == STATE_IGNORE)
return true;
// TODO: does Java use IURIs by default?
// [Definition: An internationalized URI reference, or IURI, is a URI reference that directly uses [Unicode] characters.]
// TODO: figure out what section 4.1.1 of the XInclude spec is talking about
// has to do with disallowed ASCII character escaping
// this ties in with the above IURI section, but I suspect Java already does it
String href = attributes.getValue(XINCLUDE_ATTR_HREF);
String parse = attributes.getValue(XINCLUDE_ATTR_PARSE);
String xpointerPart = attributes.getValue(XPOINTER);
String accept = attributes.getValue(XINCLUDE_ATTR_ACCEPT);
String acceptLanguage = attributes.getValue(XINCLUDE_ATTR_ACCEPT_LANGUAGE);
if (href == null && xpointerPart == null) {
reportFatalError("XpointerMissing");
}
if (parse == null) {
parse = XINCLUDE_PARSE_XML;
}
boolean xpointer = false;
String parserName = null;
//Ignore fragment identifiers, implementation specific as per spec.
if( href.indexOf("#")!=-1 )
href = href.substring(0,href.indexOf("#"));
if ( xpointerPart != null && parse.equals(XINCLUDE_PARSE_XML))
xpointer = true;
// Verify that if an accept and/or an accept-language attribute exist
// that the value(s) don't contain disallowed characters.
if (accept != null && !isValidInHTTPHeader(accept)) {
reportFatalError("AcceptMalformed", null);
}
if (acceptLanguage != null && !isValidInHTTPHeader(acceptLanguage)) {
reportFatalError("AcceptLanguageMalformed", null);
}
XMLInputSource includedSource = null;
if (fEntityResolver != null) {
try {
XMLResourceIdentifier resourceIdentifier =
new XMLResourceIdentifierImpl(
null,
href,
fCurrentBaseURI.getExpandedSystemId(),
XMLEntityManager.expandSystemId(
href,
fCurrentBaseURI.getExpandedSystemId(),
false));
includedSource =
fEntityResolver.resolveEntity(resourceIdentifier);
} catch (IOException e) {
reportResourceError(
"XMLResourceError",
new Object[] { href, e.getMessage()});
return false;
}
}
if (includedSource == null) {
includedSource =
new XIncludeInputSource(
null,
href,
fCurrentBaseURI.getExpandedSystemId());
}
if(parse.equals(XINCLUDE_PARSE_XML) && xpointer ){
if(fXPointerFramework == null){
fXPointerFramework = new XPointerFramework();
fXPointerFramework.setXPointerSchema(fXPointerSchema);
}else{
fXPointerFramework.reset();
fXPointerFramework.setXPointerSchema(fXPointerSchema);
}
parserName = XPOINTER_DEFAULT_CONFIGURATION;
fChildConfig = createXPointerParser();
fXPointerFramework.setSchemaPointer(xpointerPart);
// we don't want a schema validator on the new pipeline,
// so we set it to false, regardless of what was copied above
/* fChildConfig.setFeature(
Constants.XERCES_FEATURE_PREFIX
+ Constants.SCHEMA_VALIDATION_FEATURE,
false);*/
//-Revisit and clean up this piece of unclean code.
XPointerSchema fXPointerSchemaS;
if((fXPointerSchemaS = fXPointerFramework.getNextXPointerSchema()) == null && fXPointerFramework.getSchemaCount() == 0){
fNamespaceContext.pushScope();
fXPointerSchemaS = fXPointerFramework.getDefaultSchema();
fXPointerSchemaS.setXPointerSchemaPointer(xpointerPart);
processSchema(fXPointerSchemaS,includedSource);
/*
Object sch = null;
if(!fXPointerFramework.fSchemaNotAvailable.empty())
sch = fXPointerFramework.fSchemaNotAvailable.pop();
reportFatalError("NO_XPointerSchema", new Object[] {sch});
*/
}else {
try {
fNamespaceContext.pushScope();
if(fXPointerSchemaS != null && processSchema(fXPointerSchemaS,includedSource)){
;
}else{
for (int i=fXPointerFramework.getCurrentPointer(); i <=fXPointerFramework.getSchemaCount();i++){
fXPointerSchemaS = fXPointerFramework.getNextXPointerSchema();
if(fXPointerSchemaS != null && processSchema(fXPointerSchemaS,includedSource)){
break;
}
}
}
}
catch (XNIException e) {
reportFatalError("XMLParseError");
}
finally {
fNamespaceContext.popScope();
}
}
}
else if (parse.equals(XINCLUDE_PARSE_XML)) {
// Instead of always creating a new configuration, the first one can be reused
//if (fChildConfig == null) {
parserName = XINCLUDE_DEFAULT_CONFIGURATION;
fChildConfig =
(XMLParserConfiguration)ObjectFactory.newInstance(
parserName,
ObjectFactory.findClassLoader(),
true);
// use the same error reporter, entity resolver, and security manager.
if (fErrorReporter != null) fChildConfig.setProperty(ERROR_REPORTER, fErrorReporter);
if (fEntityResolver != null) fChildConfig.setProperty(ENTITY_RESOLVER, fEntityResolver);
if (fSecurityManager != null) fChildConfig.setProperty(SECURITY_MANAGER, fSecurityManager);
// use the same namespace context
fChildConfig.setProperty(
Constants.XERCES_PROPERTY_PREFIX
+ Constants.NAMESPACE_CONTEXT_PROPERTY,
fNamespaceContext);
XIncludeHandler newHandler =
(XIncludeHandler)fChildConfig.getProperty(
Constants.XERCES_PROPERTY_PREFIX
+ Constants.XINCLUDE_HANDLER_PROPERTY);
newHandler.setParent(this);
newHandler.setDocumentHandler(this.getDocumentHandler());
//}
// set all features on parserConfig to match this parser configuration
copyFeatures(fSettings, fChildConfig);
// we don't want a schema validator on the new pipeline,
// so we set it to false, regardless of what was copied above
fChildConfig.setFeature(
Constants.XERCES_FEATURE_PREFIX
+ Constants.SCHEMA_VALIDATION_FEATURE,
false);
fChildConfig.setFeature(
Constants.XERCES_FEATURE_PREFIX
+ Constants.XINCLUDE_AWARE,
true);
try {
fNamespaceContext.pushScope();
includedSource = setHttpProperties(includedSource,attributes);
fChildConfig.parse(includedSource);
// necessary to make sure proper location is reported in errors
if (fErrorReporter != null) {
fErrorReporter.setDocumentLocator(fDocLocation);
}
}
catch (XNIException e) {
// necessary to make sure proper location is reported in errors
if (fErrorReporter != null) {
fErrorReporter.setDocumentLocator(fDocLocation);
}
reportFatalError("XMLParseError", new Object[] { href });
}
catch (IOException e) {
// necessary to make sure proper location is reported in errors
if (fErrorReporter != null) {
fErrorReporter.setDocumentLocator(fDocLocation);
}
// An IOException indicates that we had trouble reading the file, not
// that it was an invalid XML file. So we send a resource error, not a
// fatal error.
reportResourceError(
"XMLResourceError",
new Object[] { href, e.getMessage()});
return false;
}
finally {
fNamespaceContext.popScope();
}
}
else if (parse.equals(XINCLUDE_PARSE_TEXT)) {
// we only care about encoding for parse="text"
String encoding = attributes.getValue(XINCLUDE_ATTR_ENCODING);
includedSource.setEncoding(encoding);
XIncludeTextReader reader = null;
try {
if (fIsXML11) {
reader = new XInclude11TextReader(includedSource, this);
}
else {
reader = new XIncludeTextReader(includedSource, this);
}
if (includedSource.getCharacterStream() == null
&& includedSource.getByteStream() == null) {
reader.setHttpProperties(accept, acceptLanguage);
}
reader.setErrorReporter(fErrorReporter);
reader.parse();
}
// encoding errors
catch (MalformedByteSequenceException ex) {
fErrorReporter.reportError(ex.getDomain(), ex.getKey(),
ex.getArguments(), XMLErrorReporter.SEVERITY_FATAL_ERROR);
}
catch (CharConversionException e) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"CharConversionFailure", null, XMLErrorReporter.SEVERITY_FATAL_ERROR);
}
catch (IOException e) {
reportResourceError(
"TextResourceError",
new Object[] { href, e.getMessage()});
return false;
}
finally {
if (reader != null) {
try {
reader.close();
}
catch (IOException e) {
reportResourceError(
"TextResourceError",
new Object[] { href, e.getMessage()});
return false;
}
}
}
}
else {
reportFatalError("InvalidParseValue", new Object[] { parse });
}
return true;
|
protected boolean | hasXIncludeNamespace(com.sun.org.apache.xerces.internal.xni.QName element)Returns true if the element has the namespace "http://www.w3.org/2001/XInclude"
// REVISIT: The namespace of this element should be bound
// already. Why are we looking it up from the namespace
// context? -- mrglavas
return element.uri == XINCLUDE_NS_URI
|| fNamespaceContext.getURI(element.prefix) == XINCLUDE_NS_URI;
|
public void | ignorableWhitespace(com.sun.org.apache.xerces.internal.xni.XMLString text, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
fDocumentHandler.ignorableWhitespace(text, augs);
}
|
public void | ignoredCharacters(com.sun.org.apache.xerces.internal.xni.XMLString text, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.ignoredCharacters(text, augmentations);
}
|
public void | internalEntityDecl(java.lang.String name, com.sun.org.apache.xerces.internal.xni.XMLString text, com.sun.org.apache.xerces.internal.xni.XMLString nonNormalizedText, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.internalEntityDecl(
name,
text,
nonNormalizedText,
augmentations);
}
|
protected boolean | isFallbackElement(com.sun.org.apache.xerces.internal.xni.QName element)Checks if the element is an <fallback> element. The element must have
the XInclude namespace, and a local name of "fallback".
return element.localpart.equals(XINCLUDE_FALLBACK) &&
hasXIncludeNamespace(element);
|
protected boolean | isIncludeElement(com.sun.org.apache.xerces.internal.xni.QName element)Checks if the element is an <include> element. The element must have
the XInclude namespace, and a local name of "include".
return element.localpart.equals(XINCLUDE_INCLUDE) &&
hasXIncludeNamespace(element);
|
protected boolean | isRootDocument()
return fParentXIncludeHandler == null;
|
protected boolean | isTopLevelIncludedItem()Returns true if the current element is a top level included item. This means
it's either the child of a fallback element, or the top level item in an
included document
return isTopLevelIncludedItemViaInclude()
|| isTopLevelIncludedItemViaFallback();
|
protected boolean | isTopLevelIncludedItemViaFallback()
// Technically, this doesn't check if the parent was a fallback, it also
// would return true if any of the parent's sibling elements were fallbacks.
// However, this doesn't matter, since we will always be ignoring elements
// whose parent's siblings were fallbacks.
return getSawFallback(fDepth - 1);
|
protected boolean | isTopLevelIncludedItemViaInclude()
return fDepth == 1 && !isRootDocument();
|
private boolean | isValidInHTTPHeader(java.lang.String value)Returns true if the given string
would be valid in an HTTP header.
char ch;
for (int i = value.length() - 1; i >= 0; --i) {
ch = value.charAt(i);
if (ch < 0x20 || ch > 0x7E) {
return false;
}
}
return true;
|
protected com.sun.org.apache.xerces.internal.xni.Augmentations | modifyAugmentations(com.sun.org.apache.xerces.internal.xni.Augmentations augs)Modify the augmentations. Add an [included] infoset item, if the current
element is a top level included item.
return modifyAugmentations(augs, false);
|
protected com.sun.org.apache.xerces.internal.xni.Augmentations | modifyAugmentations(com.sun.org.apache.xerces.internal.xni.Augmentations augs, boolean force)Modify the augmentations. Add an [included] infoset item, if force
is true, or if the current element is a top level included item.
if (force || isTopLevelIncludedItem()) {
if (augs == null) {
augs = new AugmentationsImpl();
}
augs.putItem(XINCLUDE_INCLUDED, Boolean.TRUE);
}
return augs;
|
public void | notationDecl(java.lang.String name, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier identifier, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
this.addNotation(name, identifier, augmentations);
if (fDTDHandler != null) {
fDTDHandler.notationDecl(name, identifier, augmentations);
}
|
protected com.sun.org.apache.xerces.internal.xni.XMLAttributes | processAttributes(com.sun.org.apache.xerces.internal.xni.XMLAttributes attributes)Processes the XMLAttributes object of startElement() calls. Performs the following tasks:
- If the element is a top level included item whose [base URI] is different from the
[base URI] of the include parent, then an xml:base attribute is added to specify the
true [base URI]
- For all namespace prefixes which are in-scope in an included item, but not in scope
in the include parent, a xmlns:prefix attribute is added
- For all attributes with a type of ENTITY, ENTITIES or NOTATIONS, the notations and
unparsed entities are processed as described in the spec, sections 4.5.1 and 4.5.2
if (isTopLevelIncludedItem()) {
// Modify attributes to fix the base URI (spec 4.5.5).
// We only do it to top level included elements, which have a different
// base URI than their include parent.
if (!sameBaseURIAsIncludeParent()) {
if (attributes == null) {
attributes = new XMLAttributesImpl();
}
// This causes errors with schema validation, if the schema doesn't
// specify that these elements can have an xml:base attribute
// TODO: add a user option to turn this off?
String uri = null;
try {
uri = this.getRelativeBaseURI();
}
catch (MalformedURIException e) {
// this shouldn't ever happen, since by definition, we had to traverse
// the same URIs to even get to this place
uri = fCurrentBaseURI.getExpandedSystemId();
}
int index =
attributes.addAttribute(
XML_BASE_QNAME,
XMLSymbols.fCDATASymbol,
uri);
attributes.setSpecified(index, true);
}
// Modify attributes of included items to do namespace-fixup. (spec 4.5.4)
Enumeration inscopeNS = fNamespaceContext.getAllPrefixes();
while (inscopeNS.hasMoreElements()) {
String prefix = (String)inscopeNS.nextElement();
String parentURI =
fNamespaceContext.getURIFromIncludeParent(prefix);
String uri = fNamespaceContext.getURI(prefix);
if (parentURI != uri && attributes != null) {
if (prefix == XMLSymbols.EMPTY_STRING) {
if (attributes
.getValue(
NamespaceContext.XMLNS_URI,
XMLSymbols.PREFIX_XMLNS)
== null) {
if (attributes == null) {
attributes = new XMLAttributesImpl();
}
QName ns = (QName)NEW_NS_ATTR_QNAME.clone();
ns.localpart = XMLSymbols.PREFIX_XMLNS;
ns.rawname = XMLSymbols.PREFIX_XMLNS;
attributes.addAttribute(
ns,
XMLSymbols.fCDATASymbol,
uri);
}
}
else if (
attributes.getValue(NamespaceContext.XMLNS_URI, prefix)
== null) {
if (attributes == null) {
attributes = new XMLAttributesImpl();
}
QName ns = (QName)NEW_NS_ATTR_QNAME.clone();
ns.localpart = prefix;
ns.rawname += prefix;
attributes.addAttribute(
ns,
XMLSymbols.fCDATASymbol,
uri);
}
}
}
}
if (attributes != null) {
int length = attributes.getLength();
for (int i = 0; i < length; i++) {
String type = attributes.getType(i);
String value = attributes.getValue(i);
if (type == XMLSymbols.fENTITYSymbol) {
this.checkUnparsedEntity(value);
}
if (type == XMLSymbols.fENTITIESSymbol) {
// 4.5.1 - Unparsed Entities
StringTokenizer st = new StringTokenizer(value);
while (st.hasMoreTokens()) {
String entName = st.nextToken();
this.checkUnparsedEntity(entName);
}
}
else if (type == XMLSymbols.fNOTATIONSymbol) {
// 4.5.2 - Notations
this.checkNotation(value);
}
/* We actually don't need to do anything for 4.5.3, because at this stage the
* value of the attribute is just a string. It will be taken care of later
* in the pipeline, when the IDREFs are actually resolved against IDs.
*
* if (type == XMLSymbols.fIDREFSymbol || type == XMLSymbols.fIDREFSSymbol) { }
*/
}
}
return attributes;
|
public boolean | processSchema(XPointerSchema fXPointerSchemaS, com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource includedSource)
try{
fChildConfig = createXPointerParser();//for now -Revisit and change this.
fChildConfig.setProperty(Constants.XERCES_PROPERTY_PREFIX
+ Constants.XINCLUDE_HANDLER_PROPERTY,
fXPointerSchemaS);
fXPointerSchemaS.setParent(this);
fXPointerSchemaS.setDocumentHandler(this.getDocumentHandler());
fChildConfig.parse(includedSource);
}
catch (Exception e) {
//Venu For now do this.
reportResourceError(
"XMLResourceError",
new Object[] { null, e.getMessage()});
}
return fXPointerSchemaS.isSubResourceIndentified();
|
protected void | processXMLBaseAttributes(com.sun.org.apache.xerces.internal.xni.XMLAttributes attributes)Search for a xml:base attribute, and if one is found, put the new base URI into
effect.
String baseURIValue =
attributes.getValue(NamespaceContext.XML_URI, "base");
if (baseURIValue != null) {
try {
String expandedValue =
XMLEntityManager.expandSystemId(
baseURIValue,
fCurrentBaseURI.getExpandedSystemId(),
false);
fCurrentBaseURI.setLiteralSystemId(baseURIValue);
fCurrentBaseURI.setBaseSystemId(
fCurrentBaseURI.getExpandedSystemId());
fCurrentBaseURI.setExpandedSystemId(expandedValue);
// push the new values on the stack
saveBaseURI();
}
catch (MalformedURIException e) {
// REVISIT: throw error here
}
}
|
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 (!fInDTD) {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
// we need to change the depth like this so that modifyAugmentations() works
fDepth++;
augs = modifyAugmentations(augs);
fDocumentHandler.processingInstruction(target, data, augs);
fDepth--;
}
}
else if (fDTDHandler != null) {
fDTDHandler.processingInstruction(target, data, augs);
}
|
private void | reportError(java.lang.String key, java.lang.Object[] args, short severity)
if (fErrorReporter != null) {
fErrorReporter.reportError(
XIncludeMessageFormatter.XINCLUDE_DOMAIN,
key,
args,
severity);
}
// we won't worry about when error reporter is null, since there should always be
// at least the default error reporter
|
protected void | reportFatalError(java.lang.String key)
this.reportFatalError(key, null);
|
protected void | reportFatalError(java.lang.String key, java.lang.Object[] args)
this.reportError(key, args, XMLErrorReporter.SEVERITY_FATAL_ERROR);
|
protected void | reportResourceError(java.lang.String key)
this.reportFatalError(key, null);
|
protected void | reportResourceError(java.lang.String key, java.lang.Object[] args)
this.reportError(key, args, XMLErrorReporter.SEVERITY_WARNING);
|
public void | reset(com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager componentManager)
fNamespaceContext = null;
fDepth = 0;
fNotations = new Vector();
fUnparsedEntities = new Vector();
fParentRelativeURI = null;
fIsXML11 = false;
fInDTD = false;
baseURIScope.clear();
baseURI.clear();
literalSystemID.clear();
expandedSystemID.clear();
// REVISIT: Find a better method for maintaining
// the state of the XInclude processor. These arrays
// can potentially grow quite large. Cleaning them
// out on reset may be very time consuming. -- mrglavas
//
// clear the previous settings from the arrays
for (int i = 0; i < fState.length; ++i) {
fState[i] = STATE_NORMAL_PROCESSING;
}
for (int i = 0; i < fSawFallback.length; ++i) {
fSawFallback[i] = false;
}
for (int i = 0; i < fSawInclude.length; ++i) {
fSawInclude[i] = false;
}
try {
fSendUEAndNotationEvents =
componentManager.getFeature(ALLOW_UE_AND_NOTATION_EVENTS);
if (fChildConfig != null) {
fChildConfig.setFeature(
ALLOW_UE_AND_NOTATION_EVENTS,
fSendUEAndNotationEvents);
}
}
catch (XMLConfigurationException e) {
}
// Get error reporter.
try {
XMLErrorReporter value =
(XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
if (value != null) {
setErrorReporter(value);
if (fChildConfig != null) {
fChildConfig.setProperty(ERROR_REPORTER, value);
}
}
}
catch (XMLConfigurationException e) {
fErrorReporter = null;
}
// Get entity resolver.
try {
XMLEntityResolver value =
(XMLEntityResolver)componentManager.getProperty(
ENTITY_RESOLVER);
if (value != null) {
fEntityResolver = value;
if (fChildConfig != null) {
fChildConfig.setProperty(ENTITY_RESOLVER, value);
}
}
}
catch (XMLConfigurationException e) {
fEntityResolver = null;
}
try {
fXPointerSchema =
(XPointerSchema [])componentManager.getProperty(
XPOINTER_SCHEMA);
}
catch (XMLConfigurationException e) {
fXPointerSchema = null;
}
// Get security manager.
try {
SecurityManager value =
(SecurityManager)componentManager.getProperty(
SECURITY_MANAGER);
if (value != null) {
fSecurityManager = value;
if (fChildConfig != null) {
fChildConfig.setProperty(SECURITY_MANAGER, value);
}
}
}
catch (XMLConfigurationException e) {
fSecurityManager = null;
}
fSettings = new ParserConfigurationSettings();
copyFeatures(componentManager, fSettings);
// Don't reset fChildConfig -- we don't want it to share the same components.
// It will be reset when it is actually used to parse something.
|
protected void | restoreBaseURI()Discards the URIs at the top of the stack, and restores the ones beneath it.
baseURI.pop();
literalSystemID.pop();
expandedSystemID.pop();
baseURIScope.pop();
fCurrentBaseURI.setBaseSystemId((String)baseURI.peek());
fCurrentBaseURI.setLiteralSystemId((String)literalSystemID.peek());
fCurrentBaseURI.setExpandedSystemId((String)expandedSystemID.peek());
|
protected boolean | sameBaseURIAsIncludeParent()Returns true if the current [base URI] is the same as the [base URI] that
was in effect on the include parent. This method should only be called
when the current element is a top level included element, i.e. the direct child
of a fallback element, or the root elements in an included document.
The "include parent" is the element which, in the result infoset, will be the
direct parent of the current element.
String parentBaseURI = getIncludeParentBaseURI();
String baseURI = fCurrentBaseURI.getExpandedSystemId();
// REVISIT: should we use File#sameFile() ?
// I think the benefit of using it is that it resolves host names
// instead of just doing a string comparison.
// TODO: [base URI] is still an open issue with the working group.
// They're deciding if xml:base should be added if the [base URI] is different in terms
// of resolving relative references, or if it should be added if they are different at all.
// Revisit this after a final decision has been made.
// The decision also affects whether we output the file name of the URI, or just the path.
return parentBaseURI != null && parentBaseURI.equals(baseURI);
|
protected void | saveBaseURI()Saves the current base URI to the top of the stack.
baseURIScope.push(fDepth);
baseURI.push(fCurrentBaseURI.getBaseSystemId());
literalSystemID.push(fCurrentBaseURI.getLiteralSystemId());
expandedSystemID.push(fCurrentBaseURI.getExpandedSystemId());
|
private int | scopeOf(int depth)
for (int i = baseURIScope.size() - 1; i >= 0; i--) {
if (baseURIScope.elementAt(i) <= depth)
return i;
}
// we should never get here, because 0 was put on the stack in startDocument()
return -1;
|
protected boolean | searchForRecursiveIncludes(com.sun.org.apache.xerces.internal.xni.XMLLocator includedSource)Checks if the file indicated by the given XMLLocator has already been included
in the current stack.
String includedSystemId = includedSource.getExpandedSystemId();
if (includedSystemId == null) {
try {
includedSystemId =
XMLEntityManager.expandSystemId(
includedSource.getLiteralSystemId(),
includedSource.getBaseSystemId(),
false);
}
catch (MalformedURIException e) {
reportFatalError("ExpandedSystemId");
}
}
if (includedSystemId.equals(fCurrentBaseURI.getExpandedSystemId())) {
return true;
}
if (fParentXIncludeHandler == null) {
return false;
}
return fParentXIncludeHandler.searchForRecursiveIncludes(
includedSource);
|
public void | setDTDHandler(com.sun.org.apache.xerces.internal.xni.XMLDTDHandler handler)
fDTDHandler = handler;
|
public void | setDTDSource(com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource source)
fDTDSource = source;
|
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());
// this ensures the proper location is displayed in error messages
if (fDocLocation != null) {
fErrorReporter.setDocumentLocator(fDocLocation);
}
}
|
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 (featureId.equals(ALLOW_UE_AND_NOTATION_EVENTS)) {
fSendUEAndNotationEvents = state;
}
if (fSettings != null) {
fSettings.setFeature(featureId, state);
}
|
protected com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource | setHttpProperties(com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource source, com.sun.org.apache.xerces.internal.xni.XMLAttributes attributes)Set the Accept,Accept-Language,Accept-CharSet
String httpAcceptLang = attributes.getValue(HTTP_ACCEPT_LANGUAGE);
String httpAccept = attributes.getValue(HTTP_ACCEPT);
String httpAcceptchar = attributes.getValue(HTTP_ACCEPT_CHARSET);
if (source.getCharacterStream() == null && source.getByteStream() == null) {
XIncludeInputSource includeSource = new XIncludeInputSource(source.getPublicId(),source.getSystemId(),source.getBaseSystemId(), source.getByteStream(),source.getEncoding());
includeSource.setProperty(XINCLUDE_ATTR_ACCEPT,attributes.getValue(XINCLUDE_ATTR_ACCEPT));
includeSource.setProperty(XINCLUDE_ATTR_ACCEPT_CHARSET,attributes.getValue(XINCLUDE_ATTR_ACCEPT_CHARSET));
includeSource.setProperty(XINCLUDE_ATTR_ACCEPT_LANGUAGE,attributes.getValue(XINCLUDE_ATTR_ACCEPT_LANGUAGE));
}
return source;
|
protected void | setParent(com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler parent)Set the parent of this XIncludeHandler in the tree
fParentXIncludeHandler = 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 (fChildConfig != null) {
fChildConfig.setProperty(propertyId, value);
}
}
if (propertyId.equals(ENTITY_RESOLVER)) {
fEntityResolver = (XMLEntityResolver)value;
if (fChildConfig != null) {
fChildConfig.setProperty(propertyId, value);
}
}
if (propertyId.equals(SECURITY_MANAGER)) {
fSecurityManager = (SecurityManager)value;
if (fChildConfig != null) {
fChildConfig.setProperty(propertyId, value);
}
}
|
protected void | setSawFallback(int depth, boolean val)Records that an <fallback> was encountered at the specified depth,
as an ancestor of the current element, or as a sibling of an ancestor of the
current element.
if (depth >= fSawFallback.length) {
boolean[] newarray = new boolean[depth * 2];
System.arraycopy(fSawFallback, 0, newarray, 0, fSawFallback.length);
fSawFallback = newarray;
}
fSawFallback[depth] = val;
|
protected void | setSawInclude(int depth, boolean val)Records that an <include> was encountered at the specified depth,
as an ancestor of the current item.
if (depth >= fSawInclude.length) {
boolean[] newarray = new boolean[depth * 2];
System.arraycopy(fSawInclude, 0, newarray, 0, fSawInclude.length);
fSawInclude = newarray;
}
fSawInclude[depth] = val;
|
protected void | setState(int state)
if (fDepth >= fState.length) {
int[] newarray = new int[fDepth * 2];
System.arraycopy(fState, 0, newarray, 0, fState.length);
fState = newarray;
}
fState[fDepth] = state;
|
public void | startAttlist(java.lang.String elementName, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.startAttlist(elementName, augmentations);
}
|
public void | startCDATA(com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
fDocumentHandler.startCDATA(augs);
}
|
public void | startConditional(short type, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.startConditional(type, augmentations);
}
|
public void | startDTD(com.sun.org.apache.xerces.internal.xni.XMLLocator locator, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
fInDTD = true;
if (fDTDHandler != null) {
fDTDHandler.startDTD(locator, augmentations);
}
|
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)Event sent at the start of the document.
A fatal error will occur here, if it is detected that this document has been processed
before.
This event is only passed on to the document handler if this is the root document.
// we do this to ensure that the proper location is reported in errors
// otherwise, the locator from the root document would always be used
if(fErrorReporter != null)
fErrorReporter.setDocumentLocator(locator);
if (!isRootDocument()
&& fParentXIncludeHandler.searchForRecursiveIncludes(locator)) {
reportFatalError(
"RecursiveInclude",
new Object[] { locator.getExpandedSystemId()});
}
if (!(namespaceContext instanceof XIncludeNamespaceSupport)) {
reportFatalError("IncompatibleNamespaceContext");
}
fNamespaceContext = (XIncludeNamespaceSupport)namespaceContext;
fDocLocation = locator;
// initialize the current base URI
fCurrentBaseURI.setBaseSystemId(locator.getBaseSystemId());
fCurrentBaseURI.setExpandedSystemId(locator.getExpandedSystemId());
fCurrentBaseURI.setLiteralSystemId(locator.getLiteralSystemId());
saveBaseURI();
if (augs == null) {
augs = new AugmentationsImpl();
}
augs.putItem(CURRENT_BASE_URI, fCurrentBaseURI);
if (isRootDocument() && fDocumentHandler != null) {
fDocumentHandler.startDocument(
locator,
encoding,
namespaceContext,
augs);
}
|
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)
fDepth++;
setState(getState(fDepth - 1));
// we process the xml:base attributes regardless of what type of element it is
processXMLBaseAttributes(attributes);
if (isIncludeElement(element)) {
boolean success = this.handleIncludeElement(attributes);
if (success) {
setState(STATE_IGNORE);
}
else {
setState(STATE_EXPECT_FALLBACK);
}
}
else if (isFallbackElement(element)) {
this.handleFallbackElement();
}
else if (
fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
augs = modifyAugmentations(augs);
attributes = processAttributes(attributes);
fDocumentHandler.startElement(element, attributes, augs);
}
|
public void | startExternalSubset(com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier identifier, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.startExternalSubset(identifier, augmentations);
}
|
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
&& getState() == STATE_NORMAL_PROCESSING) {
fDocumentHandler.startGeneralEntity(name, resId, encoding, augs);
}
|
public void | startParameterEntity(java.lang.String name, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier identifier, java.lang.String encoding, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
if (fDTDHandler != null) {
fDTDHandler.startParameterEntity(
name,
identifier,
encoding,
augmentations);
}
|
public void | textDecl(java.lang.String version, java.lang.String encoding, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
fDocumentHandler.textDecl(version, encoding, augs);
}
|
public void | unparsedEntityDecl(java.lang.String name, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier identifier, java.lang.String notation, com.sun.org.apache.xerces.internal.xni.Augmentations augmentations)
this.addUnparsedEntity(name, identifier, notation, augmentations);
if (fDTDHandler != null) {
fDTDHandler.unparsedEntityDecl(
name,
identifier,
notation,
augmentations);
}
|
public void | xmlDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
fIsXML11 = "1.1".equals(version);
if (isRootDocument() && fDocumentHandler != null) {
fDocumentHandler.xmlDecl(version, encoding, standalone, augs);
}
|