com.aspose.words
Class CustomXmlPropertyCollection
java.lang.Object
com.aspose.words.CustomXmlPropertyCollection
- All Implemented Interfaces:
- java.lang.Iterable
public class CustomXmlPropertyCollection
- extends java.lang.Object
Represents a collection of custom XML attributes or smart tag properties.
Items are CustomXmlProperty objects.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
Property Getters/Setters Summary |
int | getCount() | |
|
Gets the number of elements contained in the collection.
|
CustomXmlProperty | get(int index) | |
|
Gets a property at the specified index.
|
CustomXmlProperty | get(java.lang.String name) | |
|
Gets a property with the specified name.
|
Method Summary |
void | add(CustomXmlProperty property) | |
Adds a property to the collection.
|
void | clear() | |
Removes all elements from the collection.
|
boolean | contains(java.lang.String name) | |
Determines whether the collection contains a property with the given name.
|
int | indexOfKey(java.lang.String name) | |
Returns the zero-based index of the specified property in the collection.
|
java.util.Iterator<CustomXmlProperty> | iterator() | |
Returns an iterator object that can be used to iterate over all items in the collection.
|
void | remove(java.lang.String name) | |
Removes a property with the specified name from the collection.
|
void | removeAt(int index) | |
Removes a property at the specified index.
|
Property Getters/Setters Detail |
getCount | |
public int getCount()
|
-
Gets the number of elements contained in the collection.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
-
Gets a property at the specified index.
- Parameters:
index
- Zero-based index of the property.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
-
Gets a property with the specified name.
- Parameters:
name
- Case-sensitive name of the property to locate.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
-
Adds a property to the collection.
- Parameters:
property
- The property to add.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
clear | |
public void clear() |
-
Removes all elements from the collection.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
contains | |
public boolean contains(java.lang.String name) |
-
Determines whether the collection contains a property with the given name.
- Parameters:
name
- Case-sensitive name of the property to locate.
- Returns:
- True if the item is found in the collection; otherwise, false.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
indexOfKey | |
public int indexOfKey(java.lang.String name) |
-
Returns the zero-based index of the specified property in the collection.
- Parameters:
name
- The case-sensitive name of the property.
- Returns:
- The zero based index. Negative value if not found.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
-
Returns an iterator object that can be used to iterate over all items in the collection.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
remove | |
public void remove(java.lang.String name) |
-
Removes a property with the specified name from the collection.
- Parameters:
name
- The case-sensitive name of the property.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
removeAt | |
public void removeAt(int index) |
-
Removes a property at the specified index.
- Parameters:
index
- The zero based index.
Example:
Shows how to work with smart tag properties to get in depth information about smart tags.
Document doc = new Document(getMyDir() + "Smart tags.doc");
// A smart tag appears in a document with Microsoft Word recognizes a part of its text as some form of data,
// such as a name, date, or address, and converts it to a hyperlink that displays a purple dotted underline.
// In Word 2003, we can enable smart tags via "Tools" -> "AutoCorrect options..." -> "SmartTags".
// In our input document, there are three objects that Microsoft Word registered as smart tags.
// Smart tags may be nested, so this collection contains more.
List<SmartTag> smartTags = Arrays.stream(doc.getChildNodes(NodeType.SMART_TAG, true).toArray())
.filter(SmartTag.class::isInstance)
.map(SmartTag.class::cast)
.collect(Collectors.toList());
Assert.assertEquals(8, smartTags.size());
// The "Properties" member of a smart tag contains its metadata, which will be different for each type of smart tag.
// The properties of a "date"-type smart tag contain its year, month, and day.
CustomXmlPropertyCollection properties = smartTags.get(7).getProperties();
Assert.assertEquals(4, properties.getCount());
Iterator<CustomXmlProperty> enumerator = properties.iterator();
while (enumerator.hasNext()) {
CustomXmlProperty customXmlProperty = enumerator.next();
System.out.println(MessageFormat.format("Property name: {0}, value: {1}", customXmlProperty.getName(), customXmlProperty.getValue()));
Assert.assertEquals("", enumerator.next().getUri());
}
// We can also access the properties in various ways, such as a key-value pair.
Assert.assertTrue(properties.contains("Day"));
Assert.assertEquals("22", properties.get("Day").getValue());
Assert.assertEquals("2003", properties.get(2).getValue());
Assert.assertEquals(1, properties.indexOfKey("Month"));
// Below are three ways of removing elements from the properties collection.
// 1 - Remove by index:
properties.removeAt(3);
Assert.assertEquals(3, properties.getCount());
// 2 - Remove by name:
properties.remove("Year");
Assert.assertEquals(2, properties.getCount());
// 3 - Clear the entire collection at once:
properties.clear();
Assert.assertEquals(0, properties.getCount());
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.