本文整理了Java中org.jdom.Element.getNamespace()
方法的一些代码示例,展示了Element.getNamespace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getNamespace()
方法的具体详情如下:
包路径:org.jdom.Element
类名称:Element
方法名:getNamespace
[英]Returns the element's Namespace.
[中]返回元素的命名空间。
代码示例来源:origin: jaxen/jaxen
Element node = (Element) contextNode;
if (namespaceURI == null) {
return node.getChildren(localName).iterator();
return node.getChildren(localName, Namespace.getNamespace(namespacePrefix, namespaceURI)).iterator();
if (!Namespace.getNamespace(namespacePrefix, namespaceURI).equals(el.getNamespace())) {
return JaxenConstants.EMPTY_ITERATOR;
else if(el.getNamespace() != Namespace.NO_NAMESPACE) {
return JaxenConstants.EMPTY_ITERATOR;
代码示例来源:origin: jaxen/jaxen
Namespace ns = current.getNamespace();
Iterator additional = current.getAdditionalNamespaces().iterator();
while ( additional.hasNext() ) {
ns = (Namespace)additional.next();
if ( !nsMap.containsKey(ns.getPrefix()) )
nsMap.put( ns.getPrefix(), new XPathNamespace(elem, ns) );
Iterator attributes = current.getAttributes().iterator();
while ( attributes.hasNext() ) {
Attribute attribute = (Attribute)attributes.next();
代码示例来源:origin: apache/oozie
/**
* Return the sharelib name for the action.
*
* @return returns <code>streaming</code> if mapreduce-streaming action, <code>NULL</code> otherwise.
* @param actionXml
*/
@Override
protected String getDefaultShareLibName(Element actionXml) {
Namespace ns = actionXml.getNamespace();
return (actionXml.getChild("streaming", ns) != null) ? "mapreduce-streaming" : null;
}
代码示例来源:origin: net.bpelunit/framework
/**
* Erhält die noch nicht modifizierte Beschreibung des BPELProzesses als
* XML-Element. Alle für die Instrumentierung benötigten Elemente der
* Prozessbeschreibung werden gespeichert
*
* @param process
* noch nicht modifiziertes BPEL-Prozess
*/
public void setOriginalBPELProcess(Element process) {
elementsOfBPEL = new ArrayList<Element>();
Iterator<Element> iter = process
.getDescendants(new ElementFilter(LinkMetricHandler.LINK_TAG,
process.getNamespace()));
while (iter.hasNext()) {
elementsOfBPEL.add(iter.next());
}
}
代码示例来源:origin: apache/oozie
/**
* Materialize data properties defined in <action> tag. it includes dataIn(<DS>) and dataOut(<DS>) it creates a list
* of files that will be needed.
*
* @param eAction action element
* @param conf action configuration
* @throws Exception thrown if failed to resolve data properties
* @update modify 'Action' element with appropriate list of files.
*/
@SuppressWarnings("unchecked")
static void materializeDataProperties(Element eAction, Configuration conf, ELEvaluator eval) throws Exception {
Element configElem = eAction.getChild("action", eAction.getNamespace()).getChild("workflow",
eAction.getNamespace()).getChild("configuration", eAction.getNamespace());
if (configElem != null) {
for (Element propElem : (List<Element>) configElem.getChildren("property", configElem.getNamespace())) {
resolveTagContents("value", propElem, eval);
}
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
@SuppressWarnings("unchecked")
static List<org.jdom.Element> getChildren(org.jdom.Element e, String name) {
if (e == null) {
return null;
}
Namespace ns = e.getNamespace();
return e.getChildren(name, ns);
}
代码示例来源:origin: apache/oozie
private ActionDependency getUnResolvedDependency(CoordinatorActionBean coordAction, Element event)
throws JDOMException, URIHandlerException {
String tmpUnresolved = event.getChildTextTrim(CoordCommandUtils.UNRESOLVED_INSTANCES_TAG, event.getNamespace());
StringBuilder nonResolvedList = new StringBuilder();
CoordCommandUtils.getResolvedList(getMissingDependencies(), new StringBuilder(), nonResolvedList);
ActionDependency dependency = new ActionDependency();
if (nonResolvedList.length() > 0) {
Element eDataset = event.getChild("dataset", event.getNamespace());
dependency.setUriTemplate(eDataset.getChild("uri-template", eDataset.getNamespace()).getTextTrim());
dependency.getMissingDependencies().add(tmpUnresolved);
}
return dependency;
}
代码示例来源:origin: org.openwfe/openwfe-engine
protected java.util.List decodeHistory (final org.jdom.Element elt)
{
java.util.List history = new java.util.ArrayList(7);
org.jdom.Element hElt = elt.getChild(HISTORY, elt.getNamespace());
if (hElt == null) return history;
java.util.Iterator it = hElt
.getChildren(HISTORY_ITEM, elt.getNamespace())
.iterator();
while (it.hasNext())
history.add(decodeHistoryItem((org.jdom.Element)it.next()));
return history;
}
代码示例来源:origin: net.bpelunit/framework
/**
* Gets the unmodified bpel process as xml element.
*
* <br />All elements needed for instrumentating will be saved
*
* @param unmodified bpel process
*/
public void setOriginalBPELProcess(Element process) {
ElementFilter filter = new ElementFilter(process.getNamespace());
elementsOfBPEL = new ArrayList<Element>();
for (@SuppressWarnings("unchecked")
Iterator<Element> iter = process.getDescendants(filter); iter
.hasNext();) {
Element basicActivity = iter.next();
if (activitiesToRespect.contains(basicActivity.getName())) {
elementsOfBPEL.add(basicActivity);
}
}
}
代码示例来源:origin: apache/oozie
/**
* Resolve datasets using job configuration.
*
* @param eAppXml : Job Element XML
* @throws Exception thrown if failed to resolve datasets
*/
@SuppressWarnings("unchecked")
private void resolveDataSets(Element eAppXml) throws Exception {
Element datasetList = eAppXml.getChild("datasets", eAppXml.getNamespace());
if (datasetList != null) {
List<Element> dsElems = datasetList.getChildren("dataset", eAppXml.getNamespace());
resolveDataSets(dsElems);
resolveTagContents("app-path", eAppXml.getChild("action", eAppXml.getNamespace()).getChild("workflow",
eAppXml.getNamespace()), evalNofuncs);
}
}
代码示例来源:origin: org.codehaus.mevenide/grammar
protected final org.jdom.Element findElement(org.jdom.Element parent, String name) {
List<org.jdom.Element> childs = parent.getChildren("element", parent.getNamespace()); //NOI18N
for (org.jdom.Element el : childs) {
if (name.equals(el.getAttributeValue("name"))) { //NOI18N
return el;
}
}
return null;
}
代码示例来源:origin: org.codehaus.mevenide/grammar
protected final org.jdom.Element findNonTypedContent(org.jdom.Element root) {
org.jdom.Element complex = root.getChild("complexType", root.getNamespace()); //NOI18N
if (complex != null) {
complex = complex.getChild("sequence", root.getNamespace()); //NOI18N
}
return complex;
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public List getAny()
{
List any = new ArrayList();
for (Iterator iter = element.getChildren().iterator(); iter.hasNext();)
{
Element elem = (Element) iter.next();
if (!element.getNamespace().equals(elem.getNamespace()))
{
any.add(elem);
}
}
return any;
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-impl
protected Content i18nFilterAnnotations(Element content) throws JDOMException {
Locale locale = rl.getLocale();
Map<String, Element> documentElements = new Hashtable<String, Element>();
filterElements(documentElements, content, null);
filterElements(documentElements, content, locale.getLanguage());
filterElements(documentElements, content, locale.getLanguage()
+ "_" + locale.getCountry());
filterElements(documentElements, content, locale.getLanguage()
+ "_" + locale.getCountry() + "_" + locale.getVariant());
Element returned = (Element) content.clone();
returned.removeChildren("documentation", content.getNamespace());
for (Iterator<Element> i=documentElements.values().iterator();i.hasNext();) {
returned.addContent((Content) i.next().clone());
}
return returned;
}
代码示例来源:origin: org.apache.oozie/oozie-core
/**
* Resolve datasets using job configuration.
*
* @param eAppXml : Job Element XML
* @throws Exception thrown if failed to resolve datasets
*/
@SuppressWarnings("unchecked")
private void resolveDataSets(Element eAppXml) throws Exception {
Element datasetList = eAppXml.getChild("datasets", eAppXml.getNamespace());
if (datasetList != null) {
List<Element> dsElems = datasetList.getChildren("dataset", eAppXml.getNamespace());
resolveDataSets(dsElems);
resolveTagContents("app-path", eAppXml.getChild("action", eAppXml.getNamespace()).getChild("workflow",
eAppXml.getNamespace()), evalNofuncs);
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
@SuppressWarnings("unchecked")
static org.jdom.Element getChildWithGivenAttributeValue(org.jdom.Element e, String childName, String attributeName, String attributeValue) {
// for instance e="mbook-meta" could be null
if (e == null) {
return null;
}
Namespace ns = e.getNamespace();
List<org.jdom.Element> children = e.getChildren(childName, ns);
org.jdom.Element found = null;
for (org.jdom.Element el : children) {
String attr = el.getAttributeValue(attributeName);
if (attr != null && attr.equals(attributeValue)) {
found = el;
}
}
return found;
}
代码示例来源:origin: org.apache.oozie/oozie-core
/**
* Return the sharelib name for the action.
*
* @return returns <code>streaming</code> if mapreduce-streaming action, <code>NULL</code> otherwise.
* @param actionXml
*/
@Override
protected String getDefaultShareLibName(Element actionXml) {
Namespace ns = actionXml.getNamespace();
return (actionXml.getChild("streaming", ns) != null) ? "mapreduce-streaming" : null;
}
代码示例来源:origin: org.openwfe/openwfe-engine
protected java.util.List decodeEntryList (org.jdom.Element filterElt)
{
java.util.List result = new java.util.ArrayList();
java.util.Iterator it = filterElt
.getChildren(FIELD, filterElt.getNamespace())
.iterator();
while (it.hasNext())
{
org.jdom.Element elt = (org.jdom.Element)it.next();
String fieldRegex = elt.getAttributeValue(REGEX).trim();
String permissions = elt.getAttributeValue(PERMISSIONS).trim();
//String type = elt.getAttributeValue(TYPE);
FilterEntry entry =
new FilterEntry(fieldRegex, permissions/*, type*/);
result.add(entry);
}
return result;
}
代码示例来源:origin: net.bpelunit/framework
/**
* Erhält die noch nicht modifizierte Beschreibung des BPELProzesses als
* XML-Element. Alle für die Instrumentierung benötigten Elemente der
* Prozessbeschreibung werden gespeichert
*
* @param process
* noch nicht modifiziertes BPEL-Prozess
* @see net.bpelunit.framework.coverage.annotation.metrics.IMetric#setOriginalBPELProcess(org.jdom.Element)
*/
public void setOriginalBPELProcess(Element process) {
Element nextElement;
Iterator<Element> iter = process
.getDescendants(new ElementFilter(process
.getNamespace()));
elementsOfBPEL = new ArrayList<Element>();
while (iter.hasNext()) {
nextElement = iter.next();
if (isStructuredActivity(nextElement)) {
elementsOfBPEL.add(nextElement);
}
}
}
代码示例来源:origin: kaazing/gateway
private void checkForNoLongerSupported(Element root) throws Exception {
Namespace namespace = root.getNamespace();
List<Element> children = root.getChildren("service", namespace);
for (Element child : children) {
Element typeChild = child.getChild("type", namespace);
String type = typeChild.getText();
if (type.equals("management.snmp")) {
throw new Exception("snmp management type is no longer supported.");
} else if (type.equals("session")) {
throw new Exception("session service type is no longer supported.");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!