protected void reset() { super.reset(); fDTDScanner.reset(); fEntityManager.reset(); fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); }
/** * Reset the reference to the appropriate scanner given the version of the * document and start document scanning. * @param scanner - the scanner to use * @param version - the version of the document (XML 1.1 or XML 1.0). */ public void startDocumentParsing(XMLEntityHandler scanner, short version){ if (version == Constants.XML_VERSION_1_0){ fEntityManager.setScannerVersion(Constants.XML_VERSION_1_0); } else { fEntityManager.setScannerVersion(Constants.XML_VERSION_1_1); } // Make sure the locator used by the error reporter is the current entity scanner. fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); // Note: above we reset fEntityScanner in the entity manager, thus in startEntity // in each scanner fEntityScanner field must be reset to reflect the change. // fEntityManager.setEntityHandler(scanner); scanner.startEntity(fXMLSymbol, fEntityManager.getCurrentResourceIdentifier(), fEncoding, null); }
/** * Sets the input source. * * @param inputSource The input source. * * @throws IOException Thrown on i/o error. */ public void setInputSource(XMLInputSource inputSource) throws IOException { fEntityManager.setEntityHandler(this); fEntityManager.startEntity("$fragment$", inputSource, false, true); //fDocumentSystemId = fEntityManager.expandSystemId(inputSource.getSystemId()); } // setInputSource(XMLInputSource)
/** * Sets the input source. * * @param inputSource The input source. * * @throws IOException Thrown on i/o error. */ public void setInputSource(XMLInputSource inputSource) throws IOException { fEntityManager.setEntityHandler(this); fEntityManager.startDocumentEntity(inputSource); //fDocumentSystemId = fEntityManager.expandSystemId(inputSource.getSystemId()); } // setInputSource(XMLInputSource)
if (fEntityManager.isExternalEntity(entityName)) { reportFatalError("ReferenceToExternalEntity", new Object[] { entityName }); if (!fEntityManager.isDeclaredEntity(entityName)) { fEntityManager.startEntity(entityName, true);
String baseSystemId = fEntityScanner.getBaseSystemId(); if (notation != null) { fEntityManager.addUnparsedEntity(name, publicId, systemId, baseSystemId, notation); fEntityManager.addExternalEntity(name, publicId, systemId, baseSystemId); fResourceIdentifier.setValues(publicId, systemId, baseSystemId, XMLEntityManager.expandSystemId(systemId, baseSystemId, false)); if (notation != null) { fDTDHandler.unparsedEntityDecl(name, fResourceIdentifier, fEntityManager.addInternalEntity(name, fStringBuffer.toString(), paramEntityRefs); if (fDTDHandler != null) { fDTDHandler.internalEntityDecl(name, fStringBuffer, fStringBuffer2, null);
fEntityManager = new XMLEntityManager(); fProperties.put(ENTITY_MANAGER, fEntityManager); addCommonComponent(fEntityManager); fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); fProperties.put(ERROR_REPORTER, fErrorReporter); addCommonComponent(fErrorReporter);
/** * start a parameter entity dealing with the textdecl if there is any * * @param name The name of the parameter entity to start (without the '%') * @param literal Whether this is happening within a literal * * @return The name of the parameter entity (with the '%') */ protected String startPE(String name, boolean literal) throws IOException, XNIException { int depth = fPEDepth; String pName = "%"+name; if (!fSeenPEReferences) { fSeenPEReferences = true; fEntityManager.notifyHasPEReferences(); } if (fValidation && !fEntityManager.isDeclaredEntity(pName)) { fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,"EntityNotDeclared", new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR); } fEntityManager.startEntity(fSymbolTable.addSymbol(pName), literal); // if we actually got a new entity and it's external // parse text decl if there is any if (depth != fPEDepth && fEntityScanner.isExternal()) { scanTextDecl(); } return pName; }
else if (fEntityManager.isUnparsedEntity(name)) { reportFatalError("ReferenceToUnparsedEntity", new Object[]{name}); if (!fEntityManager.isDeclaredEntity(name)) { if (fIsEntityDeclaredVC) { if (fValidation) fEntityManager.startEntity(name, false);
String expandedSystemId = expandSystemId(extLitSysId, extBaseSysId, false); fResourceIdentifier.setValues( (externalEntity.entityLocation != null ? externalEntity.entityLocation.getPublicId() : null), String expandedSystemId = expandSystemId(extLitSysId, extBaseSysId, false); fResourceIdentifier.setValues( (externalEntity.entityLocation != null ? externalEntity.entityLocation.getPublicId() : null), if (external) { ExternalEntity externalEntity = (ExternalEntity)entity; xmlInputSource = resolveEntity(externalEntity.entityLocation); startEntity(entityName, xmlInputSource, literal, external);
/** * Scans a document. * * @param complete True if the scanner should scan the document * completely, pushing all events to the registered * document handler. A value of false indicates that * that the scanner should only scan the next portion * of the document and return. A scanner instance is * permitted to completely scan a document if it does * not support this "pull" scanning model. * * @return True if there is more to scan, false otherwise. */ public boolean scanDocument(boolean complete) throws IOException, XNIException { // reset entity scanner fEntityScanner = fEntityManager.getEntityScanner(); // keep dispatching "events" fEntityManager.setEntityHandler(this); do { if (!fDispatcher.dispatch(complete)) { return false; } } while (complete); // return success return true; } // scanDocument(boolean):boolean
/** Creates an entity manager. */ protected XMLEntityManager createEntityManager() { return new XMLEntityManager(); } // createEntityManager():XMLEntityManager
/** Calls reset on each of the components owned by this component manager. **/ public void reset() throws XNIException { fNamespaceContext.reset(); fValidationManager.reset(); fEntityManager.reset(this); fErrorReporter.reset(this); fSchemaValidator.reset(this); // Mark configuration as fixed. fConfigUpdated = false; }
/** * Sets the input source. * * @param inputSource The input source or null. * * @throws IOException Thrown on i/o error. */ public void setInputSource(XMLInputSource inputSource) throws IOException { if (inputSource == null) { // no system id was available if (fDTDHandler != null) { fDTDHandler.startDTD(null, null); fDTDHandler.endDTD(null); } return; } fEntityManager.setEntityHandler(this); fEntityManager.startDTDEntity(inputSource); } // setInputSource(XMLInputSource)
fEntityManager.setEntityHandler(null); try { boolean again; fIsEntityDeclaredVC = fEntityManager.hasPEReferences() && !fStandalone; fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this); return true; fDTDDescription.setRootName(fDoctypeName); XMLInputSource xmlInputSource = fEntityManager.resolveEntity(fDTDDescription); fDTDScanner.setInputSource(xmlInputSource); setScannerState(SCANNER_STATE_DTD_EXTERNAL_DECLS); setScannerState(SCANNER_STATE_PROLOG); setDispatcher(fPrologDispatcher); fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this); return true; fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
throws IOException, XNIException { fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null); fDTDDescription.setRootName(fElementQName.rawname); XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription); fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
XMLDTDLoader(SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLErrorReporter errorReporter, XMLEntityResolver entityResolver) { fSymbolTable = symbolTable; fGrammarPool = grammarPool; if(errorReporter == null) { errorReporter = new XMLErrorReporter(); errorReporter.setProperty(ERROR_HANDLER, new DefaultErrorHandler()); } fErrorReporter = errorReporter; // Add XML message formatter if there isn't one. if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); } fEntityResolver = entityResolver; if(fEntityResolver instanceof XMLEntityManager) { fEntityManager = (XMLEntityManager)fEntityResolver; } else { fEntityManager = new XMLEntityManager(); } fEntityManager.setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY, errorReporter); fDTDScanner = createDTDScanner(fSymbolTable, fErrorReporter, fEntityManager); fDTDScanner.setDTDHandler(this); fDTDScanner.setDTDContentModelHandler(this); reset(); } // init(SymbolTable, XMLGrammarPool, XMLErrorReporter, XMLEntityResolver)
public TeedaXMLConfiguration() { XMLNSDocumentScannerImpl scanner = new TeedaXMLDocumentScannerImpl(); setProperty(DOCUMENT_SCANNER, scanner); addComponent(scanner); fEntityManager.setEntityHandler(scanner); fNamespaceScanner = scanner; }
/** * Starts the DTD entity. The DTD entity has the "[dtd]" * pseudo-name. * * @param xmlInputSource The input source of the DTD entity. * * @throws IOException Thrown on i/o error. * @throws XNIException Thrown by entity handler to signal an error. */ public void startDTDEntity(XMLInputSource xmlInputSource) throws IOException, XNIException { startEntity(DTDEntity, xmlInputSource, false, true); } // startDTDEntity(XMLInputSource)
/** * Adds an internal entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param text The text of the entity. * * @see SymbolTable */ public void addInternalEntity(String name, String text) { addInternalEntity(name, text, 0); } // addInternalEntity(String,String)