本文整理匯總了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 );
}