本文整理了Java中nu.xom.Element.getNamespaceURI()
方法的一些代码示例,展示了Element.getNamespaceURI()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getNamespaceURI()
方法的具体详情如下:
包路径:nu.xom.Element
类名称:Element
方法名:getNamespaceURI
暂无
代码示例来源:origin: jaxen/jaxen
public String getElementNamespaceUri(Object o) {
return (isElement(o) ? ((Element)o).getNamespaceURI() : null);
}
代码示例来源:origin: jaxen/jaxen
public String translateNamespacePrefixToUri(String s, Object o) {
Element element = null;
if (o instanceof Element) {
element = (Element) o;
} else if (o instanceof ParentNode) {
}
else if (o instanceof Node) {
element = (Element)((Node)o).getParent();
}
else if (o instanceof XPathNamespace)
{
element = ((XPathNamespace)o).getElement();
}
if (element != null) {
return element.getNamespaceURI(s);
}
return null;
}
代码示例来源:origin: jaxen/jaxen
public String getNamespaceStringValue(Object o) {
if (isElement(o)) {
return ((Element)o).getNamespaceURI();
} else if (isAttribute(o)) {
return ((Attribute)o).getNamespaceURI();
} else if (o instanceof XPathNamespace) {
return ((XPathNamespace)o).getNamespaceURI();
}
return null;
}
代码示例来源:origin: jaxen/jaxen
public Iterator getNamespaceAxisIterator(Object o)
{
if (! isElement(o)) {
return JaxenConstants.EMPTY_ITERATOR;
}
Map nsMap = new HashMap();
Element elt = (Element)o;
ParentNode parent = elt;
while (parent instanceof Element) {
elt = (Element)parent;
String uri = elt.getNamespaceURI();
String prefix = elt.getNamespacePrefix();
addNamespaceForElement(elt, uri, prefix, nsMap);
int count = elt.getNamespaceDeclarationCount();
for (int i = 0; i < count; i++) {
prefix = elt.getNamespacePrefix(i);
uri = elt.getNamespaceURI(prefix);
addNamespaceForElement(elt, uri, prefix, nsMap);
}
parent = elt.getParent();
}
addNamespaceForElement(elt, "http://www.w3.org/XML/1998/namespace", "xml", nsMap);
return nsMap.values().iterator();
}
}
代码示例来源:origin: se.vgregion.pubsubhubbub/pubsubhubbub-hub-composite-pubsub
private boolean isAtom(Element elm) {
return Namespaces.ATOM.equals(elm.getNamespaceURI());
}
}
代码示例来源:origin: org.teiid/saxon-xom
static boolean isAtomicValue(Node node) {
if (node instanceof Element) {
Element elem = (Element) node;
return elem.getLocalName().equals("atomic-value") &&
elem.getNamespaceURI().equals("http://dsd.lbl.gov/nux");
}
return false;
}
代码示例来源:origin: teiid/teiid
static boolean isAtomicValue(Node node) {
if (node instanceof Element) {
Element elem = (Element) node;
return elem.getLocalName().equals("atomic-value") &&
elem.getNamespaceURI().equals("http://dsd.lbl.gov/nux");
}
return false;
}
代码示例来源:origin: DSpace/DSpace
/**
* Determines if the specified element is an instance of the element name. If
* you are checking the name title in the ATOM namespace, then the local name
* should be 'title' and the namespaceURI is the URI for the ATOM namespace.
*
* @param element The specified element.
* @param localName The local name for the element.
* @param namespaceURI The namespace for the element.
* @return True if the element matches the localname and namespace URI. Otherwise, false.
*/
protected boolean isInstanceOf(Element element, String localName, String namespaceURI) {
return (localName.equals(element.getLocalName()) &&
namespaceURI.equals(element.getNamespaceURI()));
}
代码示例来源:origin: org.xml-cml/cmlxom
/**
* @param node
* @param count
*/
private static List<String> getNamespaceURIList(Element node) {
List<String> namespaceURIList = new ArrayList<String>();
for (int i = 0; i < node.getNamespaceDeclarationCount(); i++) {
String prefix = node.getNamespacePrefix(i);
String refNamespaceURI = node.getNamespaceURI(prefix);
namespaceURIList.add(refNamespaceURI);
}
return namespaceURIList;
}
代码示例来源:origin: DSpace/DSpace
/**
* Checks XML element local name and namespace URI.
*
* @param element XML element to check
* @param xmlName XML element name
* @return True if the element matches the localname and namespace URI. Otherwise, false.
*/
protected boolean isInstanceOf(Element element, XmlName xmlName) {
return (xmlName.getLocalName().equals(element.getLocalName()) &&
xmlName.getNamespace().equals(element.getNamespaceURI()));
}
代码示例来源:origin: DSpace/DSpace
public XmlName(Element element) {
this.prefix = element.getNamespacePrefix();
this.localName = element.getLocalName();
this.namespace = element.getNamespaceURI();
}
代码示例来源:origin: org.dspace/dspace-sword-api
public XmlName(Element element)
{
this.prefix = element.getNamespacePrefix();
this.localName = element.getLocalName();
this.namespace = element.getNamespaceURI();
}
代码示例来源:origin: org.swordapp/sword-common
public XmlName(Element element)
{
this.prefix = element.getNamespacePrefix();
this.localName = element.getLocalName();
this.namespace = element.getNamespaceURI();
}
代码示例来源:origin: org.xml-cml/cmlxom
/**
* get namespaceURI for this attribute;
*
* @return the namespace
*/
public String getNamespaceURIString() {
Element element = this.getElement();
String prefix = this.getPrefix();
String namespaceURI = (prefix == null) ? null : element
.getNamespaceURI(prefix);
return namespaceURI;
}
代码示例来源:origin: org.dspace/dspace-sword-api
/**
*
* @param element
* @param xmlName
* @return
*/
protected boolean isInstanceOf(Element element, XmlName xmlName)
{
return (xmlName.getLocalName().equals(element.getLocalName()) &&
xmlName.getNamespace().equals(element.getNamespaceURI()));
}
代码示例来源:origin: org.swordapp/sword-common
/**
*
* @param element
* @param xmlName
* @return
*/
protected boolean isInstanceOf(Element element, XmlName xmlName)
{
return (xmlName.getLocalName().equals(element.getLocalName()) &&
xmlName.getNamespace().equals(element.getNamespaceURI()));
}
代码示例来源:origin: org.teiid/saxon-xom
final void writeStartTag(Element elem) {
writeIndex(elem.getNamespacePrefix(), elem.getLocalName());
int type = BEGIN_ELEMENT;
if (elem.getNamespaceURI().length() == 0) {
type = Util.noNamespace(type);
} else {
writeIndex(elem.getNamespaceURI());
}
nodeTokens.add((byte)type);
for (int i = 0; i < elem.getAttributeCount(); i++) {
writeAttribute(elem.getAttribute(i));
}
writeNamespaceDeclarations(elem);
}
代码示例来源:origin: validator/htmlparser
@Override
protected void appendCommentToDocument(String comment)
throws SAXException {
try {
Element root = document.getRootElement();
if ("http://www.xom.nu/fakeRoot".equals(root.getNamespaceURI())) {
document.insertChild(nodeFactory.makeComment(comment), document.indexOf(root));
} else {
document.appendChild(nodeFactory.makeComment(comment));
}
} catch (XMLException e) {
fatal(e);
}
}
代码示例来源:origin: nu.validator/htmlparser
@Override
protected void appendCommentToDocument(String comment)
throws SAXException {
try {
Element root = document.getRootElement();
if ("http://www.xom.nu/fakeRoot".equals(root.getNamespaceURI())) {
document.insertChild(nodeFactory.makeComment(comment), document.indexOf(root));
} else {
document.appendChild(nodeFactory.makeComment(comment));
}
} catch (XMLException e) {
fatal(e);
}
}
代码示例来源:origin: se.vgregion.pubsubhubbub/pubsubhubbub-hub-composite-pubsub
public DefaultField(Element elm) {
this.name = elm.getLocalName();
this.namespace = elm.getNamespaceURI();
this.prefix = elm.getNamespacePrefix();
for(int i = 0; i<elm.getAttributeCount(); i++) {
Attribute attribute = elm.getAttribute(i);
fields.add(new DefaultField(attribute.getNamespaceURI(), attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getValue()));
}
this.content = XmlUtil.innerToString(elm);
}
内容来源于网络,如有侵权,请联系作者删除!