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


Java URI类代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.util.URI的典型用法代码示例。如果您正苦于以下问题:Java URI类的具体用法?Java URI怎么用?Java URI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


URI类属于com.sun.org.apache.xerces.internal.util包,在下文中一共展示了URI类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBaseURI

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
/**
 * Returns the absolute base URI of this node or null if the implementation
 * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a
 * null is returned.
 *
 * @return The absolute base URI of this node or null.
 * @since DOM Level 3
 */
public String getBaseURI() {
    if (needsSyncData()) {
        synchronizeData();
    }
    if (baseURI != null && baseURI.length() != 0 ) {// attribute value is always empty string
        try {
            return new URI(baseURI).toString();
        }
        catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException e){
            // REVISIT: what should happen in this case?
            return null;
        }
    }
    return baseURI;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:NotationImpl.java

示例2: getActualValue

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    // check 3.2.17.c0 must: URI (rfc 2396/2723)
    try {
        if( content.length() != 0 ) {
            // encode special characters using XLink 5.4 algorithm
            final String encoded = encode(content);
            // Support for relative URLs
            // According to Java 1.1: URLs may also be specified with a
            // String and the URL object that it is related to.
            new URI(BASE_URI, encoded );
        }
    } catch (URI.MalformedURIException ex) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "anyURI"});
    }

    // REVISIT: do we need to return the new URI object?
    return content;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:AnyURIDV.java

示例3: getBaseURI

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
/**
 * Returns the absolute base URI of this node or null if the implementation
 * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a
 * null is returned.
 *
 * @return The absolute base URI of this node or null.
 * @since DOM Level 3
 */
public String getBaseURI() {
    if (fDocumentURI != null && fDocumentURI.length() != 0 ) {// attribute value is always empty string
        try {
            return new URI(fDocumentURI).toString();
        }
        catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException e){
            // REVISIT: what should happen in this case?
            return null;
        }
    }
    return fDocumentURI;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:CoreDocumentImpl.java

示例4: getBaseURI

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
/**
 * Returns the absolute base URI of this node or null if the implementation
 * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a
 * null is returned.
 *
 * @return The absolute base URI of this node or null.
 * @since DOM Level 3
 */
public String getBaseURI() {
    if (needsSyncData()) {
        synchronizeData();
    }
    if (baseURI == null) {
        DocumentType doctype;
        NamedNodeMap entities;
        EntityImpl entDef;
        if (null != (doctype = getOwnerDocument().getDoctype()) &&
            null != (entities = doctype.getEntities())) {

            entDef = (EntityImpl)entities.getNamedItem(getNodeName());
            if (entDef !=null) {
                return entDef.getBaseURI();
            }
        }
    } else if (baseURI != null && baseURI.length() != 0 ) {// attribute value is always empty string
        try {
            return new URI(baseURI).toString();
        }
        catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException e){
            // REVISIT: what should happen in this case?
            return null;
        }
    }
    return baseURI;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:EntityReferenceImpl.java

示例5: resolveSystemId

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
/** Resolves a system identifier against a base URI. */
private String resolveSystemId(String systemId, String baseURI) {
    try {
        return XMLEntityManager.expandSystemId(systemId, baseURI, false);
    }
    // In the event that resolution failed against the
    // base URI, just return the system id as is. There's not
    // much else we can do.
    catch (URI.MalformedURIException ex) {
        return systemId;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ValidatorHandlerImpl.java

示例6: openWebpage

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
public static void openWebpage(java.net.URI uri) {
    Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
    if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
        try {
            desktop.browse(uri);
        } catch (Exception e) {
			Logger.getLogger(GendreAPIPreviewCreator.class.getName()).log(
					Level.WARNING,
					"Couldn't open in browser. Please get your API Key at "+NamSorAPI.NAMSOR_CHANNEL_REGISTRATION_URL);		
        }
    }
}
 
开发者ID:namsor,项目名称:rapidminer-onomastics-extension,代码行数:13,代码来源:GendreAPIPreviewCreator.java

示例7: openWebpage

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
public static void openWebpage(java.net.URI uri) {
    Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
    if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
        try {
            desktop.browse(uri);
        } catch (Exception e) {
			Logger.getLogger(OriginAPIPreviewCreator.class.getName()).log(
					Level.WARNING,
					"Couldn't open in browser. Please get your API Key at "+NamSorAPI.NAMSOR_CHANNEL_REGISTRATION_URL);		
        }
    }
}
 
开发者ID:namsor,项目名称:rapidminer-onomastics-extension,代码行数:13,代码来源:OriginAPIPreviewCreator.java

示例8: updateActivemqConfigFile

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
private void updateActivemqConfigFile(File configFile) throws Exception {
	Document doc = openXmlForUpdating("ActiveMQ", configFile, false);
	Element broker = (Element)doc.getDocumentElement().getElementsByTagName("broker").item(0);
	
	Element transportConnectors = (Element)broker.getElementsByTagName("transportConnectors").item(0);		
	Element transportConnector = (Element)transportConnectors.getElementsByTagName("transportConnector").item(0); // edit first in the list (could use attribute name to decide right one..)
	URI uri = new URI(transportConnector.getAttribute("uri"));
	uri.setScheme(configs[BROKER_PROTOCOL_INDEX][VAL_INDEX]);
	uri.setHost(configs[BROKER_PRIVATE_HOST_INDEX][VAL_INDEX]);
	uri.setPort(Integer.parseInt(configs[BROKER_PORT_INDEX][VAL_INDEX]));

	updateElementAttribute(transportConnector, "uri", uri.toString());
	
	writeLater(configFile, doc);
}
 
开发者ID:chipster,项目名称:chipster,代码行数:16,代码来源:ConfigTool.java

示例9: getRelativeBaseURI

import com.sun.org.apache.xerces.internal.util.URI; //导入依赖的package包/类
/**
 * Returns a URI, relative to the include parent's base URI, of the current
 * [base URI].  For instance, if the current [base URI] was "dir1/dir2/file.xml"
 * and the include parent's [base URI] was "dir/", this would return "dir2/file.xml".
 * @return the relative URI
 */
protected String getRelativeBaseURI() throws MalformedURIException {
    int includeParentDepth = getIncludeParentDepth();
    String relativeURI = this.getRelativeURI(includeParentDepth);
    if (isRootDocument()) {
        return relativeURI;
    }
    else {
        if (relativeURI.equals("")) {
            relativeURI = fCurrentBaseURI.getLiteralSystemId();
        }

        if (includeParentDepth == 0) {
            if (fParentRelativeURI == null) {
                fParentRelativeURI =
                    fParentXIncludeHandler.getRelativeBaseURI();
            }
            if (fParentRelativeURI.equals("")) {
                return relativeURI;
            }

            URI base = new URI(fParentRelativeURI, true);
            URI uri = new URI(base, relativeURI);

            /** Check whether the scheme components are equal. */
            final String baseScheme = base.getScheme();
            final String literalScheme = uri.getScheme();
            if (!Objects.equals(baseScheme, literalScheme)) {
                return relativeURI;
            }

            /** Check whether the authority components are equal. */
            final String baseAuthority = base.getAuthority();
            final String literalAuthority = uri.getAuthority();
            if (!Objects.equals(baseAuthority, literalAuthority)) {
                return uri.getSchemeSpecificPart();
            }

            /**
             * The scheme and authority components are equal,
             * return the path and the possible query and/or
             * fragment which follow.
             */
            final String literalPath = uri.getPath();
            final String literalQuery = uri.getQueryString();
            final String literalFragment = uri.getFragment();
            if (literalQuery != null || literalFragment != null) {
                final StringBuilder buffer = new StringBuilder();
                if (literalPath != null) {
                    buffer.append(literalPath);
                }
                if (literalQuery != null) {
                    buffer.append('?');
                    buffer.append(literalQuery);
                }
                if (literalFragment != null) {
                    buffer.append('#');
                    buffer.append(literalFragment);
                }
                return buffer.toString();
            }
            return literalPath;
        }
        else {
            return relativeURI;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:74,代码来源:XIncludeHandler.java


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