com.aspose.words
Class CustomXmlPart

java.lang.Object
    extended by com.aspose.words.CustomXmlPart
All Implemented Interfaces:
java.lang.Cloneable

public class CustomXmlPart 
extends java.lang.Object

Represents a Custom XML Data Storage Part (custom XML data within a package).

A DOCX or DOC document can contain one or more Custom XML Data Storage parts. Aspose.Words preserves and allows to create and extract Custom XML Data via the Document.CustomXmlParts collection.

Example:

Shows how to create structured document tag with a custom XML data.
Document doc = new Document();
// Add test XML data part to the collection.
CustomXmlPart xmlPart = doc.getCustomXmlParts().add(UUID.randomUUID().toString(), "<root><text>Hello, World!</text></root>");

StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.PLAIN_TEXT, MarkupLevel.BLOCK);
sdt.getXmlMapping().setMapping(xmlPart, "/root[1]/text[1]", "");

doc.getFirstSection().getBody().appendChild(sdt);

doc.save(getArtifactsDir() + "SDT.CustomXml.docx");
See Also:
Document.CustomXmlParts, CustomXmlPartCollection

Constructor Summary
CustomXmlPart()
          
 
Property Getters/Setters Summary
byte[]getData()
voidsetData(byte[] value)
           Gets or sets the XML content of this Custom XML Data Storage Part.
java.lang.StringgetId()
voidsetId(java.lang.String value)
           Gets or sets the string that identifies this custom XML part within an OOXML document.
CustomXmlSchemaCollectiongetSchemas()
           Specifies the set of XML schemas that are associated with this custom XML part.
 
Method Summary
CustomXmlPartdeepClone()
           Makes a "deep enough" copy of the object. Does not duplicate the bytes of the Data value.
 

Constructor Detail

CustomXmlPart

public CustomXmlPart()

Property Getters/Setters Detail

getData/setData

public byte[] getData() / public void setData(byte[] value)
Gets or sets the XML content of this Custom XML Data Storage Part.

The default value is an empty byte array. The value cannot be null.


getId/setId

public java.lang.String getId() / public void setId(java.lang.String value)
Gets or sets the string that identifies this custom XML part within an OOXML document.

ISO/IEC 29500 specifies that this value is a GUID, but old versions of Microsoft Word allowed any string here. Aspose.Words does the same for ECMA-376 format. But note, that Microsoft Word Online fails to open a document created with a non-GUID value. So, a GUID is preferred value for this property.

A valid value must be an identifier that is unique among all custom XML data parts in this document.

The default value is an empty string. The value cannot be null.


getSchemas

public CustomXmlSchemaCollection getSchemas()
Specifies the set of XML schemas that are associated with this custom XML part.

Method Detail

deepClone

public CustomXmlPart deepClone()
Makes a "deep enough" copy of the object. Does not duplicate the bytes of the Data value.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.