当前位置: 首页>>代码示例>>Java>>正文


Java XMLResourceIdentifier.getBaseSystemId方法代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier.getBaseSystemId方法的典型用法代码示例。如果您正苦于以下问题:Java XMLResourceIdentifier.getBaseSystemId方法的具体用法?Java XMLResourceIdentifier.getBaseSystemId怎么用?Java XMLResourceIdentifier.getBaseSystemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier的用法示例。


在下文中一共展示了XMLResourceIdentifier.getBaseSystemId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addUnparsedEntity

import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * Caches an unparsed entity.
 * @param name the name of the unparsed entity
 * @param identifier the location of the unparsed entity
 * @param augmentations any Augmentations that were on the original unparsed entity declaration
 */
protected void addUnparsedEntity(
    String name,
    XMLResourceIdentifier identifier,
    String notation,
    Augmentations augmentations) {
    UnparsedEntity ent = new UnparsedEntity();
    ent.name = name;
    ent.systemId = identifier.getLiteralSystemId();
    ent.publicId = identifier.getPublicId();
    ent.baseURI = identifier.getBaseSystemId();
    ent.expandedSystemId = identifier.getExpandedSystemId();
    ent.notation = notation;
    ent.augmentations = augmentations;
    fUnparsedEntities.add(ent);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:XIncludeHandler.java

示例2: resolveEntity

import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * 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 {

    if (fEntityResolver != null) {

        String pubId = resourceIdentifier.getPublicId();
        String sysId = resourceIdentifier.getLiteralSystemId();
        String baseURI = resourceIdentifier.getBaseSystemId();
        String name = null;
        if (resourceIdentifier instanceof XMLDTDDescription) {
            name = "[dtd]";
        }
        else if (resourceIdentifier instanceof XMLEntityDescription) {
            name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
        }

        // 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
        if (pubId == null && sysId == null) {
            return null;
        }

        // Resolve using EntityResolver2
        try {
            InputSource inputSource =
                fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
            return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null;
        }
        // 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;

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:56,代码来源:EntityResolver2Wrapper.java

示例3: resolveEntity

import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * 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;

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:58,代码来源:EntityResolverWrapper.java

示例4: addNotation

import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * Caches a notation.
 * @param name the name of the notation
 * @param identifier the location of the notation
 * @param augmentations any Augmentations that were on the original notation declaration
 */
protected void addNotation(
    String name,
    XMLResourceIdentifier identifier,
    Augmentations augmentations) {
    Notation not = new Notation();
    not.name = name;
    not.systemId = identifier.getLiteralSystemId();
    not.publicId = identifier.getPublicId();
    not.baseURI = identifier.getBaseSystemId();
    not.expandedSystemId = identifier.getExpandedSystemId();
    not.augmentations = augmentations;
    fNotations.add(not);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:XIncludeHandler.java

示例5: resolveEntity

import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * Resolves the specified public and system identifiers. This
 * method first attempts to resolve the entity based on the
 * EntityResolver registered by the application. If no entity
 * resolver is registered or if the registered entity handler
 * is unable to resolve the entity, then default entity
 * resolution will occur.
 *
 * @param publicId     The public identifier of the entity.
 * @param systemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the current
 *                     entity and is used to expand the system
 *                     identifier when the system identifier is a
 *                     relative URI.
 *
 * @return Returns an input source that wraps the resolved entity.
 *         This method will never return null.
 *
 * @throws IOException  Thrown on i/o error.
 * @throws XNIException Thrown by entity resolver to signal an error.
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws IOException, XNIException {
    if(resourceIdentifier == null ) return null;
    String publicId = resourceIdentifier.getPublicId();
    String literalSystemId = resourceIdentifier.getLiteralSystemId();
    String baseSystemId = resourceIdentifier.getBaseSystemId();
    String expandedSystemId = resourceIdentifier.getExpandedSystemId();
    String namespace = resourceIdentifier.getNamespace();

    // if no base systemId given, assume that it's relative
    // to the systemId of the current scanned entity
    // Sometimes the system id is not (properly) expanded.
    // We need to expand the system id if:
    // a. the expanded one was null; or
    // b. the base system id was null, but becomes non-null from the current entity.
    boolean needExpand = (expandedSystemId == null);
    // REVISIT:  why would the baseSystemId ever be null?  if we
    // didn't have to make this check we wouldn't have to reuse the
    // fXMLResourceIdentifier object...
    if (baseSystemId == null && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
        baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
        if (baseSystemId != null)
            needExpand = true;
    }
    if (needExpand)
        expandedSystemId = expandSystemId(literalSystemId, baseSystemId,false);

    // give the entity resolver a chance
    XMLInputSource xmlInputSource = null;

    if (fEntityResolver != null) {
        resourceIdentifier.setBaseSystemId(baseSystemId);
        resourceIdentifier.setExpandedSystemId(expandedSystemId);
        xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier);
    }

    // do default resolution
    // REVISIT: what's the correct behavior if the user provided an entity
    // resolver (fEntityResolver != null), but resolveEntity doesn't return
    // an input source (xmlInputSource == null)?
    // do we do default resolution, or do we just return null? -SG
    if (xmlInputSource == null) {
        // REVISIT: when systemId is null, I think we should return null.
        //          is this the right solution? -SG
        //if (systemId != null)
        xmlInputSource = new XMLInputSource(publicId, literalSystemId, baseSystemId);
    }

    if (DEBUG_RESOLVER) {
        System.err.println("XMLEntityManager.resolveEntity(" + publicId + ")");
        System.err.println(" = " + xmlInputSource);
    }

    return xmlInputSource;

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:78,代码来源:XMLEntityManager.java

示例6: XMLInputSource

import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * Constructs an input source from a XMLResourceIdentifier
 * object, leaving resolution of the entity and opening of
 * the input stream up to the caller.
 *
 * @param resourceIdentifier    the XMLResourceIdentifier containing the information
 */
public XMLInputSource(XMLResourceIdentifier resourceIdentifier) {

    fPublicId = resourceIdentifier.getPublicId();
    fSystemId = resourceIdentifier.getLiteralSystemId();
    fBaseSystemId = resourceIdentifier.getBaseSystemId();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XMLInputSource.java

示例7: resolveEntity

import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * <p>Resolves an external entity. If the entity cannot be
 * resolved, this method should return <code>null</code>. This
 * method only calls <code>resolveIdentifier</code> and returns
 * an input source if an entry was found in the catalog. It
 * should be overrided if other behaviour is required.</p>
 *
 * @param resourceIdentifier location of the XML resource to resolve
 *
 * @throws XNIException thrown on general error
 * @throws IOException thrown if some i/o error occurs
 */
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
    throws XNIException, IOException {

    String resolvedId = resolveIdentifier(resourceIdentifier);
    if (resolvedId != null) {
        return new XMLInputSource(resourceIdentifier.getPublicId(),
                                  resolvedId,
                                  resourceIdentifier.getBaseSystemId());
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:XMLCatalogResolver.java


注:本文中的com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier.getBaseSystemId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。