本文整理汇总了Java中org.w3c.dom.Document.hasChildNodes方法的典型用法代码示例。如果您正苦于以下问题:Java Document.hasChildNodes方法的具体用法?Java Document.hasChildNodes怎么用?Java Document.hasChildNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.Document
的用法示例。
在下文中一共展示了Document.hasChildNodes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 "";
}
示例2: 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 "";
}
示例3: 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 "";
}
示例4: 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 "";
}
示例5: 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 "";
}