java.lang.Object
com.aspose.words.CustomXmlPartCollection
public class CustomXmlPartCollection
You do not normally need to create instances of this class. You can access custom XML data
stored in a document via the
| Constructor Summary |
|---|
CustomXmlPartCollection()
|
| Property Getters/Setters Summary | ||
|---|---|---|
int | getCount() | |
| Gets the number of elements contained in the collection. | ||
CustomXmlPart | get(int index) | |
void | set(int index, CustomXmlPart value) | |
| Gets or sets an item at the specified index. | ||
| Method Summary | ||
|---|---|---|
void | add(CustomXmlPart part) | |
| Adds an item to the collection. | ||
CustomXmlPart | add(java.lang.String id, java.lang.String xml) | |
| Creates a new XML part with the specified XML and adds it to the collection. | ||
void | clear() | |
| Removes all elements from the collection. | ||
CustomXmlPartCollection | deepClone() | |
| Makes a deep copy of this collection and its items. | ||
CustomXmlPart | getById(java.lang.String id) | |
| Finds and returns a custom XML part by its identifier. | ||
java.util.Iterator<CustomXmlPart> | iterator() | |
| Returns an iterator object that can be used to iterate over all items in the collection. | ||
void | removeAt(int index) | |
| Removes an item at the specified index. | ||
| Constructor Detail |
|---|
public CustomXmlPartCollection()
| Property Getters/Setters Detail |
|---|
getCount | |
public int getCount() | |
get/set | |
public CustomXmlPart get(int index) / public void set(int index, CustomXmlPart value) | |
index - Zero-based index of the item.| Method Detail |
|---|
add | |
public void add(CustomXmlPart part) | |
part - The custom XML part to add.add | |
public CustomXmlPart add(java.lang.String id, java.lang.String xml) | |
id - Identifier of a new custom XML part.xml - XML data of the part.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(getMyDir() + "\\Artifacts\\SDT.CustomXml.docx");
clear | |
public void clear() | |
deepClone | |
public CustomXmlPartCollection deepClone() | |
getById | |
public CustomXmlPart getById(java.lang.String id) | |
id - Case-sensitive string that identifies the custom XML part.null if a custom XML part with the specified identifier is not found.iterator | |
public java.util.Iterator<CustomXmlPart> iterator() | |
removeAt | |
public void removeAt(int index) | |
index - The zero based index.