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


Java TransformerConfigurationException.printStackTrace方法代码示例

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


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

示例1: save

import javax.xml.transform.TransformerConfigurationException; //导入方法依赖的package包/类
public static void save(String paramString, Document paramDocument) throws Exception {
	DOMSource localDOMSource = new DOMSource(paramDocument);
	File localFile1 = new File(paramString);
	File localFile2 = localFile1.getParentFile();
	localFile2.mkdirs();
	StreamResult localStreamResult = new StreamResult(localFile1);
	try {
		TransformerFactory localTransformerFactory = TransformerFactory.newInstance();
		Transformer localTransformer = localTransformerFactory.newTransformer();
		Properties localProperties = localTransformer.getOutputProperties();
		localProperties.setProperty("encoding", "UTF-8");
		localProperties.setProperty("indent", "yes");
		localTransformer.setOutputProperties(localProperties);
		localTransformer.transform(localDOMSource, localStreamResult);
	} catch (TransformerConfigurationException localTransformerConfigurationException) {
		localTransformerConfigurationException.printStackTrace();
	} catch (TransformerException localTransformerException) {
		localTransformerException.printStackTrace();
	}
}
 
开发者ID:inspingcc,项目名称:LibraSock,代码行数:21,代码来源:XmlUtils.java

示例2: setServiceDescriptionName

import javax.xml.transform.TransformerConfigurationException; //导入方法依赖的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

示例3: initalize

import javax.xml.transform.TransformerConfigurationException; //导入方法依赖的package包/类
@Override
public void initalize(WitsmlClient witsmlClient, String wellId, String wellboreId) {
    try {
        transformer = new WitsmlVersionTransformer();
    } catch (TransformerConfigurationException e) {
        e.printStackTrace();
    }
    this.witsmlClient = witsmlClient;
    this.wellId = wellId;
    this.wellboreId = wellboreId;
}
 
开发者ID:hashmapinc,项目名称:witsml-client,代码行数:12,代码来源:TrajectoryRequestTracker.java


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