private static ApplianceDescriptor parseVS(Node n, ApplianceDescriptor parent) throws XPathExpressionException, MalformedOVFException
	{
		XPath xpath = XPathFactory.newInstance().newXPath();

		// id
		Node id = n.getAttributes().getNamedItem("ovf:id");
		if (id == null)
		{
			throw new RuntimeException("id was not specified for the appliance.");
		}
		String vsId = id.getNodeValue();

		OVFVirtualSystem ovfVS = new OVFVirtualSystem(vsId);
		vs.put(vsId, ovfVS);

		// FIXME: remove NULL & 0 values;
		ApplianceDescriptor appliance = new ApplianceDescriptor(vsId, null, 0, false);
		appliance.getVirtualSystems().add(vs.get(vsId));
		appliance.setParent(parent);

		// reading product section
		XPathExpression expr = xpath.compile("ProductSection");
		NodeList productList = (NodeList) expr.evaluate(n, XPathConstants.NODESET);
		parseProductSection(appliance, productList, xpath);

		// parsing of the Item(s) of the VirtualHardwareSection.
		expr = xpath.compile("VirtualHardwareSection/Item");
		NodeList items = (NodeList) expr.evaluate(n, XPathConstants.NODESET);

		for (int k = 0; k < items.getLength(); k++)
		{
			Node item = items.item(k);
			OVFVirtualHardware vh = null;

			// for each child element "rasd:*" do
			for (int j = 0; j < item.getChildNodes().getLength(); j++)
			{
				Node child = item.getChildNodes().item(j);

				if (child.getNodeName().equals("rasd:ResourceType"))
				{
					int resourceType = Integer.parseInt(child.getTextContent());

					OVFItemProcessor p = OVFResourceAllocationSettingDataTranslator.getItemProcessor(resourceType);

					vh = p.processItem(item);
					ovfVS.getRequiredHardware().add(vh);

					switch (vh.getResourceType()){
					case 17: // if ResourceType == 17 => Link "Disk" from Disks hashmap
						OVFVirtualHwDiskDrive vDisk = (OVFVirtualHwDiskDrive) vh;
						String diskRef = vDisk.getHostResource();
						vDisk.setDisk(disks.get(diskRef));
						break;
					case 32: // if ResourceType == 17 => Link "Disk" from Disks hashmap
						OVFVirtualHwSharedDiskDrive vShDisk = (OVFVirtualHwSharedDiskDrive) vh;
						String shDiskRef = vShDisk.getHostResource();
						vShDisk.setSharedDisk(sharedDisks.get(shDiskRef));
						break;
					case 10:
						OVFVirtualHwEthernetAdapter veth = (OVFVirtualHwEthernetAdapter) vh;
						String nName = veth.getConnection();
						OVFVirtualNetwork vn = appliance.getVirtualNetworkByName(nName);
						if (vn == null)
						{
							vn = networks.get(nName);
							if (vn == null)
								throw new MalformedOVFException("Usage of a network not specified in NetworkSection");
							appliance.getAssociatedVirtualNetworks().add(new OVFVirtualNetwork(nName, vn.getDescription()));
						}
						appliance.linkEthAdapterToNetwork(veth, nName);
                        break;
					}
				}
			}
		}

		return appliance;
	}