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


Java Document.getChildNodes方法代码示例

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


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

示例1: parse

import org.w3c.dom.Document; //导入方法依赖的package包/类
private Document parse(String prefixName, Document xmlDom) throws Exception {
	xsdDom = createDom();
	if (xmlDom != null) {
		//Element root = xmlDom.getDocumentElement();
		NodeList list = xmlDom.getChildNodes();
		for (int i=0; i<list.getLength(); i++) {
			parse(list.item(i));
		}
		
		Enumeration<XSDObject> e = Collections.enumeration(items.values());
		while (e.hasMoreElements()) {
			e.nextElement().toXML(prefixName, null, xsdDom.getDocumentElement());
		}
	}
	return xsdDom;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:17,代码来源:XSDExtractor.java

示例2: serialize

import org.w3c.dom.Document; //导入方法依赖的package包/类
/**
 * Serialize a {@link Document}.
 *
 * @param d the document to serialize.
 */
public final void serialize(Document d) throws IOException {
    reset();
    encodeHeader(false);
    encodeInitialVocabulary();

    final NodeList nl = d.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
        final Node n = nl.item(i);
        switch (n.getNodeType()) {
            case Node.ELEMENT_NODE:
                serializeElement(n);
                break;
            case Node.COMMENT_NODE:
                serializeComment(n);
                break;
            case Node.PROCESSING_INSTRUCTION_NODE:
                serializeProcessingInstruction(n);
                break;
        }
    }
    encodeDocumentTermination();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:DOMDocumentSerializer.java

示例3: parse

import org.w3c.dom.Document; //导入方法依赖的package包/类
public void parse( URL pageURL, String pageText, DocumentAdapter adapter ) throws IOException, SAXException {
    try {
        Document jtidyDocument = getParser( pageURL ).parseDOM( new ByteArrayInputStream( pageText.getBytes( UTF_ENCODING ) ), null );
        HTMLDocument htmlDocument = new HTMLDocumentImpl();
        NodeList nl = jtidyDocument.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++) {
            Node importedNode = nl.item(i);
            if (importedNode.getNodeType() != Node.DOCUMENT_TYPE_NODE) htmlDocument.appendChild( htmlDocument.importNode( importedNode, true ) );
        }
        adapter.setDocument( htmlDocument );
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException( "UTF-8 encoding failed" );
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:JTidyHTMLParser.java

示例4: print

import org.w3c.dom.Document; //导入方法依赖的package包/类
private static void print(Document doc) {
    NodeList nodeList = doc.getChildNodes();
    for(int i=0 ; i<nodeList.getLength() ;i++ ) {
        Node n = nodeList.item(i);
        System.out.println(n.getTextContent());
    }
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:8,代码来源:DocumentBuilderSafeProperty.java

示例5: getExtensionScheme

import org.w3c.dom.Document; //导入方法依赖的package包/类
@SuppressWarnings("unlikely-arg-type")
private String getExtensionScheme(IFile pluginXML) {
	try {
		IPath location = pluginXML.getLocation();
		if (location != null) {
			File file = location.toFile();

			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
			Document doc = dBuilder.parse(file);

			if (doc.hasChildNodes()) {
				NodeList nodeList = doc.getChildNodes();
				for (int count = 0; count < nodeList.getLength(); count++) {
					Node tempNode = nodeList.item(count);
					if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
						if (tempNode.getNodeName().equals("plugin")) {
							for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
								Node tempNode1 = tempNode.getChildNodes().item(count1);
								if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
									if (tempNode1.getNodeName().equals("extension")) {
										//System.out.println(" tempNode1 "+tempNode1.getAttributes().getNamedItem("point"));
										String obj = "org.eclipse.emf.ecore.uri_mapping";
										if (tempNode1.getAttributes().getNamedItem("point").getNodeValue().equals(obj)) {
											for (int count2 = 0; count2 < tempNode1.getChildNodes().getLength(); count2++) {
												Node tempNode2 = tempNode1.getChildNodes().item(count2);
												if (tempNode2.getNodeType() == Node.ELEMENT_NODE) {
													if (tempNode2.getNodeName().equals("mapping")) {
														return tempNode2.getAttributes().getNamedItem("source").getNodeValue().concat("#");
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return "";
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:47,代码来源:RegisterAllOCCIExtensionAction.java

示例6: getExtensionURI

import org.w3c.dom.Document; //导入方法依赖的package包/类
private String getExtensionURI(IFile pluginXML) {
	try {
		IPath location = pluginXML.getLocation();
		if (location != null) {
			File file = location.toFile();

			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
			Document doc = dBuilder.parse(file);

			if (doc.hasChildNodes()) {
				NodeList nodeList = doc.getChildNodes();
				for (int count = 0; count < nodeList.getLength(); count++) {
					Node tempNode = nodeList.item(count);
					if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
						if (tempNode.getNodeName().equals("plugin")) {
							for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
								Node tempNode1 = tempNode.getChildNodes().item(count1);
								if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
									if (tempNode1.getNodeName().equals("extension")) {
										//System.out.println(" tempNode1 "+tempNode1.getAttributes().getNamedItem("point"));
										String obj = "org.eclipse.emf.ecore.uri_mapping";
										if (tempNode1.getAttributes().getNamedItem("point").getNodeValue().equals(obj)) {
											for (int count2 = 0; count2 < tempNode1.getChildNodes().getLength(); count2++) {
												Node tempNode2 = tempNode1.getChildNodes().item(count2);
												if (tempNode2.getNodeType() == Node.ELEMENT_NODE) {
													if (tempNode2.getNodeName().equals("mapping")) {
														return tempNode2.getAttributes().getNamedItem("target").getNodeValue().replaceFirst("platform:/plugin/", "platform:/resource/");
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return "";
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:46,代码来源:RegisterAllOCCIExtensionAction.java

示例7: getExtensionScheme

import org.w3c.dom.Document; //导入方法依赖的package包/类
private String getExtensionScheme(IFile pluginXML) {
	try {
		IPath location = pluginXML.getLocation();
		if (location != null) {
			File file = location.toFile();

			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
			Document doc = dBuilder.parse(file);

			if (doc.hasChildNodes()) {
				NodeList nodeList = doc.getChildNodes();
				for (int count = 0; count < nodeList.getLength(); count++) {
					Node tempNode = nodeList.item(count);
					if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
						if (tempNode.getNodeName().equals("plugin")) {
							for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
								Node tempNode1 = tempNode.getChildNodes().item(count1);
								if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
									if (tempNode1.getNodeName().equals("extension")) {
										for (int count11 = 0; count11 < tempNode1.getChildNodes()
												.getLength(); count11++) {
											Node tempNode11 = tempNode1.getChildNodes().item(count11);
											if (tempNode11.getNodeType() == Node.ELEMENT_NODE) {
												if (tempNode11.getNodeName().equals("factory")) {
													if (tempNode11.hasAttributes()) {
														NamedNodeMap nodeMap = tempNode11.getAttributes();
														for (int i = 0; i < nodeMap.getLength(); i++) {
															Node node = nodeMap.item(i);
															if (node.getNodeName().equals("uri")) {
																return node.getNodeValue()
																		.substring(0,
																				node.getNodeValue().length()
																						- ("/ecore".length()))
																		.concat("#");
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return "";
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:55,代码来源:RegenerateConnectorAction.java

示例8: getExtensionMetamodelURI

import org.w3c.dom.Document; //导入方法依赖的package包/类
private String getExtensionMetamodelURI(IFile pluginXML) {
	try {
		IPath location = pluginXML.getLocation();
		if (location != null) {
			File file = location.toFile();

			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
			Document doc = dBuilder.parse(file);

			if (doc.hasChildNodes()) {
				NodeList nodeList = doc.getChildNodes();
				for (int count = 0; count < nodeList.getLength(); count++) {
					Node tempNode = nodeList.item(count);
					if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
						if (tempNode.getNodeName().equals("plugin")) {
							for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
								Node tempNode1 = tempNode.getChildNodes().item(count1);
								if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
									if (tempNode1.getNodeName().equals("extension")) {
										for (int count11 = 0; count11 < tempNode1.getChildNodes()
												.getLength(); count11++) {
											Node tempNode11 = tempNode1.getChildNodes().item(count11);
											if (tempNode11.getNodeType() == Node.ELEMENT_NODE) {
												if (tempNode11.getNodeName().equals("factory")) {
													if (tempNode11.hasAttributes()) {
														NamedNodeMap nodeMap = tempNode11.getAttributes();
														for (int i = 0; i < nodeMap.getLength(); i++) {
															Node node = nodeMap.item(i);
															if (node.getNodeName().equals("uri")) {
																return node.getNodeValue();
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return "";
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:51,代码来源:RegenerateConnectorAction.java

示例9: getExtensionFactoryClass

import org.w3c.dom.Document; //导入方法依赖的package包/类
private String getExtensionFactoryClass(IFile pluginXML) {
	try {
		IPath location = pluginXML.getLocation();
		if (location != null) {
			File file = location.toFile();

			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
			Document doc = dBuilder.parse(file);

			if (doc.hasChildNodes()) {
				NodeList nodeList = doc.getChildNodes();
				for (int count = 0; count < nodeList.getLength(); count++) {
					Node tempNode = nodeList.item(count);
					if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
						if (tempNode.getNodeName().equals("plugin")) {
							for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
								Node tempNode1 = tempNode.getChildNodes().item(count1);
								if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
									if (tempNode1.getNodeName().equals("extension")) {
										for (int count11 = 0; count11 < tempNode1.getChildNodes()
												.getLength(); count11++) {
											Node tempNode11 = tempNode1.getChildNodes().item(count11);
											if (tempNode11.getNodeType() == Node.ELEMENT_NODE) {
												if (tempNode11.getNodeName().equals("factory")) {
													if (tempNode11.hasAttributes()) {
														NamedNodeMap nodeMap = tempNode11.getAttributes();
														for (int i = 0; i < nodeMap.getLength(); i++) {
															Node node = nodeMap.item(i);
															if (node.getNodeName().equals("class")) {
																String[] args = node.getNodeValue().split("\\.");
																return args[args.length - 1];
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return "";
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:52,代码来源:RegenerateConnectorAction.java


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