本文整理了Java中org.jdom.Element.getQualifiedName()
方法的一些代码示例,展示了Element.getQualifiedName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getQualifiedName()
方法的具体详情如下:
包路径:org.jdom.Element
类名称:Element
方法名:getQualifiedName
[英]Returns the full name of the element, in the form [namespacePrefix]:[localName]. If the element does not have a namespace prefix, then the local name is returned.
[中]返回元素的全名,格式为[namespacePrefix]:[localName]。如果元素没有名称空间前缀,则返回本地名称。
代码示例来源:origin: org.freemarker/freemarker
public List operate(Object node) {
if (node instanceof Element)
return Collections.singletonList(((Element) node).getQualifiedName());
else if (node instanceof Attribute)
return Collections.singletonList(((Attribute) node).getQualifiedName());
// 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("_qname can not be applied on " + node.getClass());
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public String getQualifiedName()
{
return element.getQualifiedName();
}
代码示例来源:origin: org.freemarker/freemarker-gae
public List operate(Object node) {
if (node instanceof Element)
return Collections.singletonList(((Element) node).getQualifiedName());
else if (node instanceof Attribute)
return Collections.singletonList(((Attribute) node).getQualifiedName());
// 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("_qname can not be applied on " + node.getClass());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
public List operate(Object node) {
if (node instanceof Element)
return Collections.singletonList(((Element) node).getQualifiedName());
else if (node instanceof Attribute)
return Collections.singletonList(((Attribute) node).getQualifiedName());
// 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("_qname can not be applied on " + node.getClass());
}
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link Element}</code>
* to the <code>{@link Document}</code> is illegal.
*
* @param added <code>Element</code> that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element added, String reason) {
super(new StringBuffer()
.append("The element \"")
.append(added.getQualifiedName())
.append("\" could not be added as the root of the document: ")
.append(reason)
.toString());
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link Element}</code>
* to parent is illegal.
*
* @param base <code>Element</code> that the child
* couldn't be added to
* @param added <code>Element</code> that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element base, Element added, String reason) {
super(new StringBuffer()
.append("The element \"")
.append(added.getQualifiedName())
.append("\" could not be added as a child of \"")
.append(base.getQualifiedName())
.append("\": ")
.append(reason)
.toString());
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link Attribute}</code>
* to the <code>{@link Element}</code> is illegal.
*
* @param base <code>Element</code> that <code>Attribute</code>
* couldn't be added to
* @param added <code>Attribute</code> that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element base, Attribute added, String reason) {
super(new StringBuffer()
.append("The attribute \"")
.append(added.getQualifiedName())
.append("\" could not be added to the element \"")
.append(base.getQualifiedName())
.append("\": ")
.append(reason)
.toString());
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link ProcessingInstruction}</code>
* to the <code>{@link Element}</code> is illegal.
*
* @param base <code>Element</code> that the
* <code>ProcessingInstruction</code> couldn't be added to
* @param added <code>ProcessingInstruction</code> that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element base, ProcessingInstruction added,
String reason) {
super(new StringBuffer()
.append("The PI \"")
.append(added.getTarget())
.append("\" could not be added as content to \"")
.append(base.getQualifiedName())
.append("\": ")
.append(reason)
.toString());
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link CDATA}</code>
*
* @param base <code>Element</code> that the <code>CDATA</code>
* couldn't be added to
* @param added <code>CDATA</code> that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element base, CDATA added, String reason) {
super(new StringBuffer()
.append("The CDATA \"")
.append(added.getText())
.append("\" could not be added as content to \"")
.append(base.getQualifiedName())
.append("\": ")
.append(reason)
.toString());
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link EntityRef}</code>
* to the <code>{@link Element}</code> is illegal.
*
* @param base <code>Element</code> that the <code>EntityRef</code>
* couldn't be added to
* @param added <code>EntityRef</code> reference that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element base, EntityRef added, String reason) {
super(new StringBuffer()
.append("The entity reference\"")
.append(added.getName())
.append("\" could not be added as content to \"")
.append(base.getQualifiedName())
.append("\": ")
.append(reason)
.toString());
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link Comment}</code>
* to the <code>{@link Element}</code> is illegal.
*
* @param base <code>Element</code> that the <code>Comment</code>
* couldn't be added to
* @param added <code>Comment</code> that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element base, Comment added, String reason) {
super(new StringBuffer()
.append("The comment \"")
.append(added.getText())
.append("\" could not be added as content to \"")
.append(base.getQualifiedName())
.append("\": ")
.append(reason)
.toString());
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link Text}</code>
* to the <code>{@link Element}</code> is illegal.
*
* @param base <code>Element</code> that the <code>Comment</code>
* couldn't be added to
* @param added <code>Text</code> that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element base, Text added, String reason) {
super(new StringBuffer()
.append("The Text \"")
.append(added.getText())
.append("\" could not be added as content to \"")
.append(base.getQualifiedName())
.append("\": ")
.append(reason)
.toString());
}
代码示例来源:origin: commons-jxpath/commons-jxpath
/**
* Get relative position of this among like-named siblings.
* @return 1..n
*/
private int getRelativePositionByName() {
if (node instanceof Element) {
Object parent = ((Element) node).getParent();
if (!(parent instanceof Element)) {
return 1;
}
List children = ((Element) parent).getContent();
int count = 0;
String name = ((Element) node).getQualifiedName();
for (int i = 0; i < children.size(); i++) {
Object child = children.get(i);
if ((child instanceof Element)
&& ((Element) child).getQualifiedName().equals(name)) {
count++;
}
if (child == node) {
break;
}
}
return count;
}
return 1;
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* <p>
* This returns a <code>String</code> representation of the
* <code>Element</code>, suitable for debugging. If the XML
* representation of the <code>Element</code> is desired,
* {@link org.jdom.output.XMLOutputter#outputString(Element)}
* should be used.
* </p>
*
* @return <code>String</code> - information about the
* <code>Element</code>
*/
public String toString() {
final StringBuffer stringForm = new StringBuffer(64)
.append("[Element: <")
.append(getQualifiedName());
final String nsuri = getNamespaceURI();
if (!"".equals(nsuri)) {
stringForm
.append(" [Namespace: ")
.append(nsuri)
.append("]");
}
stringForm.append("/>]");
return stringForm.toString();
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* <p>
* This will invoke the <code>endElement</code> callback
* in the <code>ContentHandler</code>.
* </p>
*
* @param element <code>Element</code> used in callbacks.
*/
private void endElement(Element element) throws JDOMException {
String namespaceURI = element.getNamespaceURI();
String localName = element.getName();
String rawName = element.getQualifiedName();
try {
contentHandler.endElement(namespaceURI, localName, rawName);
}
catch (SAXException se) {
throw new JDOMException("Exception in endElement", se);
}
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create an <code>Exception</code> indicating
* that the addition of the <code>{@link Namespace}</code>
* to the <code>{@link Element}</code> is illegal.
*
* @param base <code>Element</code> that the <code>Namespace</code>
* couldn't be added to
* @param added <code>Namespace</code> that could not be added
* @param reason cause of the problem
*/
IllegalAddException(Element base, Namespace added, String reason) {
super(new StringBuffer()
.append("The namespace xmlns")
.append((added.getPrefix() == null ||
added.getPrefix().equals("")) ? "="
: ":" + added.getPrefix() + "=")
.append("\"")
.append(added.getURI())
.append("\" could not be added as a namespace to \"")
.append(base.getQualifiedName())
.append("\": ")
.append(reason)
.toString());
}
代码示例来源:origin: org.freemarker/com.springsource.freemarker
public List operate(Object node)
{
if (node instanceof Element)
return Collections12.singletonList(((Element)node).getQualifiedName());
else if (node instanceof Attribute)
return Collections12.singletonList(((Attribute)node).getQualifiedName());
// 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("_qname can not be applied on " + node.getClass());
}
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-ucfpackage
@Test
public void manifestMimetype() throws Exception {
UCFPackage container = new UCFPackage();
container.setPackageMediaType(UCFPackage.MIME_WORKFLOW_BUNDLE);
container.save(tmpFile);
ZipFile zipFile = new ZipFile(tmpFile);
ZipEntry manifestEntry = zipFile.getEntry("META-INF/manifest.xml");
InputStream manifestStream = zipFile.getInputStream(manifestEntry);
//System.out.println(IOUtils.toString(manifestStream, "UTF-8"));
/*
<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
</manifest:manifest>
*/
Document doc = parseXml(manifestStream);
assertEquals(MANIFEST_NS, doc.getRootElement().getNamespace());
assertEquals("manifest", doc.getRootElement().getNamespacePrefix());
assertEquals("manifest:manifest", doc.getRootElement().getQualifiedName());
assertNull(xpathSelectElement(doc.getRootElement(), "/manifest:manifest/*"));
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-ucfpackage
@Test
public void manifestMimetype() throws Exception {
UCFPackage container = new UCFPackage();
container.setPackageMediaType(UCFPackage.MIME_WORKFLOW_BUNDLE);
container.save(tmpFile);
ZipFile zipFile = new ZipFile(tmpFile);
ZipEntry manifestEntry = zipFile.getEntry("META-INF/manifest.xml");
InputStream manifestStream = zipFile.getInputStream(manifestEntry);
//System.out.println(IOUtils.toString(manifestStream, "UTF-8"));
/*
<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
</manifest:manifest>
*/
Document doc = parseXml(manifestStream);
assertEquals(MANIFEST_NS, doc.getRootElement().getNamespace());
assertEquals("manifest", doc.getRootElement().getNamespacePrefix());
assertEquals("manifest:manifest", doc.getRootElement().getQualifiedName());
assertNull(xpathSelectElement(doc.getRootElement(), "/manifest:manifest/*"));
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-ucfpackage
assertEquals(MANIFEST_NS, doc.getRootElement().getNamespace());
assertEquals("manifest", doc.getRootElement().getNamespacePrefix());
assertEquals("manifest:manifest", doc.getRootElement().getQualifiedName());
assertXpathEquals("application/octet-stream", doc.getRootElement(), "/manifest:manifest/manifest:file-entry/@manifest:media-type");
assertXpathEquals("binary", doc.getRootElement(), "/manifest:manifest/manifest:file-entry/@manifest:full-path");
内容来源于网络,如有侵权,请联系作者删除!