當前位置: 首頁>>代碼示例>>Java>>正文


Java StreamSource.getPublicId方法代碼示例

本文整理匯總了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());
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:XMLInputFactoryImpl.java

示例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());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:XMLInputFactoryImpl.java

示例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() );
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:Util.java

示例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 );
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:Util.java


注:本文中的javax.xml.transform.stream.StreamSource.getPublicId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。