本文整理了Java中javax.xml.transform.Source.getSystemId()
方法的一些代码示例,展示了Source.getSystemId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Source.getSystemId()
方法的具体详情如下:
包路径:javax.xml.transform.Source
类名称:Source
方法名:getSystemId
[英]Get the system identifier that was set with setSystemId.
[中]获取使用setSystemId设置的系统标识符。
代码示例来源:origin: xalan/xalan
/**
* Implements javax.xml.transform.Source.getSystemId()
* Get the system identifier that was set with setSystemId.
* @return The system identifier that was set with setSystemId,
* or null if setSystemId was not called.
*/
public String getSystemId() {
if (_source != null) {
return _source.getSystemId();
}
else {
return(_systemId);
}
}
代码示例来源:origin: stackoverflow.com
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.*;
...
URL schemaFile = new URL("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd");
Source xmlFile = new StreamSource(new File("web.xml"));
SchemaFactory schemaFactory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(schemaFile);
Validator validator = schema.newValidator();
try {
validator.validate(xmlFile);
System.out.println(xmlFile.getSystemId() + " is valid");
} catch (SAXException e) {
System.out.println(xmlFile.getSystemId() + " is NOT valid");
System.out.println("Reason: " + e.getLocalizedMessage());
}
代码示例来源:origin: robovm/robovm
String url = source.getSystemId();
代码示例来源:origin: robovm/robovm
/**
* Put the source tree root node in the document cache.
* TODO: This function needs to be a LOT more sophisticated.
*
* @param n The node to cache.
* @param source The Source object to cache.
*/
public void putDocumentInCache(int n, Source source)
{
int cachedNode = getNode(source);
if (DTM.NULL != cachedNode)
{
if (!(cachedNode == n))
throw new RuntimeException(
"Programmer's Error! "
+ "putDocumentInCache found reparse of doc: "
+ source.getSystemId());
return;
}
if (null != source.getSystemId())
{
m_sourceTree.addElement(new SourceTree(n, source.getSystemId()));
}
}
代码示例来源:origin: xalan/xalan
String url = source.getSystemId();
代码示例来源:origin: xalan/xalan
/**
* Put the source tree root node in the document cache.
* TODO: This function needs to be a LOT more sophisticated.
*
* @param n The node to cache.
* @param source The Source object to cache.
*/
public void putDocumentInCache(int n, Source source)
{
int cachedNode = getNode(source);
if (DTM.NULL != cachedNode)
{
if (!(cachedNode == n))
throw new RuntimeException(
"Programmer's Error! "
+ "putDocumentInCache found reparse of doc: "
+ source.getSystemId());
return;
}
if (null != source.getSystemId())
{
m_sourceTree.addElement(new SourceTree(n, source.getSystemId()));
}
}
代码示例来源:origin: xalan/xalan
String systemId = source.getSystemId();
if (systemId != null) {
File file = new File(systemId);
代码示例来源:origin: plutext/docx4j
in = ((StreamSource) source).getInputStream();
if (in == null && source.getSystemId() != null) {
in = new java.net.URL(source.getSystemId()).openStream();
代码示例来源:origin: jersey/jersey
@Override
public void writeTo(Source source, Class<?> t, Type gt, Annotation[] as, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException {
try {
if (source instanceof StreamSource) {
StreamSource stream = (StreamSource) source;
InputSource inputStream = new InputSource(stream.getInputStream());
inputStream.setCharacterStream(inputStream.getCharacterStream());
inputStream.setPublicId(stream.getPublicId());
inputStream.setSystemId(source.getSystemId());
source = new SAXSource(saxParserFactory.get().newSAXParser().getXMLReader(), inputStream);
}
StreamResult sr = new StreamResult(entityStream);
transformerFactory.get().newTransformer().transform(source, sr);
} catch (SAXException ex) {
throw new InternalServerErrorException(ex);
} catch (ParserConfigurationException ex) {
throw new InternalServerErrorException(ex);
} catch (TransformerException ex) {
throw new InternalServerErrorException(ex);
}
}
}
代码示例来源:origin: jersey/jersey
@Override
public void writeTo(Source source, Class<?> t, Type gt, Annotation[] as, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException {
try {
if (source instanceof StreamSource) {
StreamSource stream = (StreamSource) source;
InputSource inputStream = new InputSource(stream.getInputStream());
inputStream.setCharacterStream(inputStream.getCharacterStream());
inputStream.setPublicId(stream.getPublicId());
inputStream.setSystemId(source.getSystemId());
source = new SAXSource(saxParserFactory.get().newSAXParser().getXMLReader(), inputStream);
}
StreamResult sr = new StreamResult(entityStream);
transformerFactory.get().newTransformer().transform(source, sr);
} catch (SAXException ex) {
throw new InternalServerErrorException(ex);
} catch (ParserConfigurationException ex) {
throw new InternalServerErrorException(ex);
} catch (TransformerException ex) {
throw new InternalServerErrorException(ex);
}
}
}
代码示例来源:origin: xalan/xalan
/**
* Return the base class name of the translet.
* The translet name is resolved using the following rules:
* 1. if the _transletName attribute is set and its value is not "GregorSamsa",
* then _transletName is returned.
* 2. otherwise get the translet name from the base name of the system ID
* 3. return "GregorSamsa" if the result from step 2 is null.
*
* @param source The input Source
* @return The name of the translet class
*/
private String getTransletBaseName(Source source)
{
String transletBaseName = null;
if (!_transletName.equals(DEFAULT_TRANSLET_NAME))
return _transletName;
else {
String systemId = source.getSystemId();
if (systemId != null) {
String baseName = Util.baseName(systemId);
if (baseName != null) {
baseName = Util.noExtName(baseName);
transletBaseName = Util.toJavaName(baseName);
}
}
}
return (transletBaseName != null) ? transletBaseName : DEFAULT_TRANSLET_NAME;
}
代码示例来源:origin: plutext/docx4j
in = ((StreamSource) source).getInputStream();
if (in == null && source.getSystemId() != null) {
in = new java.net.URL(source.getSystemId()).openStream();
src.setSystemId(source.getSystemId());
reader = new FontReader(src);
} else {
代码示例来源:origin: xalan/xalan
/**
* This class wraps an ErrorListener into a MessageHandler in order to
* capture messages reported via xsl:message.
*/
static class MessageHandler
extends org.apache.xalan.xsltc.runtime.MessageHandler
{
private ErrorListener _errorListener;
public MessageHandler(ErrorListener errorListener) {
_errorListener = errorListener;
}
public void displayMessage(String msg) {
if(_errorListener == null) {
System.err.println(msg);
}
else {
try {
_errorListener.warning(new TransformerException(msg));
}
catch (TransformerException e) {
// ignored
}
}
}
}
代码示例来源:origin: robovm/robovm
if (s != null && (idFromUriResolverSource = s.getSystemId()) != null) {
代码示例来源:origin: xalan/xalan
if (s != null && (idFromUriResolverSource = s.getSystemId()) != null) {
代码示例来源:origin: xalan/xalan
_sourceSystemId = source.getSystemId();
代码示例来源:origin: robovm/robovm
String baseID = source.getSystemId();
代码示例来源:origin: xalan/xalan
String systemId = source.getSystemId();
代码示例来源:origin: robovm/robovm
m_mgrDefault=(DTMManagerDefault)mgr;
m_documentBaseURI = (null != source) ? source.getSystemId() : null;
m_dtmIdent.setElementAt(dtmIdentity,0);
m_wsfilter = whiteSpaceFilter;
代码示例来源:origin: xalan/xalan
m_mgrDefault=(DTMManagerDefault)mgr;
m_documentBaseURI = (null != source) ? source.getSystemId() : null;
m_dtmIdent.setElementAt(dtmIdentity,0);
m_wsfilter = whiteSpaceFilter;
内容来源于网络,如有侵权,请联系作者删除!