本文整理汇总了Java中javax.xml.transform.stream.StreamSource.getPublicId方法的典型用法代码示例。如果您正苦于以下问题:Java StreamSource.getPublicId方法的具体用法?Java StreamSource.getPublicId怎么用?Java StreamSource.getPublicId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.transform.stream.StreamSource
的用法示例。
在下文中一共展示了StreamSource.getPublicId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jaxpSourcetoXMLInputSource
import javax.xml.transform.stream.StreamSource; //导入方法依赖的package包/类
XMLInputSource jaxpSourcetoXMLInputSource(Source source){
if(source instanceof StreamSource){
StreamSource stSource = (StreamSource)source;
String systemId = stSource.getSystemId();
String publicId = stSource.getPublicId();
InputStream istream = stSource.getInputStream();
Reader reader = stSource.getReader();
if(istream != null){
return new XMLInputSource(publicId, systemId, null, istream, null);
}
else if(reader != null){
return new XMLInputSource(publicId, systemId,null, reader, null);
}else{
return new XMLInputSource(publicId, systemId, null);
}
}
throw new UnsupportedOperationException("Cannot create " +
"XMLStreamReader or XMLEventReader from a " +
source.getClass().getName());
}
示例2: jaxpSourcetoXMLInputSource
import javax.xml.transform.stream.StreamSource; //导入方法依赖的package包/类
XMLInputSource jaxpSourcetoXMLInputSource(Source source){
if(source instanceof StreamSource){
StreamSource stSource = (StreamSource)source;
String systemId = stSource.getSystemId();
String publicId = stSource.getPublicId();
InputStream istream = stSource.getInputStream();
Reader reader = stSource.getReader();
if(istream != null){
return new XMLInputSource(publicId, systemId, null, istream, null);
}
else if(reader != null){
return new XMLInputSource(publicId, systemId,null, reader, null);
}else{
return new XMLInputSource(publicId, systemId, null, false);
}
}
throw new UnsupportedOperationException("Cannot create " +
"XMLStreamReader or XMLEventReader from a " +
source.getClass().getName());
}
示例3: toXMLInputSource
import javax.xml.transform.stream.StreamSource; //导入方法依赖的package包/类
/**
* Creates a proper {@link XMLInputSource} from a {@link StreamSource}.
*
* @return always return non-null valid object.
*/
public static final XMLInputSource toXMLInputSource( StreamSource in ) {
if( in.getReader()!=null )
return new XMLInputSource(
in.getPublicId(), in.getSystemId(), in.getSystemId(),
in.getReader(), null );
if( in.getInputStream()!=null )
return new XMLInputSource(
in.getPublicId(), in.getSystemId(), in.getSystemId(),
in.getInputStream(), null );
return new XMLInputSource(
in.getPublicId(), in.getSystemId(), in.getSystemId() );
}
示例4: toXMLInputSource
import javax.xml.transform.stream.StreamSource; //导入方法依赖的package包/类
/**
* Creates a proper {@link XMLInputSource} from a {@link StreamSource}.
*
* @return always return non-null valid object.
*/
public static final XMLInputSource toXMLInputSource( StreamSource in ) {
if( in.getReader()!=null )
return new XMLInputSource(
in.getPublicId(), in.getSystemId(), in.getSystemId(),
in.getReader(), null );
if( in.getInputStream()!=null )
return new XMLInputSource(
in.getPublicId(), in.getSystemId(), in.getSystemId(),
in.getInputStream(), null );
return new XMLInputSource(
in.getPublicId(), in.getSystemId(), in.getSystemId(), false );
}