factory.setValidating(true);
factory.setValidating(false);
	public JarPackage readXML() throws IOException, SAXException {		Element xmlJarDesc= null;		JarPackage jarPackage= new JarPackage();	  	DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();    	factory.setValidating(true);		DocumentBuilder parser= null;		try {			parser= factory.newDocumentBuilder();		} catch (ParserConfigurationException ex) {			throw new IOException(ex.getMessage());		} finally {			// Note: Above code is ok since clients are responsible to close the stream		}		xmlJarDesc= parser.parse(new InputSource(fInputStream)).getDocumentElement();		if (!xmlJarDesc.getNodeName().equals(JarPackage.DESCRIPTION_EXTENSION)) {			throw new IOException(JarPackagerMessages.getString("JarPackageReader.error.badFormat")); //$NON-NLS-1$		}		NodeList topLevelElements= xmlJarDesc.getChildNodes();		for (int i= 0; i < topLevelElements.getLength(); i++) {			Node node= topLevelElements.item(i);			if (node.getNodeType() != Node.ELEMENT_NODE)				continue;			Element element= (Element)node;			if (element.getNodeName().equals(JarPackage.EXTENSION)) {				jarPackage.setJarLocation(new Path(element.getAttribute("path"))); //$NON-NLS-1$			}					if (element.getNodeName().equals("options")) { //$NON-NLS-1$				jarPackage.setOverwrite(getBooleanAttribute(element, "overwrite")); //$NON-NLS-1$				jarPackage.setCompress(getBooleanAttribute(element, "compress")); //$NON-NLS-1$				jarPackage.setExportErrors(getBooleanAttribute(element, "exportErrors")); //$NON-NLS-1$				jarPackage.setExportWarnings(getBooleanAttribute(element, "exportWarnings")); //$NON-NLS-1$				jarPackage.setLogErrors(getBooleanAttribute(element, "logErrors")); //$NON-NLS-1$				jarPackage.setLogWarnings(getBooleanAttribute(element, "logWarnings")); //$NON-NLS-1$				jarPackage.setSaveDescription(getBooleanAttribute(element, "saveDescription")); //$NON-NLS-1$				jarPackage.setDescriptionLocation(new Path(element.getAttribute("descriptionLocation"))); //$NON-NLS-1$			}			if (element.getNodeName().equals("manifest")) { //$NON-NLS-1$				jarPackage.setManifestVersion(element.getAttribute("manifestVersion")); //$NON-NLS-1$				jarPackage.setUsesManifest(getBooleanAttribute(element, "usesManifest")); //$NON-NLS-1$				jarPackage.setReuseManifest(getBooleanAttribute(element, "reuseManifest")); //$NON-NLS-1$				jarPackage.setSaveManifest(getBooleanAttribute(element,"saveManifest")); //$NON-NLS-1$				jarPackage.setGenerateManifest(getBooleanAttribute(element, "generateManifest")); //$NON-NLS-1$				jarPackage.setManifestLocation(new Path(element.getAttribute("manifestLocation"))); //$NON-NLS-1$				jarPackage.setMainClass(getMainClass(element));				/*				 * Try to find sealing info. Could ask for single child node				 * but this would stop others from adding more child nodes to				 * the manifest node.				 */				NodeList sealingElementContainer= element.getChildNodes();				for (int j= 0; j < sealingElementContainer.getLength(); j++) {					Node sealingNode= sealingElementContainer.item(j);					if (sealingNode.getNodeType() == Node.ELEMENT_NODE						&& sealingNode.getNodeName().equals("sealing")) { //$NON-NLS-1$						// Sealing						Element sealingElement= (Element)sealingNode;						jarPackage.setSealJar(getBooleanAttribute(sealingElement, "sealJar")); //$NON-NLS-1$						jarPackage.setPackagesToSeal(getPackages(sealingElement.getElementsByTagName("packagesToSeal"))); //$NON-NLS-1$						jarPackage.setPackagesToUnseal(getPackages(sealingElement.getElementsByTagName("packagesToUnSeal"))); //$NON-NLS-1$					}						}			}			if (element.getNodeName().equals("selectedElements")) { //$NON-NLS-1$				jarPackage.setExportClassFiles(getBooleanAttribute(element, "exportClassFiles")); //$NON-NLS-1$				jarPackage.setExportJavaFiles(getBooleanAttribute(element, "exportJavaFiles")); //$NON-NLS-1$				NodeList selectedElements= element.getChildNodes();				for (int j= 0; j < selectedElements.getLength(); j++) {					Node selectedNode= selectedElements.item(j);					if (selectedNode.getNodeType() != Node.ELEMENT_NODE)						continue;					Element selectedElement= (Element)selectedNode;					if (selectedElement.getNodeName().equals("file")) //$NON-NLS-1$						addFile(jarPackage.getSelectedElements(), selectedElement);					else if (selectedElement.getNodeName().equals("folder")) //$NON-NLS-1$						addFolder(jarPackage.getSelectedElements() ,selectedElement);					else if (selectedElement.getNodeName().equals("project")) //$NON-NLS-1$						addProject(jarPackage.getSelectedElements() ,selectedElement);					else if (selectedElement.getNodeName().equals("javaElement")) //$NON-NLS-1$						addJavaElement(jarPackage.getSelectedElements() ,selectedElement);					// Note: Other file types are not handled by this writer				}			}		}		return jarPackage;	}