org.jdom.Namespace.getURI()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(76)

本文整理了Java中org.jdom.Namespace.getURI()方法的一些代码示例,展示了Namespace.getURI()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.getURI()方法的具体详情如下:
包路径:org.jdom.Namespace
类名称:Namespace
方法名:getURI

Namespace.getURI介绍

[英]This returns the namespace URI for this Namespace.
[中]这将返回此Namespace的命名空间URI。

代码示例

代码示例来源:origin: org.freemarker/freemarker

public String translateNamespacePrefixToUri(String prefix) {
    // Empty prefix always maps to empty URL in XPath
    if (prefix.length() == 0) {
      return prefix;
    }
    synchronized (namespaces) {
      Namespace ns = (Namespace) namespaces.get(prefix);
      return ns == null ? null : ns.getURI();
    }   
  }
}

代码示例来源:origin: jaxen/jaxen

public String getNamespaceStringValue(Object obj)
{
  if (obj instanceof Namespace) {
    Namespace ns = (Namespace) obj;
    return ns.getURI();
  } else {
    XPathNamespace ns = (XPathNamespace) obj;
    return ns.getJDOMNamespace().getURI();
  }
  
}

代码示例来源:origin: org.freemarker/freemarker

public List operate(Object node) {
      if (node instanceof Element)
        return Collections.singletonList(((Element) node).getNamespace().getURI());
      else if (node instanceof Attribute)
        return Collections.singletonList(((Attribute) node).getNamespace().getURI());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsuri can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: jaxen/jaxen

public String toString()
  {
    return ( "[xmlns:" + jdomNamespace.getPrefix() + "=\"" +
         jdomNamespace.getURI() + "\", element=" +
         jdomElement.getName() + "]" );
  }
}

代码示例来源:origin: org.freemarker/freemarker

public List operate(Object node) {
      if (node instanceof Element) {
        Element element = (Element) node;
        return Collections.singletonList(element.getNamespace().getURI() + element.getName());
      } else if (node instanceof Attribute) {
        Attribute attribute = (Attribute) node;
        return Collections.singletonList(attribute.getNamespace().getURI() + attribute.getName());
      }
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_cname can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.freemarker/freemarker

public List operate(Object node, String localName, Namespace namespace) {
      if (node instanceof Element) {
        return((Element) node).getChildren(localName, namespace);
      } else if (node instanceof Document) {
        Element root = ((Document) node).getRootElement();
        if (root != null &&
          root.getName().equals(localName) &&
          root.getNamespaceURI().equals(namespace.getURI())) {
          return Collections.singletonList(root);
        } else
          return Collections.EMPTY_LIST;
      } 
 // With 2.1 semantics it  makes more sense to just return a null and let the core 
 // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
 /*           
      else
        throw new TemplateModelException("_namedChildren can not be applied on " + node.getClass());
*/                
    }
  }

代码示例来源:origin: jaxen/jaxen

return namespace.getURI();

代码示例来源:origin: rome/modules

/**
 * Returns the namespace URI this parser handles.
 * <p>
 *
 * @return the namespace URI.
 */
public String getNamespaceUri() {
  return ModuleParser.TEMP.getURI();
}

代码示例来源:origin: rome/modules

/**
 * Returns the URI of the module.
 * <p>
 *
 * @return URI of the module.
 */
public String getUri() {
  return ModuleParser.TEMP.getURI();
}

代码示例来源:origin: org.jdom/jdom-legacy

/**
 * Returns the namespace URI mapped to this element's prefix (or the
 * in-scope default namespace URI if no prefix). If no mapping is found, an
 * empty string is returned.
 *
 * @return                     the namespace URI for this element
 */
public String getNamespaceURI() {
  return namespace.getURI();
}

代码示例来源:origin: apache/cxf

public String getNamespaceURI(String prefix) {
  Namespace namespace = element.getNamespace(prefix);
  if (namespace == null) {
    return null;
  }
  return namespace.getURI();
}

代码示例来源:origin: org.jdom/jdom-legacy

/**
 * This will add a new <code>{@link Namespace}</code>
 * to those currently available.
 * 
 * @param ns <code>Namespace</code> to add.
 */
public void push(Namespace ns) {
  prefixes.push(ns.getPrefix());
  uris.push(ns.getURI());
}

代码示例来源:origin: org.jdom/jdom-legacy

private void writeObject(final ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  // We use writeObject() and not writeUTF() to minimize space
  // This allows for writing pointers to already written strings
  out.writeObject(namespace.getPrefix());
  out.writeObject(namespace.getURI());
}

代码示例来源:origin: apache/cxf

private String getDeclaredURI(String string) {
  for (int i = namespaceStack.size() - 1; i == 0; i--) {
    Map<String, Namespace> nmspaces = namespaceStack.get(i);
    Namespace dec = nmspaces.get(string);
    if (dec != null) {
      return dec.getURI();
    }
  }
  return null;
}

代码示例来源:origin: net.bpelunit/framework

private String getPrefixValue(String prefix, Element service) {
  if (service != null && service.getNamespace(prefix) != null) {
    return service.getNamespace(prefix).getURI();
  }
  return null;
}

代码示例来源:origin: org.freemarker/com.springsource.freemarker

public List operate(Object node)
    {
      if (node instanceof Element)
        return Collections12.singletonList(((Element)node).getNamespace().getURI());
      else if (node instanceof Attribute)
        return Collections12.singletonList(((Attribute)node).getNamespace().getURI());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_nsuri can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.biomoby/taverna-biomoby

/**
 * 
 * @return
 * @throws MobyException
 */
public static Document createDomDocument() throws MobyException {
  Document d = new Document();
  d.setBaseURI(MOBY_NS.getURI());
  return d;
}

代码示例来源:origin: apache/cxf

public void writeNamespace(String prefix, String namespace) throws XMLStreamException {
  Namespace decNS = currentNode.getNamespace(prefix);
  if (decNS == null || !decNS.getURI().equals(namespace)) {
    currentNode.addNamespaceDeclaration(Namespace.getNamespace(prefix, namespace));
  }
}

代码示例来源:origin: apache/cxf

private boolean shouldDeclare(Namespace ns) {
  if (ns == Namespace.XML_NAMESPACE) {
    return false;
  }
  if (ns == Namespace.NO_NAMESPACE && getDeclaredURI("") == null) {
    return false;
  }
  String decUri = getDeclaredURI(ns.getPrefix());
  return !(decUri != null && decUri.equals(ns.getURI()));
}

代码示例来源:origin: rome/rome

protected void populateItem(Item item, Element eItem, int index) {
  super.populateItem(item,eItem, index);
  Description description = item.getDescription();
  if (description!=null) {
    eItem.addContent(generateSimpleElement("description",description.getValue()));
  }
  if (item.getModule(getContentNamespace().getURI()) == null && item.getContent() != null) {
    Element elem = new Element("encoded", getContentNamespace());
    elem.addContent(item.getContent().getValue());
    eItem.addContent(elem);
  }
}

相关文章