org.xml.sax.InputSource#getPublicId ( )源码实例Demo

下面列出了org.xml.sax.InputSource#getPublicId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-8   文件: XMLSchemaLoader.java
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);
}
 
源代码2 项目: openjdk-jdk9   文件: XMLSchemaLoader.java
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);
}
 
/**
 * 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;

}
 
源代码4 项目: hottub   文件: XMLSchemaLoader.java
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);
}
 
源代码5 项目: openjdk-8-source   文件: XMLSchemaLoader.java
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);
}
 
源代码6 项目: jdk8u60   文件: XMLSchemaLoader.java
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);
}
 
源代码7 项目: JDKSourceCode1.8   文件: XMLSchemaLoader.java
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);
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: SAXInputSource.java
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;
}
 
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();
        }
}
 
源代码10 项目: openjdk-jdk9   文件: IncrementalSAXSource_Xerces.java
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();
        }
}
 
源代码11 项目: TencentKona-8   文件: SAXInputSource.java
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;
}
 
源代码12 项目: Bytecoder   文件: IncrementalSAXSource_Xerces.java
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();
        }
}
 
源代码13 项目: openjdk-8   文件: SAXInputSource.java
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;
}
 
源代码14 项目: openjdk-8   文件: IncrementalSAXSource_Xerces.java
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();
        }
}
 
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();
        }
}
 
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier        contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
    throws XNIException, IOException {

    // When both pubId and sysId are null, the user's entity resolver
    // can do nothing about it. We'd better not bother calling it.
    // This happens when the resourceIdentifier is a GrammarDescription,
    // which describes a schema grammar of some namespace, but without
    // any schema location hint. -Sg
    String pubId = resourceIdentifier.getPublicId();
    String sysId = resourceIdentifier.getExpandedSystemId();
    if (pubId == null && sysId == null)
        return null;

    // resolve entity using SAX entity resolver
    if (fEntityResolver != null && resourceIdentifier != null) {
        try {
            InputSource inputSource = fEntityResolver.resolveEntity(pubId, sysId);
            if (inputSource != null) {
                String publicId = inputSource.getPublicId();
                String systemId = inputSource.getSystemId();
                String baseSystemId = resourceIdentifier.getBaseSystemId();
                InputStream byteStream = inputSource.getByteStream();
                Reader charStream = inputSource.getCharacterStream();
                String encoding = inputSource.getEncoding();
                XMLInputSource xmlInputSource =
                    new XMLInputSource(publicId, systemId, baseSystemId);
                xmlInputSource.setByteStream(byteStream);
                xmlInputSource.setCharacterStream(charStream);
                xmlInputSource.setEncoding(encoding);
                return xmlInputSource;
            }
        }

        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
源代码17 项目: TencentKona-8   文件: EntityResolverWrapper.java
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier        contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
    throws XNIException, IOException {

    // When both pubId and sysId are null, the user's entity resolver
    // can do nothing about it. We'd better not bother calling it.
    // This happens when the resourceIdentifier is a GrammarDescription,
    // which describes a schema grammar of some namespace, but without
    // any schema location hint. -Sg
    String pubId = resourceIdentifier.getPublicId();
    String sysId = resourceIdentifier.getExpandedSystemId();
    if (pubId == null && sysId == null)
        return null;

    // resolve entity using SAX entity resolver
    if (fEntityResolver != null && resourceIdentifier != null) {
        try {
            InputSource inputSource = fEntityResolver.resolveEntity(pubId, sysId);
            if (inputSource != null) {
                String publicId = inputSource.getPublicId();
                String systemId = inputSource.getSystemId();
                String baseSystemId = resourceIdentifier.getBaseSystemId();
                InputStream byteStream = inputSource.getByteStream();
                Reader charStream = inputSource.getCharacterStream();
                String encoding = inputSource.getEncoding();
                XMLInputSource xmlInputSource =
                    new XMLInputSource(publicId, systemId, baseSystemId);
                xmlInputSource.setByteStream(byteStream);
                xmlInputSource.setCharacterStream(charStream);
                xmlInputSource.setEncoding(encoding);
                return xmlInputSource;
            }
        }

        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
源代码18 项目: openjdk-jdk8u   文件: EntityResolverWrapper.java
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier        contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
    throws XNIException, IOException {

    // When both pubId and sysId are null, the user's entity resolver
    // can do nothing about it. We'd better not bother calling it.
    // This happens when the resourceIdentifier is a GrammarDescription,
    // which describes a schema grammar of some namespace, but without
    // any schema location hint. -Sg
    String pubId = resourceIdentifier.getPublicId();
    String sysId = resourceIdentifier.getExpandedSystemId();
    if (pubId == null && sysId == null)
        return null;

    // resolve entity using SAX entity resolver
    if (fEntityResolver != null && resourceIdentifier != null) {
        try {
            InputSource inputSource = fEntityResolver.resolveEntity(pubId, sysId);
            if (inputSource != null) {
                String publicId = inputSource.getPublicId();
                String systemId = inputSource.getSystemId();
                String baseSystemId = resourceIdentifier.getBaseSystemId();
                InputStream byteStream = inputSource.getByteStream();
                Reader charStream = inputSource.getCharacterStream();
                String encoding = inputSource.getEncoding();
                XMLInputSource xmlInputSource =
                    new XMLInputSource(publicId, systemId, baseSystemId);
                xmlInputSource.setByteStream(byteStream);
                xmlInputSource.setCharacterStream(charStream);
                xmlInputSource.setEncoding(encoding);
                return xmlInputSource;
            }
        }

        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
源代码19 项目: openjdk-8-source   文件: EntityResolverWrapper.java
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier        contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
    throws XNIException, IOException {

    // When both pubId and sysId are null, the user's entity resolver
    // can do nothing about it. We'd better not bother calling it.
    // This happens when the resourceIdentifier is a GrammarDescription,
    // which describes a schema grammar of some namespace, but without
    // any schema location hint. -Sg
    String pubId = resourceIdentifier.getPublicId();
    String sysId = resourceIdentifier.getExpandedSystemId();
    if (pubId == null && sysId == null)
        return null;

    // resolve entity using SAX entity resolver
    if (fEntityResolver != null && resourceIdentifier != null) {
        try {
            InputSource inputSource = fEntityResolver.resolveEntity(pubId, sysId);
            if (inputSource != null) {
                String publicId = inputSource.getPublicId();
                String systemId = inputSource.getSystemId();
                String baseSystemId = resourceIdentifier.getBaseSystemId();
                InputStream byteStream = inputSource.getByteStream();
                Reader charStream = inputSource.getCharacterStream();
                String encoding = inputSource.getEncoding();
                XMLInputSource xmlInputSource =
                    new XMLInputSource(publicId, systemId, baseSystemId);
                xmlInputSource.setByteStream(byteStream);
                xmlInputSource.setCharacterStream(charStream);
                xmlInputSource.setEncoding(encoding);
                return xmlInputSource;
            }
        }

        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}
 
源代码20 项目: JDKSourceCode1.8   文件: EntityResolverWrapper.java
/**
 * Resolves an external parsed entity. If the entity cannot be
 * resolved, this method should return null.
 *
 * @param resourceIdentifier        contains the physical co-ordinates of the resource to be resolved
 *
 * @throws XNIException Thrown on general error.
 * @throws IOException  Thrown if resolved entity stream cannot be
 *                      opened or some other i/o error occurs.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
    throws XNIException, IOException {

    // When both pubId and sysId are null, the user's entity resolver
    // can do nothing about it. We'd better not bother calling it.
    // This happens when the resourceIdentifier is a GrammarDescription,
    // which describes a schema grammar of some namespace, but without
    // any schema location hint. -Sg
    String pubId = resourceIdentifier.getPublicId();
    String sysId = resourceIdentifier.getExpandedSystemId();
    if (pubId == null && sysId == null)
        return null;

    // resolve entity using SAX entity resolver
    if (fEntityResolver != null && resourceIdentifier != null) {
        try {
            InputSource inputSource = fEntityResolver.resolveEntity(pubId, sysId);
            if (inputSource != null) {
                String publicId = inputSource.getPublicId();
                String systemId = inputSource.getSystemId();
                String baseSystemId = resourceIdentifier.getBaseSystemId();
                InputStream byteStream = inputSource.getByteStream();
                Reader charStream = inputSource.getCharacterStream();
                String encoding = inputSource.getEncoding();
                XMLInputSource xmlInputSource =
                    new XMLInputSource(publicId, systemId, baseSystemId);
                xmlInputSource.setByteStream(byteStream);
                xmlInputSource.setCharacterStream(charStream);
                xmlInputSource.setEncoding(encoding);
                return xmlInputSource;
            }
        }

        // error resolving entity
        catch (SAXException e) {
            Exception ex = e.getException();
            if (ex == null) {
                ex = e;
            }
            throw new XNIException(ex);
        }
    }

    // unable to resolve entity
    return null;

}