本文整理汇总了Java中org.apache.xerces.xni.XNIException类的典型用法代码示例。如果您正苦于以下问题:Java XNIException类的具体用法?Java XNIException怎么用?Java XNIException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XNIException类属于org.apache.xerces.xni包,在下文中一共展示了XNIException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startGeneralEntity
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/**
* This method notifies the start of a general entity.
* <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
* @param name The name of the general entity.
* @param identifier The resource identifier.
* @param encoding The auto-detected IANA encoding name of the entity
* stream. This value will be null in those situations
* where the entity encoding is not auto-detected (e.g.
* internal entities or a document entity that is
* parsed from a java.io.Reader).
* @param augs Additional information that may include infoset augmentations
*
* @exception XNIException Thrown by handler to signal an error.
*/
public void startGeneralEntity(String name,
XMLResourceIdentifier identifier,
String encoding,
Augmentations augs) throws XNIException {
if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) {
fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl);
// fixes E15.1
if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"MSG_CONTENT_INVALID_SPECIFIED",
new Object[]{ fCurrentElement.rawname,
"EMPTY", "ENTITY"},
XMLErrorReporter.SEVERITY_ERROR);
}
if (fGrammarBucket.getStandalone()) {
XMLDTDLoader.checkStandaloneEntityRef(name, fDTDGrammar, fEntityDecl, fErrorReporter);
}
}
if (fDocumentHandler != null) {
fDocumentHandler.startGeneralEntity(name, identifier, encoding, augs);
}
}
示例2: doctypeDecl
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/** Doctype declaration. */
public void doctypeDecl(String rootElementName, String publicId, String systemId,
Augmentations augs) throws XNIException {
fSeenAnything = true;
if (fReportErrors) {
if (fSeenRootElement) {
fErrorReporter.reportError("HTML2010", null);
}
else if (fSeenDoctype) {
fErrorReporter.reportError("HTML2011", null);
}
}
if (!fSeenRootElement && !fSeenDoctype) {
fSeenDoctype = true;
if (fDocumentHandler != null) {
fDocumentHandler.doctypeDecl(rootElementName, publicId, systemId, augs);
}
}
}
示例3: textDecl
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/** Text declaration. */
public void textDecl(String version, String encoding, Augmentations augs)
throws XNIException {
fSeenAnything = true;
// check for end of document
if (fSeenRootElementEnd) {
return;
}
// call handler
if (fDocumentHandler != null) {
fDocumentHandler.textDecl(version, encoding, augs);
}
}
示例4: startCDATA
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/** Start CDATA section. */
public void startCDATA(Augmentations augs) throws XNIException {
fSeenAnything = true;
consumeEarlyTextIfNeeded();
// check for end of document
if (fSeenRootElementEnd) {
return;
}
// call handler
if (fDocumentHandler != null) {
fDocumentHandler.startCDATA(augs);
}
}
示例5: resolveEntity
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
@Override
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException {
//logger.info("Resolving entity for: " + resourceIdentifier.getExpandedSystemId() + " namespace " + resourceIdentifier.getNamespace());
try{
URI originalURI = new URI(resourceIdentifier.getExpandedSystemId());
if(xbrlSchemaRemap.containsKey(originalURI)){
URI newURI = xbrlSchemaRemap.get(originalURI);
return new XMLInputSource(null, newURI.toString(), newURI.toString(), fileCache.getFileInputStream(newURI.toString()), null);
}
}
catch(URISyntaxException e){
}
return new XMLInputSource(resourceIdentifier.getPublicId(),
resourceIdentifier.getExpandedSystemId(),
resourceIdentifier.getExpandedSystemId(),
fileCache.getFileInputStream(resourceIdentifier.getExpandedSystemId()),
null);
}
示例6: startElement
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts)
throws SAXException {
try {
if (!pushedContext)
namespaceContext.pushContext();
else
pushedContext = false;
for (int i = 0, len = atts.getLength(); i < len; i++)
attributes.addAttribute(makeQName(atts.getURI(i), atts.getLocalName(i), atts.getQName(i)),
symbolTable.addSymbol(atts.getType(i)),
atts.getValue(i));
schemaValidator.startElement(makeQName(namespaceURI, localName, qName), attributes, null);
attributes.removeAllAttributes();
}
catch (XNIException e) {
throw toSAXException(e);
}
}
示例7: startPrefixMapping
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
public void startPrefixMapping(String prefix, String uri)
throws SAXException {
try {
if (!pushedContext) {
namespaceContext.pushContext();
pushedContext = true;
}
if (prefix == null)
prefix = XMLSymbols.EMPTY_STRING;
else
prefix = symbolTable.addSymbol(prefix);
if (uri != null) {
if (uri.equals(""))
uri = null;
else
uri = symbolTable.addSymbol(uri);
}
namespaceContext.declarePrefix(prefix, uri);
}
catch (XNIException e) {
throw toSAXException(e);
}
}
示例8: toSAXException
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
static SAXException toSAXException(XNIException e) {
if (e instanceof XMLParseException) {
XMLParseException pe = (XMLParseException)e;
return new SAXParseException(pe.getMessage(),
pe.getPublicId(),
pe.getExpandedSystemId(),
pe.getLineNumber(),
pe.getColumnNumber(),
pe.getException());
}
Exception nested = e.getException();
if (nested == null)
return new SAXException(e.getMessage());
if (nested instanceof SAXException)
return (SAXException)nested;
if (nested instanceof RuntimeException)
throw (RuntimeException)nested;
return new SAXException(nested);
}
示例9: doctypeDecl
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/**
* Notifies of the presence of the DOCTYPE line in the document.
*
* @param rootElement The name of the root element.
* @param publicId The public identifier if an external DTD or null
* if the external DTD is specified using SYSTEM.
* @param systemId The system identifier if an external DTD, null
* otherwise.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void doctypeDecl(String rootElement,
String publicId, String systemId, Augmentations augs)
throws XNIException {
fInDTD = true;
try {
// SAX2 extension
if (fLexicalHandler != null) {
fLexicalHandler.startDTD(rootElement, publicId, systemId);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
// is there a DeclHandler?
if(fDeclHandler != null) {
fDeclaredAttrs = new SymbolHash();
}
}
示例10: startGeneralEntity
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/**
* This method notifies of the start of an entity. The DTD has the
* pseudo-name of "[dtd]" parameter entity names start with '%'; and
* general entity names are just the entity name.
* <p>
* <strong>Note:</strong> Since the document is an entity, the handler
* will be notified of the start of the document entity by calling the
* startEntity method with the entity name "[xml]" <em>before</em> calling
* the startDocument method. When exposing entity boundaries through the
* SAX API, the document entity is never reported, however.
* <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
* @param name The name of the entity.
* @param identifier The resource identifier.
* @param encoding The auto-detected IANA encoding name of the entity
* stream. This value will be null in those situations
* where the entity encoding is not auto-detected (e.g.
* internal parameter entities).
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startGeneralEntity(String name, XMLResourceIdentifier identifier,
String encoding, Augmentations augs)
throws XNIException {
try {
// Only report startEntity if this entity was actually read.
if (augs != null && Boolean.TRUE.equals(augs.getItem(Constants.ENTITY_SKIPPED))) {
// report skipped entity to content handler
if (fContentHandler != null) {
fContentHandler.skippedEntity(name);
}
}
else {
// SAX2 extension
if (fLexicalHandler != null) {
fLexicalHandler.startEntity(name);
}
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例11: ignorableWhitespace
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/**
* Ignorable whitespace. For this method to be called, the document
* source must have some way of determining that the text containing
* only whitespace characters should be considered ignorable. For
* example, the validator can determine if a length of whitespace
* characters in the document are ignorable based on the element
* content model.
*
* @param text The ignorable whitespace.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
try {
// SAX1
if (fDocumentHandler != null) {
fDocumentHandler.ignorableWhitespace(text.ch, text.offset, text.length);
}
// SAX2
if (fContentHandler != null) {
fContentHandler.ignorableWhitespace(text.ch, text.offset, text.length);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例12: endDocument
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/**
* The end of the document.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void endDocument(Augmentations augs) throws XNIException {
try {
// SAX1
if (fDocumentHandler != null) {
fDocumentHandler.endDocument();
}
// SAX2
if (fContentHandler != null) {
fContentHandler.endDocument();
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例13: startParameterEntity
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/**
* This method notifies of the start of parameter entity. The DTD has the
* pseudo-name of "[dtd]" parameter entity names start with '%'; and
* general entity names are just the entity name.
* <p>
* <strong>Note:</strong> Since the document is an entity, the handler
* will be notified of the start of the document entity by calling the
* startEntity method with the entity name "[xml]" <em>before</em> calling
* the startDocument method. When exposing entity boundaries through the
* SAX API, the document entity is never reported, however.
* <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
* @param name The name of the parameter entity.
* @param identifier The resource identifier.
* @param encoding The auto-detected IANA encoding name of the entity
* stream. This value will be null in those situations
* where the entity encoding is not auto-detected (e.g.
* internal parameter entities).
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startParameterEntity(String name,
XMLResourceIdentifier identifier,
String encoding, Augmentations augs)
throws XNIException {
try {
// Only report startEntity if this entity was actually read.
if (augs != null && Boolean.TRUE.equals(augs.getItem(Constants.ENTITY_SKIPPED))) {
// report skipped entity to content handler
if (fContentHandler != null) {
fContentHandler.skippedEntity(name);
}
}
else {
// SAX2 extension
if (fLexicalHandler != null && fLexicalHandlerParameterEntities) {
fLexicalHandler.startEntity(name);
}
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例14: externalEntityDecl
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/**
* An external entity declaration.
*
* @param name The name of the entity. Parameter entity names start
* with '%', whereas the name of a general entity is just
* the entity name.
* @param identifier An object containing all location information
* pertinent to this entity.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void externalEntityDecl(String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {
try {
// SAX2 extension
if (fDeclHandler != null) {
String publicId = identifier.getPublicId();
String systemId = fResolveDTDURIs ?
identifier.getExpandedSystemId() : identifier.getLiteralSystemId();
fDeclHandler.externalEntityDecl(name, publicId, systemId);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例15: unparsedEntityDecl
import org.apache.xerces.xni.XNIException; //导入依赖的package包/类
/**
* An unparsed entity declaration.
*
* @param name The name of the entity.
* @param identifier An object containing all location information
* pertinent to this entity.
* @param notation The name of the notation.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void unparsedEntityDecl(String name, XMLResourceIdentifier identifier,
String notation,
Augmentations augs) throws XNIException {
try {
// SAX2 extension
if (fDTDHandler != null) {
String publicId = identifier.getPublicId();
String systemId = fResolveDTDURIs ?
identifier.getExpandedSystemId() : identifier.getLiteralSystemId();
fDTDHandler.unparsedEntityDecl(name, publicId, systemId, notation);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}