fixed bug in parsing method
This commit is contained in:
parent
50168d5d4e
commit
ee057642df
|
@ -3,12 +3,12 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!-- <parent>
|
||||
<parent>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
-->
|
||||
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>vre-removed-publisher</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -49,7 +49,7 @@ public class App {
|
|||
//xmlManager.getGatewaysInfo();
|
||||
xmlManager.getVosInfo("D4Science.org Detached Gateway");
|
||||
//xmlManager.findVo("D4Science.org Detached Gateway", "gCubeApps");
|
||||
//xmlManager.findVre("D4Science.org Detached Gateway", "D4OS", "CNROutreach");
|
||||
xmlManager.findVre("D4Science.org Detached Gateway", "D4OS", "CNROutreach");
|
||||
|
||||
}
|
||||
}
|
|
@ -34,7 +34,9 @@ public class XmlManager implements VreRemPubInterface {
|
|||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||
Document doc = dBuilder.parse(xmlFile);
|
||||
doc.getDocumentElement().normalize();
|
||||
NodeList gatewayList = doc.getElementsByTagName("entry");
|
||||
NodeList gatewayNodes = doc.getElementsByTagName("gateways");
|
||||
|
||||
NodeList gatewayList = gatewayNodes.item(0).getChildNodes();
|
||||
|
||||
for (int i = 0; i < gatewayList.getLength(); i++) {
|
||||
Node gatewayNode = gatewayList.item(i);
|
||||
|
@ -44,6 +46,8 @@ public class XmlManager implements VreRemPubInterface {
|
|||
String gatewayDescription = gatewayElement.getElementsByTagName("description").item(0)
|
||||
.getTextContent().trim();
|
||||
|
||||
//System.out.println("gateway name:"+gatewayName);
|
||||
//System.out.println("Gateway descr:"+gatewayDescription);
|
||||
Gateway gateway = new Gateway(gatewayName, gatewayDescription);
|
||||
|
||||
// Find the <vos> element within the gateway entry
|
||||
|
@ -53,21 +57,36 @@ public class XmlManager implements VreRemPubInterface {
|
|||
if (vosNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element vosElement = (Element) vosNode;
|
||||
|
||||
// Iterate through <entry> elements representing VOs within <vos>
|
||||
NodeList voList = vosElement.getElementsByTagName("entry");
|
||||
for (int k = 0; k < voList.getLength(); k++) {
|
||||
Node voNode = voList.item(k);
|
||||
if (voNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element voElement = (Element) voNode;
|
||||
String voName = voElement.getElementsByTagName("name").item(0).getTextContent().trim();
|
||||
String voScope = voElement.getElementsByTagName("scope").item(0).getTextContent().trim();
|
||||
String voKey = voElement.getElementsByTagName("key").item(0).getTextContent().trim();
|
||||
|
||||
// Create a new Vos object and add it to the gateway's vosList
|
||||
|
||||
|
||||
String voKey = vosElement.getElementsByTagName("key").item(0).getTextContent().trim();
|
||||
String voName = vosElement.getElementsByTagName("name").item(0).getTextContent().trim();
|
||||
String voScope = vosElement.getElementsByTagName("scope").item(0).getTextContent().trim();
|
||||
|
||||
//getting vo
|
||||
Vos vos = new Vos(voKey,voScope, voName);
|
||||
|
||||
//vos.printInfo();
|
||||
|
||||
// Iterate on the vres..
|
||||
//NodeList vreList = vosElement.getElementsByTagName("vres");
|
||||
//
|
||||
//for (int k = 0; k < vreList.getLength(); k++) {
|
||||
// Node voNode = voList.item(k);
|
||||
// if (voNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
// Element voElement = (Element) voNode;
|
||||
|
||||
|
||||
// String voName = voElement.getElementsByTagName("name").item(0).getTextContent().trim();
|
||||
// String voScope = voElement.getElementsByTagName("scope").item(0).getTextContent().trim();
|
||||
// String voKey = voElement.getElementsByTagName("key").item(0).getTextContent().trim();
|
||||
|
||||
// Create a new Vos object and add it to the gateway's vosList
|
||||
// Vos vos = new Vos(voKey, voScope, voName);
|
||||
|
||||
// Find the <vres> element within the VO entry
|
||||
NodeList vresList = voElement.getElementsByTagName("vres");
|
||||
NodeList vresList = vosElement.getElementsByTagName("vres");
|
||||
for (int l = 0; l < vresList.getLength(); l++) {
|
||||
Node vresNode = vresList.item(l);
|
||||
if (vresNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
@ -96,6 +115,8 @@ public class XmlManager implements VreRemPubInterface {
|
|||
Vres vres = new Vres(vreKey, vreName, vreDescription, vreManager,
|
||||
vreStartDate, vreEndDate);
|
||||
vos.addVres(vres);
|
||||
|
||||
//vres.printInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,8 +124,8 @@ public class XmlManager implements VreRemPubInterface {
|
|||
|
||||
// Add the Vos object to the gateway's vosList
|
||||
gateway.addVos(vos);
|
||||
}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
Loading…
Reference in New Issue