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


Java Element.getNodeName方法代码示例

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


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

示例1: createComponent

import org.w3c.dom.Element; //导入方法依赖的package包/类
static TestComponent2 createComponent(TestModel2 model, TestComponent2 parent, Element e)  {
    String namespace = e.getNamespaceURI();
    if (namespace == null && parent != null) {
        namespace = parent.lookupNamespaceURI(e.getPrefix());
    }
    if (e.getLocalName().equals("a") && NS_URI.equals(namespace)) {
        return new TestComponent2.A(model, e);
    } else if (e.getLocalName().equals("a") && NS2_URI.equals(namespace)) {
        return new TestComponent2.Aa(model, e);
    } else if (e.getLocalName().equals("b") && NS_URI.equals(namespace)) {
        return new TestComponent2.B(model, e);
    } else if (e.getLocalName().equals("c") && NS_URI.equals(namespace)) {
        return new TestComponent2.C(model, e);
    } else if (e.getLocalName().equals("d") && NS_URI.equals(namespace)) {
        return new TestComponent2.D(model, e);
    } else if (e.getLocalName().equals("e") && NS_URI.equals(namespace)) {
        return new TestComponent2.E(model, e);
    } else {
        throw new RuntimeException("unsupported element type "+ e.getNodeName());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TestComponent2.java

示例2: parsePackageProcedures

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static void parsePackageProcedures(Element pkgElement, DBPackage pkg) {
	for (Element e : XMLUtil.getChildElements(pkgElement)) {
		String nodeName = e.getNodeName();
		if ("procedure".equals(nodeName)) {
			DBProcedure procedure = new DBProcedure(e.getAttribute("name"), pkg);
			String objectId = e.getAttribute("objectId");
			if (!StringUtil.isEmpty(objectId))
				procedure.setObjectId(objectId);
			String subProgramId = e.getAttribute("subProgramId");
			if (!StringUtil.isEmpty(subProgramId))
				procedure.setSubProgramId(subProgramId);
			String overload = e.getAttribute("overload");
			if (!StringUtil.isEmpty(overload))
				procedure.setOverload(overload);
		} else
			throw new SyntaxError("Illegal child element of <package>", XMLUtil.format(e));
	}
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:19,代码来源:XMLModelImporter.java

示例3: checkForDuplicatedMapIds

import org.w3c.dom.Element; //导入方法依赖的package包/类
private void checkForDuplicatedMapIds() {

        // load all elements for this section
        NodeList childNodes = sectionNode.getChildNodes();
        List<String> childNodeMapIds = new ArrayList<String>();
        for (int i = 0; i < childNodes.getLength(); i++) {
            if (childNodes.item(i) instanceof Element) {
                Element element = ((Element) childNodes.item(i));
                String elementMapId = element.getAttribute(ATT_ELEMENT_MAP_ID);
                if (StringUtils.isNullOrEmpty(elementMapId)) {
                    throw new ElementsMapException("Error reading " + ATT_ELEMENT_MAP_ID + " for element '"
                                                   + sectionNode.getNodeName() + "\\" + element.getNodeName()
                                                   + "'");
                }
                if (childNodeMapIds.contains(elementMapId)) {
                    throw new ElementsMapException("Map section '"
                                                   + ((Element) sectionNode).getAttribute("name")
                                                   + "' already contains element with the same mapId '"
                                                   + elementMapId + "'");
                }
                childNodeMapIds.add(elementMapId);
            }
        }
    }
 
开发者ID:Axway,项目名称:ats-framework,代码行数:25,代码来源:ElementsMap.java

示例4: parse

import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public Metadata parse(final Element element, final ParserContext context) {
    LOG.debug("In parse for {}", element);

    if (nodeNameEquals(element, RpcImplementationBean.RPC_IMPLEMENTATION)) {
        return parseRpcImplementation(element, context);
    } else if (nodeNameEquals(element, RoutedRpcMetadata.ROUTED_RPC_IMPLEMENTATION)) {
        return parseRoutedRpcImplementation(element, context);
    } else if (nodeNameEquals(element, RPC_SERVICE)) {
        return parseRpcService(element, context);
    } else if (nodeNameEquals(element, NotificationListenerBean.NOTIFICATION_LISTENER)) {
        return parseNotificationListener(element, context);
    } else if (nodeNameEquals(element, CLUSTERED_APP_CONFIG)) {
        return parseClusteredAppConfig(element, context);
    } else if (nodeNameEquals(element, SPECIFIC_SERVICE_REF_LIST)) {
        return parseSpecificReferenceList(element, context);
    } else if (nodeNameEquals(element, STATIC_REFERENCE)) {
        return parseStaticReference(element, context);
    } else if (nodeNameEquals(element, ACTION_SERVICE)) {
        return parseActionService(element, context);
    } else if (nodeNameEquals(element, ActionProviderBean.ACTION_PROVIDER)) {
        return parseActionProvider(element, context);
    }

    throw new ComponentDefinitionException("Unsupported standalone element: " + element.getNodeName());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:OpendaylightNamespaceHandler.java

示例5: getChildNodeValue

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static String getChildNodeValue( Element root, String childNodeName, String defaultValue ) throws SAXException {
    NodeList nl = root.getElementsByTagName( childNodeName );
    if (nl.getLength() == 1) {
        return getTextValue( nl.item( 0 ) ).trim();
    } else if (defaultValue == null) {
        throw new SAXException( "Node <" + root.getNodeName() + "> has no child named <" + childNodeName + ">" );
    } else {
        return defaultValue;
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:WebApplication.java

示例6: getPublicPackages

import org.w3c.dom.Element; //导入方法依赖的package包/类
private PublicPackage[] getPublicPackages(Document d) throws BuildException {
    Element cfg = getConfig(d);
    Element pp = findNBMElement(cfg, "public-packages");
    if (pp == null) {
        pp = findNBMElement(cfg, "friend-packages");
    }
    if (pp == null) {
        throw new BuildException("No <public-packages>", getLocation());
    }
    List<PublicPackage> pkgs = new ArrayList<>();
    for (Element p : XMLUtil.findSubElements(pp)) {
        boolean sub = false;
        if ("friend".equals(p.getNodeName())) {
            continue;
        }
        if (!"package".equals (p.getNodeName ())) {
            if (!("subpackages".equals (p.getNodeName ()))) {
                throw new BuildException ("Strange element name, should be package or subpackages: " + p.getNodeName (), getLocation ());
            }
            sub = true;
        }
        
        String t = XMLUtil.findText(p);
        if (t == null) {
            throw new BuildException("No text in <package>", getLocation());
        }
        pkgs.add(new PublicPackage(t, sub));
    }
    return pkgs.toArray(new PublicPackage[pkgs.size()]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:ParseProjectXml.java

示例7: isElementPresent

import org.w3c.dom.Element; //导入方法依赖的package包/类
private void isElementPresent(Element element, String key) {
	try {
		String value = element.getElementsByTagName(key).item(0).getTextContent();
        if (value.isEmpty() || value == null){
        	throw new IllegalArgumentException("Element '" + key + "' is not found in '" + element.getNodeName() +"'");
        }
	} catch (Exception e) {
		throw new IllegalArgumentException("Element '" + key + "' is not found in '" + element.getNodeName() +"'");
	}
}
 
开发者ID:CagataySonmez,项目名称:EdgeCloudSim,代码行数:11,代码来源:SimSettings.java

示例8: parseDatabase

import org.w3c.dom.Element; //导入方法依赖的package包/类
private Database parseDatabase(Element e) {
	String environment = e.getAttribute("environment");
	if (StringUtil.isEmpty(environment))
		environment = e.getAttribute("name");
	if (StringUtil.isEmpty(environment))
		throw new ConfigurationError("No environment defined in cache file");
	Database db = new Database(environment, realImporter, false);
	db.setUser(e.getAttribute("user"));
	db.setTableInclusionPattern(e.getAttribute("tableInclusionPattern"));
	db.setTableExclusionPattern(e.getAttribute("tableExclusionPattern"));
	
	db.setSequencesImported(XMLUtil.getBooleanAttribute(e, "sequencesImported", true));
	db.setTriggersImported(XMLUtil.getBooleanAttribute(e, "triggersImported", true));
	db.setPackagesImported(XMLUtil.getBooleanAttribute(e, "packagesImported", true));
	db.setChecksImported(XMLUtil.getBooleanAttribute(e, "checksImported", true));
	
	// import catalogs
	for (Element child : XMLUtil.getChildElements(e)) {
		String childName = child.getNodeName();
		if ("catalog".equals(childName))
			parseCatalog(child, db);
		else
			throw new UnsupportedOperationException("Not an allowed element within <database>: " + childName);
	}
	scanReferers(db);
	return db;
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:28,代码来源:XMLModelImporter.java

示例9: parseTableStructure

import org.w3c.dom.Element; //导入方法依赖的package包/类
private DBTable parseTableStructure(Element e, DBSchema schema) {
	String name = e.getAttribute("name");
	DBTable table = (DBTable) schema.getTable(name);
	boolean columnsImported = XMLUtil.getBooleanAttributeWithDefault(e, "columnsImported", true);
	table.setColumnsImported(columnsImported);
	boolean pkImported = XMLUtil.getBooleanAttributeWithDefault(e, "pkImported", true);
	table.setPKImported(pkImported);
	boolean fksImported = XMLUtil.getBooleanAttributeWithDefault(e, "fksImported", true);
	table.setFKsImported(fksImported);
	boolean indexesImported = XMLUtil.getBooleanAttributeWithDefault(e, "indexesImported", true);
	table.setIndexesImported(indexesImported);
	boolean checksImported = XMLUtil.getBooleanAttributeWithDefault(e, "checksImported", true);
	table.setChecksImported(checksImported);
	for (Element child : XMLUtil.getChildElements(e)) {
		String childName = child.getNodeName();
		if ("column".equals(childName))
			parseColumn(child, table);
		else if ("pk".equals(childName))
			parsePK(child, table);
		else if ("uk".equals(childName))
			parseUK(child, table);
		else if ("fk".equals(childName))
			parseFK(child, table, schema);
		else if ("check".equals(childName))
			parseCheck(child, table);
		else if ("index".equals(childName))
			parseIndex(child, table);
		else
			throw new SyntaxError("Not an allowed element within <table>", XMLUtil.format(child));
	}
	return table;
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:33,代码来源:XMLModelImporter.java

示例10: handle

import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public void handle(Element node) throws Exception {
    switch (node.getNodeName()) {
        case "spectrum_query": {
            ParseSpectrumNode(node);
            break;
        }
        case "search_summary": {
            ParseSearchSummary(node);
            break;
        }
    }
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:14,代码来源:PepXMLParseHandler.java

示例11: getMandatoryAttribute

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * 
 * @param node the node {@link Element}
 * @param attributeName the attribute name
 * @return the attribute value
 * @throws XMLException if the mandatory attribute is missing or its value is empty
 */
public static String getMandatoryAttribute( Element node,
                                            String attributeName ) throws XMLException {

    String attributeValue = getAttribute(node, attributeName);
    if (StringUtils.isNullOrEmpty(attributeValue)) {
        throw new XMLException(node.getNodeName() + " is missing mandatory attribute '"
                               + attributeName + "'");
    }

    return attributeValue;
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:19,代码来源:XmlUtils.java

示例12: getSpecificAnnotationKindConverter

import org.w3c.dom.Element; //导入方法依赖的package包/类
private ConvertSpecificAnnotationKind getSpecificAnnotationKindConverter(Element elt) throws ConverterException {
	String name = elt.getNodeName();
	if (name.equals("text"))
		return new ConvertTextAnnotationDefinition();
	if (name.equals("group"))
		return new ConvertGroupAnnotationDefinition();
	if (name.equals("relation"))
		return new ConvertRelationAnnotationDefinition();
	cannotConvertXML(elt, "unknown annotation kind " + name);
	return null;
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:12,代码来源:AnnotationSetParamConverter.java

示例13: buildElementMapXPath

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Build element map for elements matching <code>xPath</code> relative to <code>parent</code> into
 * <code>elementMap</code> .
 * 
 * @param elementMap to add elements to
 * @param schema {@link Document} for schema.
 * @param parent {@link Element} to query XPath.
 * @param rank current rank of elements.
 * @param xPath XPath to query for elements.
 * @param xPathContext XPath context for queries.
 * @return final rank of elements.
 * @throws XPathExpressionException
 * @since GemFire 8.1
 */
private static int buildElementMapXPath(final LinkedHashMap<String, CacheElement> elementMap,
    final Document schema, final Node parent, int rank, final String xPath,
    final XPathContext xPathContext) throws XPathExpressionException {
  final NodeList children = XmlUtils.query(parent, xPath, xPathContext);
  for (int i = 0; i < children.getLength(); i++) {
    final Element child = (Element) children.item(i);
    switch (child.getNodeName()) {
      case XSD_ALL_CHILDREN:
        final String name = getAttribute(child, "name");
        elementMap.put(name, new CacheElement(name, rank++, isMultiple(child)));
        break;
      // TODO group support as XSD matures
      // case "xsd:group":
      // buildElementMapGroup(elementMap, doc, child, rank, xPathContext);
      // break;
      case "xsd:choice":
      case "xsd:sequence":
        rank = buildElementMapXPath(elementMap, schema, child, rank,
            XSD_CHOICE_OR_SEQUENCE_CHILDREN, xPathContext);
        break;
      case "xsd:any":
        // ignore extensions
        break;
      default:
        // TODO jbarrett - localize
        throw new UnsupportedOperationException(
            "Unsupported child type '" + child.getNodeName() + "'");
    }
  }

  return rank;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:47,代码来源:CacheElement.java

示例14: parseNestedCustomElement

import org.w3c.dom.Element; //导入方法依赖的package包/类
private BeanDefinitionHolder parseNestedCustomElement(Element ele, BeanDefinition containingBd) {
	BeanDefinition innerDefinition = parseCustomElement(ele, containingBd);
	if (innerDefinition == null) {
		error("Incorrect usage of element '" + ele.getNodeName() + "' in a nested manner. " +
				"This tag cannot be used nested inside <property>.", ele);
		return null;
	}
	String id = ele.getNodeName() + BeanDefinitionReaderUtils.GENERATED_BEAN_NAME_SEPARATOR +
			ObjectUtils.getIdentityHexString(innerDefinition);
	if (logger.isDebugEnabled()) {
		logger.debug("Using generated bean name [" + id +
				"] for nested custom element '" + ele.getNodeName() + "'");
	}
	return new BeanDefinitionHolder(innerDefinition, id);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:BeanDefinitionParserDelegate.java

示例15: getQuery

import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public Query getQuery(Element n) throws ParserException {
  QueryBuilder builder = builders.get(n.getNodeName());
  if (builder == null) {
    throw new ParserException("No QueryObjectBuilder defined for node " + n.getNodeName());
  }
  return builder.getQuery(n);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:QueryBuilderFactory.java


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