Code example for DocumentBuilder

Methods: newDocument

0
		JAXBContext jc = JAXBContext
				.newInstance(edu.harvard.i2b2.crc.datavo.setfinder.query.QueryDefinitionType.class); 
		Marshaller m = jc.createMarshaller();
		DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = f.newDocumentBuilder();
		Document doc = builder.newDocument();
		m
				.marshal( 
						(new edu.harvard.i2b2.crc.datavo.setfinder.query.ObjectFactory()) 
								.createQueryDefinition(queryDefinitionType
										.getQueryDefinition()), doc);
 
		String domString = edu.harvard.i2b2.common.util.xml.XMLUtil
				.convertDOMToString(doc);
		System.out.println("string output" + domString);
 
		Document doc1 = edu.harvard.i2b2.common.util.xml.XMLUtil
				.convertStringToDOM(domString);
		System.out.println("string output"
				+ edu.harvard.i2b2.common.util.xml.XMLUtil 
						.convertDOMToString(doc1));