本文整理了Java中org.exolab.castor.xml.Marshaller.setRootElement()
方法的一些代码示例,展示了Marshaller.setRootElement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marshaller.setRootElement()
方法的具体详情如下:
包路径:org.exolab.castor.xml.Marshaller
类名称:Marshaller
方法名:setRootElement
[英]Sets the name of the root element to use.
[中]设置要使用的根元素的名称。
代码示例来源:origin: org.codehaus.castor/castor-xml
public static void main(String[] args) {
// TODO: add CommandLineOptions
// options needed
// 1. filename/path of CHANGELOG
// 2. mapping file for customization
// 3. output file name
XMLContext xmlContext = new XMLContext();
ChangeLog2XML parser = xmlContext.createChangeLog2XML();
try {
File file = new File(DEFAULT_FILE);
Changelog changelog = parser.parse(file);
file = new File(DEFAULT_OUTPUT);
FileWriter writer = new FileWriter(file);
xmlContext.setProperty(XMLProperties.USE_INDENTATION, true);
Marshaller marshaller = xmlContext.createMarshaller();
marshaller.setWriter(writer);
marshaller.setRootElement("changelog");
marshaller.setSuppressXSIType(true);
marshaller.marshal(changelog);
} catch (Exception ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor
public static void main(String[] args) {
//TODO: add CommandLineOptions
// options needed
// 1. filename/path of CHANGELOG
// 2. mapping file for customization
// 3. output file name
XMLContext xmlContext = new XMLContext();
ChangeLog2XML parser = xmlContext.createChangeLog2XML();
try {
File file = new File(DEFAULT_FILE);
Changelog changelog = parser.parse(file);
file = new File(DEFAULT_OUTPUT);
FileWriter writer = new FileWriter(file);
xmlContext.setProperty(XMLConfiguration.USE_INDENTATION, true);
Marshaller marshaller = xmlContext.createMarshaller();
marshaller.setWriter(writer);
marshaller.setRootElement("changelog");
marshaller.setSuppressXSIType(true);
marshaller.marshal(changelog);
}
catch(Exception ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: axis/axis
localPart = localPart.substring(0, arrayDims);
marshaller.setRootElement(localPart);
代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis
localPart = localPart.substring(0, arrayDims);
marshaller.setRootElement(localPart);
代码示例来源:origin: org.apache.axis/axis
localPart = localPart.substring(0, arrayDims);
marshaller.setRootElement(localPart);
代码示例来源:origin: org.codehaus.xfire/xfire-castor
marshaller.setRootElement(part.getName().getLocalPart());
if (mapping != null)
代码示例来源:origin: apache/servicemix-bundles
/**
* Template method that allows for customizing of the given Castor {@link Marshaller}.
*/
protected void customizeMarshaller(Marshaller marshaller) {
marshaller.setValidation(this.validating);
marshaller.setSuppressNamespaces(this.suppressNamespaces);
marshaller.setSuppressXSIType(this.suppressXsiType);
marshaller.setMarshalAsDocument(this.marshalAsDocument);
marshaller.setMarshalExtendedType(this.marshalExtendedType);
marshaller.setRootElement(this.rootElement);
marshaller.setNoNamespaceSchemaLocation(this.noNamespaceSchemaLocation);
marshaller.setSchemaLocation(this.schemaLocation);
marshaller.setUseXSITypeAtRoot(this.useXSITypeAtRoot);
if (this.doctypes != null) {
this.doctypes.forEach(marshaller::setDoctype);
}
if (this.processingInstructions != null) {
this.processingInstructions.forEach(marshaller::addProcessingInstruction);
}
if (this.namespaceMappings != null) {
this.namespaceMappings.forEach(marshaller::setNamespaceMapping);
}
}
内容来源于网络,如有侵权,请联系作者删除!