java.lang.Objectcom.aspose.words.CustomXmlPart
public class CustomXmlPart
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 Example:
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");
Constructor Summary |
---|
CustomXmlPart()
|
Property Getters/Setters Summary | ||
---|---|---|
byte[] | getData() | |
void | setData(byte[] value) | |
Gets or sets the XML content of this Custom XML Data Storage Part. | ||
java.lang.String | getId() | |
void | setId(java.lang.String value) | |
Gets or sets the string that identifies this custom XML part within an OOXML document. | ||
CustomXmlSchemaCollection | getSchemas() | |
Specifies the set of XML schemas that are associated with this custom XML part. |
Method Summary | ||
---|---|---|
CustomXmlPart | deepClone() | |
Makes a "deep enough" copy of the object.
Does not duplicate the bytes of the |
Constructor Detail |
---|
public CustomXmlPart()
Property Getters/Setters Detail |
---|
getData/setData | |
public byte[] getData() / public void setData(byte[] value) |
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) |
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() |
Method Detail |
---|
deepClone | |
public CustomXmlPart deepClone() |