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


Java PublicId类代码示例

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


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

示例1: resolveSystem

import com.sun.org.apache.xml.internal.resolver.helpers.PublicId; //导入依赖的package包/类
/**
 * Return the applicable SYSTEM system identifier.
 *
 * <p>If a SYSTEM entry exists in the Catalog
 * for the system ID specified, return the mapped value.</p>
 *
 * <p>On Windows-based operating systems, the comparison between
 * the system identifier provided and the SYSTEM entries in the
 * Catalog is case-insensitive.</p>
 *
 * @param systemId The system ID to locate in the catalog.
 *
 * @return The resolved system identifier.
 *
 * @throws MalformedURLException The formal system identifier of a
 * subordinate catalog cannot be turned into a valid URL.
 * @throws IOException Error reading subordinate catalog file.
 */
public String resolveSystem(String systemId)
  throws MalformedURLException, IOException {

  catalogManager.debug.message(3, "resolveSystem("+systemId+")");

  systemId = normalizeURI(systemId);

  if (systemId != null && systemId.startsWith("urn:publicid:")) {
    systemId = PublicId.decodeURN(systemId);
    return resolvePublic(systemId, null);
  }

  // If there's a SYSTEM entry in this catalog, use it
  if (systemId != null) {
    String resolved = resolveLocalSystem(systemId);
    if (resolved != null) {
      return resolved;
    }
  }

  // Otherwise, look in the subordinate catalogs
  return resolveSubordinateCatalogs(SYSTEM,
                                    null,
                                    null,
                                    systemId);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:Catalog.java

示例2: resolveURI

import com.sun.org.apache.xml.internal.resolver.helpers.PublicId; //导入依赖的package包/类
/**
 * Return the applicable URI.
 *
 * <p>If a URI entry exists in the Catalog
 * for the URI specified, return the mapped value.</p>
 *
 * <p>URI comparison is case sensitive.</p>
 *
 * @param uri The URI to locate in the catalog.
 *
 * @return The resolved URI.
 *
 * @throws MalformedURLException The system identifier of a
 * subordinate catalog cannot be turned into a valid URL.
 * @throws IOException Error reading subordinate catalog file.
 */
public String resolveURI(String uri)
  throws MalformedURLException, IOException {

  catalogManager.debug.message(3, "resolveURI("+uri+")");

  uri = normalizeURI(uri);

  if (uri != null && uri.startsWith("urn:publicid:")) {
    uri = PublicId.decodeURN(uri);
    return resolvePublic(uri, null);
  }

  // If there's a URI entry in this catalog, use it
  if (uri != null) {
    String resolved = resolveLocalURI(uri);
    if (resolved != null) {
      return resolved;
    }
  }

  // Otherwise, look in the subordinate catalogs
  return resolveSubordinateCatalogs(URI,
                                    null,
                                    null,
                                    uri);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:Catalog.java

示例3: startElement

import com.sun.org.apache.xml.internal.resolver.helpers.PublicId; //导入依赖的package包/类
/**
 * The SAX <code>startElement</code> method recognizes elements
 * from the plain catalog format and instantiates CatalogEntry
 * objects for them.
 *
 * @param namespaceURI The namespace name of the element.
 * @param localName The local name of the element.
 * @param qName The QName of the element.
 * @param atts The list of attributes on the element.
 *
 * @see CatalogEntry
 */
public void startElement (String namespaceURI,
                          String localName,
                          String qName,
                          Attributes atts)
  throws SAXException {

  int entryType = -1;
  Vector entryArgs = new Vector();

  if (localName.equals("Base")) {
    entryType = catalog.BASE;
    entryArgs.add(atts.getValue("HRef"));

    catalog.getCatalogManager().debug.message(4, "Base", atts.getValue("HRef"));
  } else if (localName.equals("Delegate")) {
    entryType = catalog.DELEGATE_PUBLIC;
    entryArgs.add(atts.getValue("PublicId"));
    entryArgs.add(atts.getValue("HRef"));

    catalog.getCatalogManager().debug.message(4, "Delegate",
                  PublicId.normalize(atts.getValue("PublicId")),
                  atts.getValue("HRef"));
  } else if (localName.equals("Extend")) {
    entryType = catalog.CATALOG;
    entryArgs.add(atts.getValue("HRef"));

    catalog.getCatalogManager().debug.message(4, "Extend", atts.getValue("HRef"));
  } else if (localName.equals("Map")) {
    entryType = catalog.PUBLIC;
    entryArgs.add(atts.getValue("PublicId"));
    entryArgs.add(atts.getValue("HRef"));

    catalog.getCatalogManager().debug.message(4, "Map",
                  PublicId.normalize(atts.getValue("PublicId")),
                  atts.getValue("HRef"));
  } else if (localName.equals("Remap")) {
    entryType = catalog.SYSTEM;
    entryArgs.add(atts.getValue("SystemId"));
    entryArgs.add(atts.getValue("HRef"));

    catalog.getCatalogManager().debug.message(4, "Remap",
                  atts.getValue("SystemId"),
                  atts.getValue("HRef"));
  } else if (localName.equals("XMLCatalog")) {
    // nop, start of catalog
  } else {
    // This is equivalent to an invalid catalog entry type
    catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
  }

  if (entryType >= 0) {
    try {
      CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
      catalog.addEntry(ce);
    } catch (CatalogException cex) {
      if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
        catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
      } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
        catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", localName);
      }
    }
  }
  }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:76,代码来源:XCatalogReader.java

示例4: startElement

import com.sun.org.apache.xml.internal.resolver.helpers.PublicId; //导入依赖的package包/类
/**
 * The SAX <code>startElement</code> method recognizes elements
 * from the plain catalog format and instantiates CatalogEntry
 * objects for them.
 *
 * @param namespaceURI The namespace name of the element.
 * @param localName The local name of the element.
 * @param qName The QName of the element.
 * @param atts The list of attributes on the element.
 *
 * @see CatalogEntry
 */
public void startElement (String namespaceURI,
                          String localName,
                          String qName,
                          Attributes atts)
  throws SAXException {

  int entryType = -1;
  Vector entryArgs = new Vector();

  if (localName.equals("Base")) {
    entryType = Catalog.BASE;
    entryArgs.add(atts.getValue("HRef"));

    debug.message(4, "Base", atts.getValue("HRef"));
  } else if (localName.equals("Delegate")) {
    entryType = Catalog.DELEGATE_PUBLIC;
    entryArgs.add(atts.getValue("PublicID"));
    entryArgs.add(atts.getValue("HRef"));

    debug.message(4, "Delegate",
                  PublicId.normalize(atts.getValue("PublicID")),
                  atts.getValue("HRef"));
  } else if (localName.equals("Extend")) {
    entryType = Catalog.CATALOG;
    entryArgs.add(atts.getValue("HRef"));

    debug.message(4, "Extend", atts.getValue("HRef"));
  } else if (localName.equals("Map")) {
    entryType = Catalog.PUBLIC;
    entryArgs.add(atts.getValue("PublicID"));
    entryArgs.add(atts.getValue("HRef"));

    debug.message(4, "Map",
                  PublicId.normalize(atts.getValue("PublicID")),
                  atts.getValue("HRef"));
  } else if (localName.equals("Remap")) {
    entryType = Catalog.SYSTEM;
    entryArgs.add(atts.getValue("SystemID"));
    entryArgs.add(atts.getValue("HRef"));

    debug.message(4, "Remap",
                  atts.getValue("SystemID"),
                  atts.getValue("HRef"));
  } else if (localName.equals("XCatalog")) {
    // nop, start of catalog
  } else {
    // This is equivalent to an invalid catalog entry type
    debug.message(1, "Invalid catalog entry type", localName);
  }

  if (entryType >= 0) {
    try {
      CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
      catalog.addEntry(ce);
    } catch (CatalogException cex) {
      if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
        debug.message(1, "Invalid catalog entry type", localName);
      } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
        debug.message(1, "Invalid catalog entry", localName);
      }
    }
  }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:76,代码来源:XCatalogReader.java


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