本文整理汇总了Java中com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource.getSystemId方法的典型用法代码示例。如果您正苦于以下问题:Java XMLInputSource.getSystemId方法的具体用法?Java XMLInputSource.getSystemId怎么用?Java XMLInputSource.getSystemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource
的用法示例。
在下文中一共展示了XMLInputSource.getSystemId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveExternalSubsetAndRead
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; //导入方法依赖的package包/类
protected void resolveExternalSubsetAndRead()
throws IOException, XNIException {
fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
fDTDDescription.setRootName(fElementQName.rawname);
XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);
if (src != null) {
fDoctypeName = fElementQName.rawname;
fDoctypePublicId = src.getPublicId();
fDoctypeSystemId = src.getSystemId();
// call document handler
if (fDocumentHandler != null) {
// This inserts a doctypeDecl event into the stream though no
// DOCTYPE existed in the instance document.
fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
}
try {
fDTDScanner.setInputSource(src);
while (fDTDScanner.scanDTDExternalSubset(true));
} finally {
fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
}
}
}
示例2: loadGrammar
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; //导入方法依赖的package包/类
/**
* Returns a Grammar object by parsing the contents of the
* entity pointed to by source.
*
* @param source the location of the entity which forms
* the starting point of the grammar to be constructed.
* @throws IOException When a problem is encountered reading the entity
* XNIException When a condition arises (such as a FatalError) that requires parsing
* of the entity be terminated.
*/
public Grammar loadGrammar(XMLInputSource source)
throws IOException, XNIException {
reset();
// First chance checking strict URI
String eid = XMLEntityManager.expandSystemId(source.getSystemId(), source.getBaseSystemId(), fStrictURI);
XMLDTDDescription desc = new XMLDTDDescription(source.getPublicId(), source.getSystemId(), source.getBaseSystemId(), eid, null);
if (!fBalanceSyntaxTrees) {
fDTDGrammar = new DTDGrammar(fSymbolTable, desc);
}
else {
fDTDGrammar = new BalancedDTDGrammar(fSymbolTable, desc);
}
fGrammarBucket = new DTDGrammarBucket();
fGrammarBucket.setStandalone(false);
fGrammarBucket.setActiveGrammar(fDTDGrammar);
// no reason to use grammar bucket's "put" method--we
// know which grammar it is, and we don't know the root name anyway...
// actually start the parsing!
try {
fDTDScanner.setInputSource(source);
fDTDScanner.scanDTDExternalSubset(true);
} catch (EOFException e) {
// expected behaviour...
}
finally {
// Close all streams opened by the parser.
fEntityManager.closeReaders();
}
if(fDTDGrammar != null && fGrammarPool != null) {
fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
}
return fDTDGrammar;
}
示例3: getSchemaDocument
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; //导入方法依赖的package包/类
/**
* getSchemaDocument method uses XMLInputSource to parse a schema document.
* @param schemaNamespace
* @param schemaSource
* @param mustResolve
* @param referType
* @param referElement
* @return A schema Element.
*/
private Element getSchemaDocument(String schemaNamespace, XMLInputSource schemaSource,
boolean mustResolve, short referType, Element referElement) {
boolean hasInput = true;
IOException exception = null;
// contents of this method will depend on the system we adopt for entity resolution--i.e., XMLEntityHandler, EntityHandler, etc.
Element schemaElement = null;
try {
// when the system id and byte stream and character stream
// of the input source are all null, it's
// impossible to find the schema document. so we skip in
// this case. otherwise we'll receive some NPE or
// file not found errors. but schemaHint=="" is perfectly
// legal for import.
if (schemaSource != null &&
(schemaSource.getSystemId() != null ||
schemaSource.getByteStream() != null ||
schemaSource.getCharacterStream() != null)) {
// When the system id of the input source is used, first try to
// expand it, and check whether the same document has been
// parsed before. If so, return the document corresponding to
// that system id.
XSDKey key = null;
String schemaId = null;
if (referType != XSDDescription.CONTEXT_PREPARSE){
schemaId = XMLEntityManager.expandSystemId(schemaSource.getSystemId(), schemaSource.getBaseSystemId(), false);
key = new XSDKey(schemaId, referType, schemaNamespace);
if((schemaElement = (Element)fTraversed.get(key)) != null) {
fLastSchemaWasDuplicate = true;
return schemaElement;
}
if (referType == XSDDescription.CONTEXT_IMPORT || referType == XSDDescription.CONTEXT_INCLUDE
|| referType == XSDDescription.CONTEXT_REDEFINE) {
String accessError = SecuritySupport.checkAccess(schemaId, fAccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {
reportSchemaFatalError("schema_reference.access",
new Object[] { SecuritySupport.sanitizePath(schemaId), accessError },
referElement);
}
}
}
fSchemaParser.parse(schemaSource);
Document schemaDocument = fSchemaParser.getDocument();
schemaElement = schemaDocument != null ? DOMUtil.getRoot(schemaDocument) : null;
return getSchemaDocument0(key, schemaId, schemaElement);
}
else {
hasInput = false;
}
}
catch (IOException ex) {
exception = ex;
}
return getSchemaDocument1(mustResolve, hasInput, schemaSource, referElement, exception);
}
示例4: getSchemaDocument
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; //导入方法依赖的package包/类
/**
* getSchemaDocument method uses XMLInputSource to parse a schema document.
* @param schemaNamespace
* @param schemaSource
* @param mustResolve
* @param referType
* @param referElement
* @return A schema Element.
*/
private Element getSchemaDocument(String schemaNamespace, XMLInputSource schemaSource,
boolean mustResolve, short referType, Element referElement) {
boolean hasInput = true;
IOException exception = null;
// contents of this method will depend on the system we adopt for entity resolution--i.e., XMLEntityHandler, EntityHandler, etc.
Element schemaElement = null;
try {
// when the system id and byte stream and character stream
// of the input source are all null, it's
// impossible to find the schema document. so we skip in
// this case. otherwise we'll receive some NPE or
// file not found errors. but schemaHint=="" is perfectly
// legal for import.
if (schemaSource != null &&
(schemaSource.getSystemId() != null ||
schemaSource.getByteStream() != null ||
schemaSource.getCharacterStream() != null)) {
// When the system id of the input source is used, first try to
// expand it, and check whether the same document has been
// parsed before. If so, return the document corresponding to
// that system id.
XSDKey key = null;
String schemaId = null;
if (referType != XSDDescription.CONTEXT_PREPARSE){
schemaId = XMLEntityManager.expandSystemId(schemaSource.getSystemId(), schemaSource.getBaseSystemId(), false);
key = new XSDKey(schemaId, referType, schemaNamespace);
if((schemaElement = fTraversed.get(key)) != null) {
fLastSchemaWasDuplicate = true;
return schemaElement;
}
if ((!schemaSource.isCreatedByResolver()) &&
(referType == XSDDescription.CONTEXT_IMPORT || referType == XSDDescription.CONTEXT_INCLUDE
|| referType == XSDDescription.CONTEXT_REDEFINE)) {
String accessError = SecuritySupport.checkAccess(schemaId, fAccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {
reportSchemaFatalError("schema_reference.access",
new Object[] { SecuritySupport.sanitizePath(schemaId), accessError },
referElement);
}
}
}
fSchemaParser.parse(schemaSource);
Document schemaDocument = fSchemaParser.getDocument();
schemaElement = schemaDocument != null ? DOMUtil.getRoot(schemaDocument) : null;
return getSchemaDocument0(key, schemaId, schemaElement);
}
else {
hasInput = false;
}
}
catch (IOException ex) {
exception = ex;
}
return getSchemaDocument1(mustResolve, hasInput, schemaSource, referElement, exception);
}