org.exolab.castor.xml.Marshaller.setRootElement()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中org.exolab.castor.xml.Marshaller.setRootElement()方法的一些代码示例,展示了Marshaller.setRootElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marshaller.setRootElement()方法的具体详情如下:
包路径:org.exolab.castor.xml.Marshaller
类名称:Marshaller
方法名:setRootElement

Marshaller.setRootElement介绍

[英]Sets the name of the root element to use.
[中]设置要使用的根元素的名称。

代码示例

代码示例来源:origin: org.codehaus.castor/castor-xml

  1. public static void main(String[] args) {
  2. // TODO: add CommandLineOptions
  3. // options needed
  4. // 1. filename/path of CHANGELOG
  5. // 2. mapping file for customization
  6. // 3. output file name
  7. XMLContext xmlContext = new XMLContext();
  8. ChangeLog2XML parser = xmlContext.createChangeLog2XML();
  9. try {
  10. File file = new File(DEFAULT_FILE);
  11. Changelog changelog = parser.parse(file);
  12. file = new File(DEFAULT_OUTPUT);
  13. FileWriter writer = new FileWriter(file);
  14. xmlContext.setProperty(XMLProperties.USE_INDENTATION, true);
  15. Marshaller marshaller = xmlContext.createMarshaller();
  16. marshaller.setWriter(writer);
  17. marshaller.setRootElement("changelog");
  18. marshaller.setSuppressXSIType(true);
  19. marshaller.marshal(changelog);
  20. } catch (Exception ex) {
  21. ex.printStackTrace();
  22. }
  23. }

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

  1. public static void main(String[] args) {
  2. //TODO: add CommandLineOptions
  3. // options needed
  4. // 1. filename/path of CHANGELOG
  5. // 2. mapping file for customization
  6. // 3. output file name
  7. XMLContext xmlContext = new XMLContext();
  8. ChangeLog2XML parser = xmlContext.createChangeLog2XML();
  9. try {
  10. File file = new File(DEFAULT_FILE);
  11. Changelog changelog = parser.parse(file);
  12. file = new File(DEFAULT_OUTPUT);
  13. FileWriter writer = new FileWriter(file);
  14. xmlContext.setProperty(XMLConfiguration.USE_INDENTATION, true);
  15. Marshaller marshaller = xmlContext.createMarshaller();
  16. marshaller.setWriter(writer);
  17. marshaller.setRootElement("changelog");
  18. marshaller.setSuppressXSIType(true);
  19. marshaller.marshal(changelog);
  20. }
  21. catch(Exception ex) {
  22. ex.printStackTrace();
  23. }
  24. }

代码示例来源:origin: axis/axis

  1. localPart = localPart.substring(0, arrayDims);
  2. marshaller.setRootElement(localPart);

代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis

  1. localPart = localPart.substring(0, arrayDims);
  2. marshaller.setRootElement(localPart);

代码示例来源:origin: org.apache.axis/axis

  1. localPart = localPart.substring(0, arrayDims);
  2. marshaller.setRootElement(localPart);

代码示例来源:origin: org.codehaus.xfire/xfire-castor

  1. marshaller.setRootElement(part.getName().getLocalPart());
  2. if (mapping != null)

代码示例来源:origin: apache/servicemix-bundles

  1. /**
  2. * Template method that allows for customizing of the given Castor {@link Marshaller}.
  3. */
  4. protected void customizeMarshaller(Marshaller marshaller) {
  5. marshaller.setValidation(this.validating);
  6. marshaller.setSuppressNamespaces(this.suppressNamespaces);
  7. marshaller.setSuppressXSIType(this.suppressXsiType);
  8. marshaller.setMarshalAsDocument(this.marshalAsDocument);
  9. marshaller.setMarshalExtendedType(this.marshalExtendedType);
  10. marshaller.setRootElement(this.rootElement);
  11. marshaller.setNoNamespaceSchemaLocation(this.noNamespaceSchemaLocation);
  12. marshaller.setSchemaLocation(this.schemaLocation);
  13. marshaller.setUseXSITypeAtRoot(this.useXSITypeAtRoot);
  14. if (this.doctypes != null) {
  15. this.doctypes.forEach(marshaller::setDoctype);
  16. }
  17. if (this.processingInstructions != null) {
  18. this.processingInstructions.forEach(marshaller::addProcessingInstruction);
  19. }
  20. if (this.namespaceMappings != null) {
  21. this.namespaceMappings.forEach(marshaller::setNamespaceMapping);
  22. }
  23. }

相关文章