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

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

本文整理了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

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

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

/**
 * Template method that allows for customizing of the given Castor {@link Marshaller}.
 * <p/>
 * Default implementation invokes {@link Marshaller#setValidation(boolean)} with the property set on this
 * marshaller, and calls {@link Marshaller#setNamespaceMapping(String, String)} with the {@linkplain
 * #setNamespaceMappings(java.util.Properties) namespace mappings}.
 */
protected void customizeMarshaller(Marshaller marshaller) {
  marshaller.setValidation(isValidating());
  marshaller.setSuppressNamespaces(isSuppressNamespaces());
  marshaller.setSuppressXSIType(isSuppressXsiType());
  Properties namespaceMappings = getNamespaceMappings();
  if (namespaceMappings != null) {
    for (Iterator iterator = namespaceMappings.keySet().iterator(); iterator.hasNext();) {
      String prefix = (String) iterator.next();
      String uri = namespaceMappings.getProperty(prefix);
      marshaller.setNamespaceMapping(prefix, uri);
    }
  }
}

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

相关文章