本文整理匯總了Java中org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces方法的典型用法代碼示例。如果您正苦於以下問題:Java XmlOptions.setSaveAggressiveNamespaces方法的具體用法?Java XmlOptions.setSaveAggressiveNamespaces怎麽用?Java XmlOptions.setSaveAggressiveNamespaces使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.xmlbeans.XmlOptions
的用法示例。
在下文中一共展示了XmlOptions.setSaveAggressiveNamespaces方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: writeXmlFile
import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
public static void writeXmlFile(XmlObject docObject, String targetFilePath) {
File xmlFile = new File(targetFilePath);
HashMap NamespaceMap = new HashMap();
NamespaceMap.put("http://www.opengis.net/om/2.0", "om");
NamespaceMap.put(NS_GML, "gml");
NamespaceMap.put(NS_MET_BASIC, "");
NamespaceMap.put(NS_OPM, "");
NamespaceMap.put(NS_METCE, "metce");
NamespaceMap.put(NS_SAF, "saf");
NamespaceMap.put(NS_IWXXM, "");
NamespaceMap.put(NS_XS, "");
NamespaceMap.put(NS_SAMS, "sams");
NamespaceMap.put(NS_SAM, "sam");
XmlOptions xmlOptions = new XmlOptions();
xmlOptions.setSavePrettyPrint();
xmlOptions.setSaveSuggestedPrefixes(NamespaceMap);
xmlOptions.setSaveAggressiveNamespaces();
xmlOptions.setUseDefaultNamespace();
try {
docObject.save(xmlFile, xmlOptions);
} catch (IOException e) {
e.printStackTrace();
}
}
示例2: getXmlSaveOptions
import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
@ApiModelProperty(hidden=true)
public XmlOptions getXmlSaveOptions() {
XmlOptions options = new XmlOptions();
options.setSavePrettyPrint();
options.setSaveAggressiveNamespaces();
options.setSavePrettyPrintIndent(2);
return options;
}
示例3: getXmlOptions
import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
public static XmlOptions getXmlOptions() {
XmlOptions xmlOptions = new XmlOptions();
//xmlOptions.setUseDefaultNamespace();
HashMap<String, String> ns = new HashMap<String, String>();
//ns.put("urn:mpeg:DASH:schema:MPD:2011", "");
ns.put("urn:mpeg:cenc:2013", "cenc");
ns.put("urn:mpeg:drmtdoday:cenc:2014", "drmtoday");
ns.put("urn:microsoft:playready", "mspr");
xmlOptions.setSaveSuggestedPrefixes(ns);
xmlOptions.setSaveAggressiveNamespaces();
xmlOptions.setUseDefaultNamespace();
xmlOptions.setSavePrettyPrint();
return xmlOptions;
}
示例4: getOptions
import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private XmlOptions getOptions() {
HashMap<String, String> map = new HashMap<String, String>();
map.put(NAMESPACE, NAMESPACE_PREFIX);
XmlOptions options = new XmlOptions();
options.setSaveAggressiveNamespaces();
options.setSavePrettyPrint();
options.setSaveSuggestedPrefixes(map);
return options;
}
示例5: save
import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
/**
* Save project list in XML format
*
* @param path file path
* @throws IOException file bug
*/
public void save(String path) throws IOException
{
if (path == null)
throw new IOException();
ProjectListDocument doc = ProjectListDocument.Factory.newInstance();
ProjectListType pl = doc.addNewProjectList();
if ((list != null) && (list.size() > 0))
{
Enumeration<String> e = list.keys();
while (e.hasMoreElements())
{
String k = e.nextElement();
PortfolioItem p = list.get(k);
ProjectType pt = pl.addNewProject();
pt.setName(p.getName());
pt.setPhase(p.getPhase());
pt.setPath(p.getPath());
}
FileOutputStream fos = new FileOutputStream(new File(path));
XmlOptions opts = new XmlOptions();
opts.setSaveAggressiveNamespaces();
opts.setSavePrettyPrint();
fos.write(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + doc.xmlText(opts)).getBytes("utf-8")); //$NON-NLS-1$ //$NON-NLS-2$
fos.close();
}
}