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


Java XMLResourceIdentifier.getPublicId方法代码示例

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


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

示例1: resolveEntity

import org.apache.xerces.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
@Override
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException {
	//logger.info("Resolving entity for: " + resourceIdentifier.getExpandedSystemId() + " namespace " + resourceIdentifier.getNamespace());
	
	try{
		URI originalURI = new URI(resourceIdentifier.getExpandedSystemId());
		if(xbrlSchemaRemap.containsKey(originalURI)){
			URI newURI = xbrlSchemaRemap.get(originalURI);
			
			return new XMLInputSource(null, newURI.toString(), newURI.toString(), fileCache.getFileInputStream(newURI.toString()), null);
		}
	}
	catch(URISyntaxException e){
		
	}
	
	return new XMLInputSource(resourceIdentifier.getPublicId(), 
			resourceIdentifier.getExpandedSystemId(), 
			resourceIdentifier.getExpandedSystemId(), 
			fileCache.getFileInputStream(resourceIdentifier.getExpandedSystemId()), 
			null);

}
 
开发者ID:chen4119,项目名称:tempeh,代码行数:24,代码来源:XbrlLoader.java

示例2: externalEntityDecl

import org.apache.xerces.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * An external entity declaration.
 *
 * @param name     The name of the entity. Parameter entity names start
 *                 with '%', whereas the name of a general entity is just
 *                 the entity name.
 * @param identifier    An object containing all location information 
 *                      pertinent to this entity.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void externalEntityDecl(String name, XMLResourceIdentifier identifier,
                               Augmentations augs) throws XNIException {
    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            String publicId = identifier.getPublicId();
            String systemId = fResolveDTDURIs ? 
                identifier.getExpandedSystemId() : identifier.getLiteralSystemId();
            fDeclHandler.externalEntityDecl(name, publicId, systemId);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:30,代码来源:AbstractSAXParserMMImpl.java

示例3: unparsedEntityDecl

import org.apache.xerces.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * An unparsed entity declaration.
 *
 * @param name     The name of the entity.
 * @param identifier    An object containing all location information 
 *                      pertinent to this entity.
 * @param notation The name of the notation.
 *
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void unparsedEntityDecl(String name, XMLResourceIdentifier identifier, 
                               String notation,
                               Augmentations augs) throws XNIException {
    try {
        // SAX2 extension
        if (fDTDHandler != null) {
            String publicId = identifier.getPublicId();
            String systemId = fResolveDTDURIs ? 
                identifier.getExpandedSystemId() : identifier.getLiteralSystemId();
            fDTDHandler.unparsedEntityDecl(name, publicId, systemId, notation);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:31,代码来源:AbstractSAXParserMMImpl.java

示例4: notationDecl

import org.apache.xerces.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information 
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl(String name, XMLResourceIdentifier identifier,
                         Augmentations augs) throws XNIException {
    try {
        // SAX1 and SAX2
        if (fDTDHandler != null) {
            String publicId = identifier.getPublicId();
            String systemId = fResolveDTDURIs ? 
                identifier.getExpandedSystemId() : identifier.getLiteralSystemId();
            fDTDHandler.notationDecl(name, publicId, systemId);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:28,代码来源:AbstractSAXParserMMImpl.java

示例5: addUnparsedEntity

import org.apache.xerces.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:AaronZhangL,项目名称:SplitCharater,代码行数:22,代码来源:XIncludeHandler.java

示例6: resolveEntity

import org.apache.xerces.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
@Override
public XMLInputSource resolveEntity( XMLResourceIdentifier resourceIdentifier )
    throws XNIException, IOException
{
    LOG.debug( "Entity resolution blocked (Xerces XNI): resourceIdentifier={}", resourceIdentifier );
    return new XMLInputSource(
        resourceIdentifier.getPublicId(),
        resourceIdentifier.getLiteralSystemId(),
        resourceIdentifier.getBaseSystemId(),
        new ByteArrayInputStream( new byte[ 0 ] ),
        null
    );
}
 
开发者ID:werval,项目名称:werval,代码行数:14,代码来源:EmptyResolver.java

示例7: resolveIdentifier

import org.apache.xerces.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/** 
 * <p>Resolves an identifier using the catalog. This method interprets that 
 * the namespace of the identifier corresponds to uri entries in the catalog.
 * Where both a namespace and an external identifier exist, the namespace
 * takes precedence.</p>
 * 
 * @param resourceIdentifier the identifier to resolve
 * 
 * @throws XNIException thrown on general error
 * @throws IOException thrown if some i/o error occurs
 */
public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier)
    throws IOException, XNIException {
    
    String resolvedId = null;

    // The namespace is useful for resolving namespace aware
    // grammars such as XML schema. Let it take precedence over
    // the external identifier if one exists.
    String namespace = resourceIdentifier.getNamespace();
    if (namespace != null) {
        resolvedId = resolveURI(namespace);
    }
    
    // Resolve against an external identifier if one exists. This
    // is useful for resolving DTD external subsets and other 
    // external entities. For XML schemas if there was no namespace 
    // mapping we might be able to resolve a system identifier 
    // specified as a location hint.
    if (resolvedId == null) {
        String publicId = resourceIdentifier.getPublicId();
        String systemId = getUseLiteralSystemId() 
            ? resourceIdentifier.getLiteralSystemId()
            : resourceIdentifier.getExpandedSystemId();
        if (publicId != null && systemId != null) {
            resolvedId = resolvePublic(publicId, systemId);
        }
        else if (systemId != null) {
            resolvedId = resolveSystem(systemId);
        }
    }
    return resolvedId;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:44,代码来源:XMLCatalogResolver.java

示例8: addNotation

import org.apache.xerces.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:AaronZhangL,项目名称:SplitCharater,代码行数:20,代码来源:XIncludeHandler.java

示例9: notationDecl

import org.apache.xerces.xni.XMLResourceIdentifier; //导入方法依赖的package包/类
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:75,代码来源:AbstractDOMParser.java

示例10: resolveEntity

import org.apache.xerces.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:AaronZhangL,项目名称:SplitCharater,代码行数:56,代码来源:EntityResolver2Wrapper.java

示例11: resolveEntity

import org.apache.xerces.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:AaronZhangL,项目名称:SplitCharater,代码行数:58,代码来源:EntityResolverWrapper.java

示例12: XMLInputSource

import org.apache.xerces.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:AaronZhangL,项目名称:SplitCharater,代码行数:14,代码来源:XMLInputSource.java

示例13: resolveEntity

import org.apache.xerces.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 overridden 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:AaronZhangL,项目名称:SplitCharater,代码行数:24,代码来源:XMLCatalogResolver.java


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