本文整理匯總了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 "";
}