當前位置: 首頁>>代碼示例>>Java>>正文


Java XmlOptions.setSaveNamespacesFirst方法代碼示例

本文整理匯總了Java中org.apache.xmlbeans.XmlOptions.setSaveNamespacesFirst方法的典型用法代碼示例。如果您正苦於以下問題:Java XmlOptions.setSaveNamespacesFirst方法的具體用法?Java XmlOptions.setSaveNamespacesFirst怎麽用?Java XmlOptions.setSaveNamespacesFirst使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.xmlbeans.XmlOptions的用法示例。


在下文中一共展示了XmlOptions.setSaveNamespacesFirst方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getXmlOptions

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
public XmlOptions getXmlOptions() {
	HashMap<String,String> suggestedPrefixes = new HashMap<String,String>();
	suggestedPrefixes.put("http://www.oscarmcmaster.org/AR2005", "");
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance","xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	Map<String,String> implicitNamespaces = new HashMap<String,String>();
	implicitNamespaces.put("","http://www.oscarmcmaster.org/AR2005");
	opts.setSaveImplicitNamespaces(implicitNamespaces);
	opts.setSaveNamespacesFirst();
	opts.setCharacterEncoding("UTF-16");
	
	return opts;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:18,代碼來源:ONAREnhancedBornConnector.java

示例2: prepareXMLFile

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
/**
 * Sends xml to the response
 * 
 * @param wsdlXml the xml object
 * @param resp the response object where to send the file
 * @throws IOException if IO error
 */
protected String prepareXMLFile(XmlObject wsdlXml,
		HttpServletRequest req, HttpServletResponse resp) throws IOException {
	if (wsdlXml == null) {
		throw new IOException("Could not read wsdl file.");
	}
	
	XmlOptions opts = new XmlOptions();
	opts.setSaveNamespacesFirst();
	opts.setSavePrettyPrint();
	opts.setLoadStripComments();

	resp.setContentType("text/xml");

	return wsdlXml.xmlText(opts);
}
 
開發者ID:52North,項目名稱:SES,代碼行數:23,代碼來源:GetRequestHandler.java

示例3: generateXml

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] generateXml(LoggedInInfo loggedInInfo, Integer demographicNo, Integer rourkeFdid, Integer nddsFdid, Integer report18mFdid, boolean useClinicInfoForOrganizationId) {
	HashMap<String,String> suggestedPrefixes = new HashMap<String,String>();
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance","xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	opts.setSaveNamespacesFirst();
	ByteArrayOutputStream os = null;
	PrintWriter pw = null;
	boolean xmlCreated = false;
	
	BORN18MFormToXML xml = new BORN18MFormToXML(demographicNo);
	try {
		os = new ByteArrayOutputStream();
		pw = new PrintWriter(os, true);
		//pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xmlCreated = xml.addXmlToStream(loggedInInfo, pw, opts, rourkeFdid, nddsFdid, report18mFdid, useClinicInfoForOrganizationId);
		
		pw.close();
		if (xmlCreated) return os.toByteArray();
	}
	catch(Exception e) {
		logger.warn("Unable to add record",e);
	}
	
	return null;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:30,代碼來源:BORN18MConnector.java

示例4: generateWBCSDXml

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] generateWBCSDXml(BORNWbCsdXmlGenerator xml, Integer demographicNo) {
	HashMap<String, String> suggestedPrefixes = new HashMap<String, String>();
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	opts.setSaveNamespacesFirst();
	ByteArrayOutputStream os = null;
	PrintWriter pw = null;
	boolean xmlCreated = false;

	try {
		os = new ByteArrayOutputStream();
		pw = new PrintWriter(os, true);
		//pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xmlCreated = xml.addToStream(pw, opts, demographicNo, true);

		pw.close();
		if (xmlCreated) return os.toByteArray();
	} catch (Exception e) {
		logger.warn("Unable to add record", e);
	}

	return null;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:28,代碼來源:BORNWBCSDJob.java

示例5: generateWBXml

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] generateWBXml(BORNWbXmlGenerator xml, Integer demographicNo) {
	HashMap<String, String> suggestedPrefixes = new HashMap<String, String>();
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	opts.setSaveNamespacesFirst();
	ByteArrayOutputStream os = null;
	PrintWriter pw = null;
	boolean xmlCreated = false;

	try {
		os = new ByteArrayOutputStream();
		pw = new PrintWriter(os, true);
		//pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xmlCreated = xml.addToStream(pw, opts, true);

		pw.close();
		if (xmlCreated) return os.toByteArray();
	} catch (Exception e) {
		logger.warn("Unable to add record", e);
	}

	return null;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:28,代碼來源:BORNWBJob.java

示例6: generateXml

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] generateXml(Integer demographicNo, Integer rourkeFdid, Integer nddsFdid, Integer report18mFdid) {
	HashMap<String,String> suggestedPrefixes = new HashMap<String,String>();
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance","xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	opts.setSaveNamespacesFirst();
	ByteArrayOutputStream os = null;
	PrintWriter pw = null;
	boolean xmlCreated = false;
	
	BORN18MFormToXML xml = new BORN18MFormToXML(demographicNo);
	try {
		os = new ByteArrayOutputStream();
		pw = new PrintWriter(os, true);
		pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xmlCreated = xml.addXmlToStream(pw, opts, rourkeFdid, nddsFdid, report18mFdid);
		
		pw.close();
		if (xmlCreated) return os.toByteArray();
	}
	catch(Exception e) {
		logger.warn("Unable to add record",e);
	}
	
	return null;
}
 
開發者ID:oscarservice,項目名稱:oscar-old,代碼行數:30,代碼來源:BORN18MConnector.java

示例7: createXMLFile

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
/**
 * Sends xml (as input stream) to the response
 * 
 * @param in resource as inputstream
 * @param resp the response where to write the file
 * @param conf the config to retrieve the global known url
 * @return the xmlobject for caching purposes
 * @throws IOException if IO error
 */
protected XmlObject createXMLFile(InputStream in, ConfigurationRegistry conf) throws IOException {
	XmlOptions opts = new XmlOptions();
	opts.setSaveNamespacesFirst();
	opts.setSavePrettyPrint();
	opts.setLoadStripComments();

	InputStreamReader isr = new InputStreamReader(in);
	BufferedReader br = new BufferedReader(isr);
	StringBuilder sb = new StringBuilder();

	while (br.ready()) {
		sb.append(br.readLine());
	}

	/*
	 * set location
	 */
	String xmltmp = sb.toString().replace("http://localhost:8080/52nSES", conf.getEnvironment().getDefaultURI().substring(0,
			conf.getEnvironment().getDefaultURI().lastIndexOf("/services")));

	XmlObject wsdlObj = null;
	try {
		wsdlObj  = XmlObject.Factory.parse(xmltmp, opts);
	} catch (XmlException e) {
		throw new IOException(e);
	}

	return wsdlObj;
}
 
開發者ID:52North,項目名稱:SES,代碼行數:39,代碼來源:GetRequestHandler.java


注:本文中的org.apache.xmlbeans.XmlOptions.setSaveNamespacesFirst方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。