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

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

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

Marshaller.setSuppressXSIType介绍

[英]Sets whether or not the xsi:type attribute should appear on the marshalled document.
[中]设置xsi:type属性是否应出现在封送的文档上。

代码示例

代码示例来源:origin: stackoverflow.com

  1. Marshaller marshaller = new Marshaller(w);
  2. marshaller.setSuppressXSIType(true);

代码示例来源:origin: org.springframework.ws/spring-oxm

  1. /**
  2. * Template method that allows for customizing of the given Castor {@link Marshaller}.
  3. * <p/>
  4. * Default implementation invokes {@link Marshaller#setValidation(boolean)} with the property set on this
  5. * marshaller, and calls {@link Marshaller#setNamespaceMapping(String, String)} with the {@linkplain
  6. * #setNamespaceMappings(java.util.Properties) namespace mappings}.
  7. */
  8. protected void customizeMarshaller(Marshaller marshaller) {
  9. marshaller.setValidation(isValidating());
  10. marshaller.setSuppressNamespaces(isSuppressNamespaces());
  11. marshaller.setSuppressXSIType(isSuppressXsiType());
  12. Properties namespaceMappings = getNamespaceMappings();
  13. if (namespaceMappings != null) {
  14. for (Iterator iterator = namespaceMappings.keySet().iterator(); iterator.hasNext();) {
  15. String prefix = (String) iterator.next();
  16. String uri = namespaceMappings.getProperty(prefix);
  17. marshaller.setNamespaceMapping(prefix, uri);
  18. }
  19. }
  20. }

代码示例来源: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: 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. }

相关文章