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


Java NamespaceSupport.getURI方法代码示例

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


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

示例1: setPrefixes

import org.xml.sax.helpers.NamespaceSupport; //导入方法依赖的package包/类
/**
 * Copy the namespace declarations from the NamespaceSupport object.  
 * Take care to call resolveInheritedNamespaceDecls.
 * after all namespace declarations have been added.
 *
 * @param nsSupport non-null reference to NamespaceSupport from 
 * the ContentHandler.
 * @param excludeXSLDecl true if XSLT namespaces should be ignored.
 *
 * @throws TransformerException
 */
public void setPrefixes(NamespaceSupport nsSupport, boolean excludeXSLDecl)
        throws TransformerException
{

  Enumeration decls = nsSupport.getDeclaredPrefixes();

  while (decls.hasMoreElements())
  {
    String prefix = (String) decls.nextElement();

    if (null == m_declaredPrefixes)
      m_declaredPrefixes = new ArrayList();

    String uri = nsSupport.getURI(prefix);

    if (excludeXSLDecl && uri.equals(Constants.S_XSLNAMESPACEURL))
      continue;

    // System.out.println("setPrefixes - "+prefix+", "+uri);
    XMLNSDecl decl = new XMLNSDecl(prefix, uri, false);

    m_declaredPrefixes.add(decl);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:36,代码来源:ElemTemplateElement.java

示例2: XPointerFilter

import org.xml.sax.helpers.NamespaceSupport; //导入方法依赖的package包/类
public XPointerFilter(
  XMLReader        parent,
  NamespaceSupport namespaces,
  String           xpointer)
{
  super(parent);

  // We support a very rudimentary - but totally sufficient - XPointer syntax,
  // which is just /element/otherelement/otherotherelement/*
  if (!xpointer.startsWith("/") || !xpointer.endsWith("/*"))
    throw new IllegalArgumentException("Unsupported xpointer syntax: " +
                                       xpointer);

  xpointer = xpointer.substring(0, xpointer.length() - 2).substring(1);
  String[] elements = xpointer.split("/");
  int count = elements.length;

  _rootNamespaceURI = new String[count];
  _rootLocalName = new String[count];
  _acceptChildNodes = new boolean[count];

  for (int i = 0; i < count; i++)
  {
    String[] parts = elements[i].split(":");
    String prefix = (parts.length == 1) ? "" : parts[0];
    String namespaceURI = namespaces.getURI(prefix);
    _rootNamespaceURI[i] = (namespaceURI != null) ? namespaceURI : "";
    _rootLocalName[i] = (parts.length == 1) ? parts[0] : parts[1];
    _acceptChildNodes[i] = false;
  }
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:32,代码来源:XPointerFilter.java


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