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

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

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

Marshaller.setMarshalAsDocument介绍

[英]Sets whether or not to marshal as a document which includes the XML declaration, and if necessary the DOCTYPE declaration. By default the Marshaller will marshal as a well formed XML document including the XML Declaration. If the given boolean is false, the Marshaller will marshal as a well formed XML fragment (no XML declaration or DOCTYPE). This method is basically the same as calling #setSupressXMLDeclaration(true);
[中]设置是否封送为包含XML声明的文档,必要时还设置DOCTYPE声明。默认情况下,封送器将封送为格式良好的XML文档,包括XML声明。如果给定的布尔值为false,封送器将封送为格式良好的XML片段(无XML声明或DOCTYPE)。该方法基本上与调用#setUppressXmlDeclaration(true)相同;

代码示例

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

/**
 * Sets whether or not to marshal as a document which includes the XML declaration, and if
 * necessary the DOCTYPE declaration. By default the Marshaller will marshal as a well formed XML
 * document including the XML Declaration.
 *
 * If the given boolean is true, the Marshaller will marshal as a well formed XML fragment (no XML
 * declaration or DOCTYPE).
 *
 * This method is basically the same as calling #setMarshalAsDocument(false);
 *
 * @param supressXMLDeclaration a boolean that when true includes that generated XML should not
 *        contain the XML declaration.
 * @see #setMarshalAsDocument
 */
public void setSupressXMLDeclaration(boolean supressXMLDeclaration) {
 setMarshalAsDocument(!supressXMLDeclaration);
} // -- setSupressXMLDeclaration

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

/**
 * Sets whether or not to marshal as a document which includes
 * the XML declaration, and if necessary the DOCTYPE declaration.
 * By default the Marshaller will marshal as a well formed
 * XML document including the XML Declaration.
 *
 * If the given boolean is true, the Marshaller will marshal
 * as a well formed XML fragment (no XML declaration or DOCTYPE).
 *
 * This method is basically the same as calling
 * #setMarshalAsDocument(false);
 *
 * @param supressXMLDeclaration a boolean that when true
 * includes that generated XML should not contain
 * the XML declaration.
 * @see #setMarshalAsDocument
 */
public void setSupressXMLDeclaration(boolean supressXMLDeclaration) {
  setMarshalAsDocument(!supressXMLDeclaration);
} //-- setSupressXMLDeclaration

代码示例来源:origin: com.github.muff1nman.chameleon/core

/**
 * Writes the specified object as an XML stream to an output writer.
 * @param o the object to serialize.
 * @param out the writer.
 * @param asDocument if <code>true</code>, indicates to marshal as a complete XML document, which includes the XML declaration, and if necessary the DOCTYPE declaration.
 * @throws MappingException an exception indicating an invalid mapping error.
 * @throws org.exolab.castor.xml.MarshalException a marshalling exception.
 * @throws org.exolab.castor.xml.ValidationException an XML validation error occurred.
 * @throws NullPointerException if <code>o</code> is <code>null</code>.
 * @throws NullPointerException if <code>out</code> is <code>null</code>.
 * @see Mapping
 */
public void marshal(final Object o, final Writer out, final boolean asDocument) throws Exception
{
  synchronized(_marshaller)
  {
    _marshaller.setWriter(out); // May throw IOException.
    _marshaller.setMarshalAsDocument(asDocument);
    _marshaller.setEncoding("ISO-8859-1");
    // Do not use marshal(Object object, Writer out): IT DOESN'T WORK !!!
    _marshaller.marshal(o); // May throw MarshalException, ValidationException.
  }
}

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

marshaller.setMarshalAsDocument(false);
String localPart = name.getLocalPart();
int arrayDims = localPart.indexOf('[');

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

marshaller.setMarshalAsDocument(false);
String localPart = name.getLocalPart();
int arrayDims = localPart.indexOf('[');

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

marshaller.setMarshalAsDocument(false);
String localPart = name.getLocalPart();
int arrayDims = localPart.indexOf('[');

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

相关文章