本文整理汇总了Java中org.xml.sax.InputSource.getSystemId方法的典型用法代码示例。如果您正苦于以下问题:Java InputSource.getSystemId方法的具体用法?Java InputSource.getSystemId怎么用?Java InputSource.getSystemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.InputSource
的用法示例。
在下文中一共展示了InputSource.getSystemId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveEntity
import org.xml.sax.InputSource; //导入方法依赖的package包/类
@Override
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
// System.out.println(MessageFormat.format("Resolving publicId [{0}], systemId [{1}].",
// publicId, systemId));
final InputSource resolvedInputSource = this.entityResolver
.resolveEntity(publicId, systemId);
if (resolvedInputSource == null) {
// System.out.println("Resolution result is null.");
return null;
} else {
// System.out.println(MessageFormat.format(
// "Resolved to publicId [{0}], systemId [{1}].",
// resolvedInputSource.getPublicId(),
// resolvedInputSource.getSystemId()));
final String pId = publicId != null ? publicId
: resolvedInputSource.getPublicId();
final String sId = systemId != null ? systemId
: resolvedInputSource.getSystemId();
return new ReResolvingInputSourceWrapper(this.entityResolver,
resolvedInputSource, pId, sId);
}
}
示例2: createXMLInputSource
import org.xml.sax.InputSource; //导入方法依赖的package包/类
/**
* Creates an XMLInputSource from a SAX InputSource.
*/
private XMLInputSource createXMLInputSource(InputSource source, String baseURI) {
String publicId = source.getPublicId();
String systemId = source.getSystemId();
String baseSystemId = baseURI;
InputStream byteStream = source.getByteStream();
Reader charStream = source.getCharacterStream();
String encoding = source.getEncoding();
XMLInputSource xmlInputSource =
new XMLInputSource(publicId, systemId, baseSystemId, false);
xmlInputSource.setByteStream(byteStream);
xmlInputSource.setCharacterStream(charStream);
xmlInputSource.setEncoding(encoding);
return xmlInputSource;
}
示例3: resolveEntity
import org.xml.sax.InputSource; //导入方法依赖的package包/类
public Parser resolveEntity(String publicId, String systemId) throws SAXException, IOException {
InputSource source = core.resolveEntity(publicId,systemId);
if(source==null)
return null; // default
// ideally entity resolvers should be giving us the system ID for the resource
// (or otherwise we won't be able to resolve references within this imported WSDL correctly),
// but if none is given, the system ID before the entity resolution is better than nothing.
if(source.getSystemId()!=null)
systemId = source.getSystemId();
URL url = new URL(systemId);
InputStream stream;
if (useStreamFromEntityResolver) {
stream = source.getByteStream();
} else {
stream = url.openStream();
}
return new Parser(url,
new TidyXMLStreamReader(XMLStreamReaderFactory.create(url.toExternalForm(), stream, true), stream));
}
示例4: parseEntity
import org.xml.sax.InputSource; //导入方法依赖的package包/类
/**
* Parses the specified entity.
*
* @param importLocation
* The source location of the import/include statement.
* Used for reporting errors.
*/
public void parseEntity( InputSource source, boolean includeMode, String expectedNamespace, Locator importLocation )
throws SAXException {
documentSystemId = source.getSystemId();
try {
Schema s = new Schema(this,includeMode,expectedNamespace);
setRootHandler(s);
try {
parser.parser.parse(source,this, getErrorHandler(), parser.getEntityResolver());
} catch( IOException fnfe ) {
SAXParseException se = new SAXParseException(fnfe.toString(), importLocation, fnfe);
parser.errorHandler.warning(se);
}
} catch( SAXException e ) {
parser.setErrorFlag();
throw e;
}
}
示例5: parse
import org.xml.sax.InputSource; //导入方法依赖的package包/类
public void parse(InputSource source, ContentHandler handler, ErrorHandler errorHandler, EntityResolver entityResolver)
throws SAXException, IOException {
String systemId = source.getSystemId();
Document dom = forest.get(systemId);
if (dom == null) {
// if no DOM tree is built for it,
// let the fall back parser parse the original document.
//
// for example, XSOM parses datatypes.xsd (XML Schema part 2)
// but this will never be built into the forest.
fallbackParser.parse(source, handler, errorHandler, entityResolver);
return;
}
scanner.scan(dom, handler);
}
示例6: parse
import org.xml.sax.InputSource; //导入方法依赖的package包/类
public void parse(
InputSource source,
ContentHandler contentHandler,
ErrorHandler errorHandler,
EntityResolver entityResolver )
throws SAXException, IOException {
String systemId = source.getSystemId();
Document dom = forest.get(systemId);
if(dom==null) {
// if no DOM tree is built for it,
// let the fall back parser parse the original document.
//
// for example, XSOM parses datatypes.xsd (XML Schema part 2)
// but this will never be built into the forest.
fallbackParser.parse( source, contentHandler, errorHandler, entityResolver );
return;
}
scanner.scan( dom, contentHandler );
}
示例7: createXMLInputSource
import org.xml.sax.InputSource; //导入方法依赖的package包/类
/**
* Creates an XMLInputSource from a SAX InputSource.
*/
private XMLInputSource createXMLInputSource(InputSource source, String baseURI) {
String publicId = source.getPublicId();
String systemId = source.getSystemId();
String baseSystemId = baseURI;
InputStream byteStream = source.getByteStream();
Reader charStream = source.getCharacterStream();
String encoding = source.getEncoding();
XMLInputSource xmlInputSource =
new XMLInputSource(publicId, systemId, baseSystemId);
xmlInputSource.setByteStream(byteStream);
xmlInputSource.setCharacterStream(charStream);
xmlInputSource.setEncoding(encoding);
return xmlInputSource;
}
示例8: saxToXMLInputSource
import org.xml.sax.InputSource; //导入方法依赖的package包/类
private static XMLInputSource saxToXMLInputSource(InputSource sis) {
String publicId = sis.getPublicId();
String systemId = sis.getSystemId();
Reader charStream = sis.getCharacterStream();
if (charStream != null) {
return new XMLInputSource(publicId, systemId, null, charStream,
null);
}
InputStream byteStream = sis.getByteStream();
if (byteStream != null) {
return new XMLInputSource(publicId, systemId, null, byteStream,
sis.getEncoding());
}
return new XMLInputSource(publicId, systemId, null, false);
}
示例9: resolveResource
import org.xml.sax.InputSource; //导入方法依赖的package包/类
@Override
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
InputSource is = resolveEntity(publicId, systemId);
if (is != null && !is.isEmpty()) {
return new LSInputImpl(is.getSystemId());
}
GroupEntry.ResolveType resolveType = ((CatalogImpl) catalog).getResolve();
switch (resolveType) {
case IGNORE:
return null;
case STRICT:
CatalogMessages.reportError(CatalogMessages.ERR_NO_MATCH,
new Object[]{publicId, systemId});
}
//no action, allow the parser to continue
return null;
}
示例10: parse
import org.xml.sax.InputSource; //导入方法依赖的package包/类
/**
* Parse a DTD.
*/
public void parse(String uri)
throws IOException, SAXException {
InputSource inSource;
init();
// System.out.println ("parse (\"" + uri + "\")");
inSource = resolver.resolveEntity(null, uri);
// If custom resolver punts resolution to parser, handle it ...
if (inSource == null) {
inSource = Resolver.createInputSource(new java.net.URL(uri), false);
// ... or if custom resolver doesn't correctly construct the
// input entity, patch it up enough so relative URIs work, and
// issue a warning to minimize later confusion.
} else if (inSource.getSystemId() == null) {
warning("P-065", null);
inSource.setSystemId(uri);
}
parseInternal(inSource);
}
示例11: parseEntity
import org.xml.sax.InputSource; //导入方法依赖的package包/类
/**
* Parses the specified entity.
*
* @param source
* @param importLocation
* The source location of the import/include statement.
* Used for reporting errors.
* @param includeMode
* @param expectedNamespace
* @throws org.xml.sax.SAXException
*/
public void parseEntity( InputSource source, boolean includeMode, String expectedNamespace, Locator importLocation )
throws SAXException {
documentSystemId = source.getSystemId();
try {
Schema s = new Schema(this,includeMode,expectedNamespace);
setRootHandler(s);
try {
parser.parser.parse(source,this, getErrorHandler(), parser.getEntityResolver());
} catch( IOException fnfe ) {
SAXParseException se = new SAXParseException(fnfe.toString(), importLocation, fnfe);
parser.errorHandler.warning(se);
}
} catch( SAXException e ) {
parser.setErrorFlag();
throw e;
}
}
示例12: parse
import org.xml.sax.InputSource; //导入方法依赖的package包/类
public void parse(InputSource input) throws IOException, SAXException {
try {
InputStream s = input.getByteStream();
if (s == null) {
String systemId = input.getSystemId();
if (systemId == null) {
throw new SAXException(CommonResourceBundle.getInstance().getString("message.inputSource"));
}
parse(systemId);
} else {
parse(s);
}
} catch (FastInfosetException e) {
logger.log(Level.FINE, "parsing error", e);
throw new SAXException(e);
}
}
示例13: toFileObject
import org.xml.sax.InputSource; //导入方法依赖的package包/类
public static FileObject toFileObject(InputSource src) {
try {
String sysId = src.getSystemId();
return FileUtil.toFileObject(new File(new URI(sysId)));
} catch (URISyntaxException ex) {
LOG.log(Level.WARNING, "File URI malformed", ex);
return null;
}
}
示例14: parseSomeSetup
import org.xml.sax.InputSource; //导入方法依赖的package包/类
private boolean parseSomeSetup(InputSource source)
throws SAXException, IOException, IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.InstantiationException
{
if(fConfigSetInput!=null)
{
// Obtain input from SAX inputSource object, construct XNI version of
// that object. Logic adapted from Xerces2.
Object[] parms1={source.getPublicId(),source.getSystemId(),null};
Object xmlsource=fConfigInputSourceCtor.newInstance(parms1);
Object[] parmsa={source.getByteStream()};
fConfigSetByteStream.invoke(xmlsource,parmsa);
parmsa[0]=source.getCharacterStream();
fConfigSetCharStream.invoke(xmlsource,parmsa);
parmsa[0]=source.getEncoding();
fConfigSetEncoding.invoke(xmlsource,parmsa);
// Bugzilla5272 patch suggested by Sandy Gao.
// Has to be reflection to run with Xerces2
// after compilation against Xerces1. or vice
// versa, due to return type mismatches.
Object[] noparms=new Object[0];
fReset.invoke(fIncrementalParser,noparms);
parmsa[0]=xmlsource;
fConfigSetInput.invoke(fPullParserConfig,parmsa);
// %REVIEW% Do first pull. Should we instead just return true?
return parseSome();
}
else
{
Object[] parm={source};
Object ret=fParseSomeSetup.invoke(fIncrementalParser,parm);
return ((Boolean)ret).booleanValue();
}
}
示例15: SAXInputSource
import org.xml.sax.InputSource; //导入方法依赖的package包/类
public SAXInputSource(XMLReader reader, InputSource inputSource) {
super(inputSource != null ? inputSource.getPublicId() : null,
inputSource != null ? inputSource.getSystemId() : null, null);
if (inputSource != null) {
setByteStream(inputSource.getByteStream());
setCharacterStream(inputSource.getCharacterStream());
setEncoding(inputSource.getEncoding());
}
fInputSource = inputSource;
fXMLReader = reader;
}