本文整理匯總了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}