当前位置: 首页>>代码示例>>Java>>正文


Java ParserConfigurationException.printStackTrace方法代码示例

本文整理汇总了Java中javax.xml.parsers.ParserConfigurationException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ParserConfigurationException.printStackTrace方法的具体用法?Java ParserConfigurationException.printStackTrace怎么用?Java ParserConfigurationException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.parsers.ParserConfigurationException的用法示例。


在下文中一共展示了ParserConfigurationException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
private static Document load(InputStream in) throws IOException {

        Document document = null;

        try {
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            DocumentBuilder db = dbf.newDocumentBuilder();
            document = db.parse(in);
        } catch (ParserConfigurationException parserConfigurationException) {
            parserConfigurationException.printStackTrace();
            Assert.fail(parserConfigurationException.toString());
        } catch (SAXException saxException) {
            saxException.printStackTrace();
            Assert.fail(saxException.toString());
        }

        return document;
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TransformerFactoryTest.java

示例2: testAttributeCaching

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
@Test
public void testAttributeCaching() {
    File xmlFile = new File(getClass().getResource("Bug6879614.xml").getFile());
    DocumentBuilderFactory _documentBuilderFactory = DocumentBuilderFactory.newInstance();
    _documentBuilderFactory.setValidating(false);
    _documentBuilderFactory.setIgnoringComments(true);
    _documentBuilderFactory.setIgnoringElementContentWhitespace(true);
    _documentBuilderFactory.setCoalescing(true);
    _documentBuilderFactory.setExpandEntityReferences(true);
    _documentBuilderFactory.setNamespaceAware(true);
    DocumentBuilder _documentBuilder = null;
    try {
        _documentBuilder = _documentBuilderFactory.newDocumentBuilder();
    } catch (ParserConfigurationException pce) {
        pce.printStackTrace();
    }

    Document xmlDoc = null;
    try {
        xmlDoc = _documentBuilder.parse(xmlFile);
        if (xmlDoc == null) {
            System.out.println("Hello!!!, there is a problem here");
        } else {
            System.out.println("Good, the parsing went through fine.");
        }
    } catch (SAXException se) {
        se.printStackTrace();
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:Bug6879614Test.java

示例3: export

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
public void export(File file) {
	try {
		// Create the GraphML Document
		docFactory = DocumentBuilderFactory.newInstance();
		docBuilder = docFactory.newDocumentBuilder();
		doc = docBuilder.newDocument();

		// Export the data
		exportData();

		// Save data as GraphML file
		Transformer transformer = TransformerFactory.newInstance()
				.newTransformer();
		DOMSource source = new DOMSource(doc);
		StreamResult result = new StreamResult(file);
		transformer.setOutputProperty(OutputKeys.INDENT, "yes");
		transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
		transformer.transform(source, result);

	} catch (TransformerException te) {
		te.printStackTrace();
	} catch (ParserConfigurationException pce) {
		pce.printStackTrace();
	}
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:26,代码来源:GraphMLExporter.java

示例4: parseCartList

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
private void parseCartList(String xml){
	cartList = new ArrayList<String>();
	//get the factory
	DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	try {
		DocumentBuilder db = dbf.newDocumentBuilder();
		domCL = db.parse(new InputSource(new StringReader(xml)));
		domCL.getDocumentElement().normalize();
		
		NodeList nList = domCL.getElementsByTagName("item");
	    for (int temp = 0; temp < nList.getLength(); temp++) {
	        Node nNode = nList.item(temp);
	        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
	        	Element eElement = (Element) nNode; 
	        	//put cart items in list
	        	String accum = ""+eElement.getElementsByTagName("type").item(0).getTextContent() + " / " +
	        			eElement.getElementsByTagName("make").item(0).getTextContent() + " / " +
	        			eElement.getElementsByTagName("model").item(0).getTextContent()+ " / " +
	        			eElement.getElementsByTagName("price").item(0).getTextContent(); 
	        	cartList.add(accum);
	         }
	    }
	    //catch total price and item returned from server
	    totalPrice=domCL.getElementsByTagName("totalcost").item(0).getTextContent();
	    totalItem=domCL.getElementsByTagName("totalitem").item(0).getTextContent();
	    
	}catch(ParserConfigurationException pce) {			pce.printStackTrace();
	}catch(SAXException se) {							se.printStackTrace();
	}catch(IOException ioe) {							ioe.printStackTrace();
	}catch (Exception e){								e.printStackTrace();
	}
}
 
开发者ID:anirban99,项目名称:Shopping-Cart-using-Web-Services,代码行数:33,代码来源:MyClientRest.java

示例5: parseUserActionResponse

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
private void parseUserActionResponse(String xml){
	messageList = new ArrayList<String>();
	//get the factory
	DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	try {
		DocumentBuilder db = dbf.newDocumentBuilder();
		domARB = db.parse(new InputSource(new StringReader(xml)));
		domARB.getDocumentElement().normalize();
		NodeList nList = domARB.getElementsByTagName("messagetouser");
		messageList.clear();
		//put all message from server in a list
	    for (int temp = 0; temp < nList.getLength(); temp++) {
	        Node nNode = nList.item(temp);
	        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
	        	Element eElement = (Element) nNode; 
	        	messageList.add(eElement.getTextContent());
	        }
	    }
	    //catch total items returned from server
	    totalItem=domARB.getElementsByTagName("totalitem").item(0).getTextContent();
	    
	}catch(ParserConfigurationException pce) {			pce.printStackTrace();
	}catch(SAXException se) {							se.printStackTrace();
	}catch(IOException ioe) {							ioe.printStackTrace();
	}catch (Exception e){								e.printStackTrace();
	}
}
 
开发者ID:anirban99,项目名称:Shopping-Cart-using-Web-Services,代码行数:28,代码来源:MyClientSOAP.java

示例6: createDOM

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * Creates a DOM (Document Object Model) <code>Document<code>.
 */
private void createDOM() {
	try {
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();

		//data is a Document
		data = builder.newDocument();

		Element root = data.createElement("measure");

		root.setAttribute("name", name);
		root.setAttribute("meanValue", "null");
		root.setAttribute("upperBound", "null");
		root.setAttribute("lowerBound", "null");
		root.setAttribute("progress", Double.toString(getSamplesAnalyzedPercentage()));
		root.setAttribute("data", "null");
		root.setAttribute("finished", "false");
		root.setAttribute("discarded", "0");
		root.setAttribute("precision", Double.toString(analyzer.getPrecision()));
		root.setAttribute("maxSamples", Double.toString(getMaxSamples()));

		data.appendChild(root);

	} catch (FactoryConfigurationError factoryConfigurationError) {
		factoryConfigurationError.printStackTrace();
	} catch (ParserConfigurationException e) {
		e.printStackTrace();
	}

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:34,代码来源:Measure.java

示例7: setServiceDescriptionName

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * Sets the service description name.
 *
 * @param serviceDescriptionFile the service description file
 * @param serviceName the service name
 */
private void setServiceDescriptionName(File serviceDescriptionFile) {
	
	String newServiceName = this.getSymbolicBundleName() + "." + CLASS_LOAD_SERVICE_NAME;
	
	try {
		// --- Open the XML document ------------------
		DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
		Document doc = docBuilder.parse(serviceDescriptionFile);
		
		// --- Get the XML root/component element -----
		Node component = doc.getFirstChild();
		NamedNodeMap componentAttr = component.getAttributes();
		Node nameAttr = componentAttr.getNamedItem("name");
		nameAttr.setTextContent(newServiceName);
		
		// --- Save document in XML file --------------	
		TransformerFactory transformerFactory = TransformerFactory.newInstance();
		Transformer transformer = transformerFactory.newTransformer();
		DOMSource source = new DOMSource(doc);
		StreamResult result = new StreamResult(serviceDescriptionFile);
		transformer.transform(source, result);
		
	} catch (ParserConfigurationException pcEx) {
		pcEx.printStackTrace();
	} catch (SAXException saxEx) {
		saxEx.printStackTrace();
	} catch (IOException ioEx) {
		ioEx.printStackTrace();
	} catch (TransformerConfigurationException tcEx) {
		tcEx.printStackTrace();
	} catch (TransformerException tEx) {
		tEx.printStackTrace();
	}
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:43,代码来源:BundleBuilder.java

示例8: initialValue

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
@Override
protected DocumentBuilder initialValue() {
	try {
		return defaultDocumentBuilderFactory.get().newDocumentBuilder();
	} catch (ParserConfigurationException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:10,代码来源:XMLUtils.java

示例9: getDocument

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * Returns the entire Document representing GUI data structure.
 * @param model data structure
 * @return complete GUI data structure in Document format
 */
public static Document getDocument(CommonModel model) {
	DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	DocumentBuilder docBuilder = null;
	try {
		docBuilder = dbf.newDocumentBuilder();
	} catch (ParserConfigurationException e) {
		e.printStackTrace();
		return null;
	}
	Document modelDoc = docBuilder.newDocument();
	// Writes all elements on Document
	writeGuiInfos(modelDoc, model);
	return modelDoc;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:20,代码来源:GuiXMLWriter.java

示例10: getDocument

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * Returns the entire Document representing results data structure.
 * @param measure data structure
 * @return complete measures data structure in Document format
 */
public static Document getDocument(MeasureDefinition measure) {
	DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	DocumentBuilder docBuilder = null;
	try {
		docBuilder = dbf.newDocumentBuilder();
	} catch (ParserConfigurationException e) {
		e.printStackTrace();
		return null;
	}
	Document modelDoc = docBuilder.newDocument();
	// Writes all elements on Document
	writeResults(modelDoc, measure);
	return modelDoc;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:20,代码来源:XMLResultsWriter.java

示例11: parseXMLFile

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
public void parseXMLFile(String url) {
	SAXParserFactory spf = SAXParserFactory.newInstance();
	try {
		Scanner sc = new Scanner(new File(url), "UTF-8");
		
		while(sc.hasNextLine())
		{
			sc.nextLine().trim().replaceFirst("^([\\W]+)<","<");
			break;
		}

	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	try {
		//get a new instance of parser
		SAXParser sp = spf.newSAXParser();

		//parse the file and also register this class for call backs
		sp.parse(url, this);


	}catch(SAXException se) {
		se.printStackTrace();
	}catch(ParserConfigurationException pce) {
		pce.printStackTrace();
	}catch (IOException ie) {
		ie.printStackTrace();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:32,代码来源:ShipControl.java

示例12: initialValue

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
protected DocumentBuilder initialValue() {
	try {
		return defaultDocumentBuilderFactory.get().newDocumentBuilder();
	} catch (ParserConfigurationException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:9,代码来源:SchemaUtils.java

示例13: DocumentParser

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
public DocumentParser() {
    try {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        builder = factory.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
        e.printStackTrace();
    }
}
 
开发者ID:laohans,项目名称:swallow-core,代码行数:9,代码来源:DocumentParser.java

示例14: parse

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
private Document parse() throws IOException, SAXException{
    try{
        DocumentBuilder db = DocumentBuilderFactory.
                newInstance().
                newDocumentBuilder();
        Document doc = db.parse(url.openStream()); // will throw SAXException upon failure
        doc.normalizeDocument(); // make sure everything is lined up properly; probably not an issue
        return doc;
    }
    catch(ParserConfigurationException e) { e.printStackTrace(); return null; }
}
 
开发者ID:beesenpai,项目名称:EVE,代码行数:12,代码来源:Feed.java

示例15: XML

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
XML(Micro_Sim processing) {
    this.processing = processing;
    File file = new File(filepath);
    file.delete();

    docFactory = DocumentBuilderFactory.newInstance();
    try {
        docBuilder = docFactory.newDocumentBuilder();
    } catch (ParserConfigurationException pce) {
        pce.printStackTrace();
    }
}
 
开发者ID:Majiick,项目名称:MicroSim,代码行数:13,代码来源:XML.java


注:本文中的javax.xml.parsers.ParserConfigurationException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。