Aspose::Words::Markup::CustomXmlSchemaCollection Class Reference

Detailed Description

A collection of strings that represent XML schemas that are associated with a custom XML part.

You do not create instances of this class. You access the collection of XML schemas of a custom XML part via the Schemas property.

See also
Aspose::Words::Markup::CustomXmlPart
Aspose::Words::Markup::CustomXmlPart::get_Schemas
Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

#include <Aspose.Words.Cpp/Markup/CustomXmlSchemaCollection.h>

+ Inheritance diagram for Aspose::Words::Markup::CustomXmlSchemaCollection:

Public Types

using const_iterator = typename const_iterator
 
using iterator = typename iterator
 
using iterator_holder_type = List< String >
 

Public Member Functions

void Add (String value)
 Adds an item to the collection. More...
 
const_iterator begin () const noexcept
 
iterator begin () noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
void Clear ()
 Removes all elements from the collection. More...
 
SharedPtr< CustomXmlSchemaCollectionClone ()
 Makes a deep clone of this object. More...
 
const_iterator end () const noexcept
 
iterator end () noexcept
 
int32_t get_Count ()
 Gets the number of elements contained in the collection. More...
 
SharedPtr< IEnumerator< String > > GetEnumerator () override
 Returns an enumerator object that can be used to iterate over all items in the collection. More...
 
virtual const TypeInfoGetType () const override
 
String idx_get (int32_t index)
 Gets or sets the element at the specified index. More...
 
void idx_set (int32_t index, String value)
 Gets or sets the element at the specified index. More...
 
int32_t IndexOf (String value)
 Returns the zero-based index of the specified value in the collection. More...
 
virtual bool Is (const TypeInfo &target) const override
 
void Remove (String name)
 Removes the specified value from the collection. More...
 
void RemoveAt (int32_t index)
 Removes a value at the specified index. More...
 

Static Public Member Functions

static const TypeInfoType ()
 

Member Typedef Documentation

◆ const_iterator

◆ iterator

◆ iterator_holder_type

Member Function Documentation

◆ Add()

void Aspose::Words::Markup::CustomXmlSchemaCollection::Add ( System::String  value)

Adds an item to the collection.

Parameters
valueThe item to add.
Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ begin() [1/2]

const_iterator Aspose::Words::Markup::CustomXmlSchemaCollection::begin ( ) const
noexcept

◆ begin() [2/2]

iterator Aspose::Words::Markup::CustomXmlSchemaCollection::begin ( )
noexcept

◆ cbegin()

const_iterator Aspose::Words::Markup::CustomXmlSchemaCollection::cbegin ( ) const
noexcept

◆ cend()

const_iterator Aspose::Words::Markup::CustomXmlSchemaCollection::cend ( ) const
noexcept

◆ Clear()

void Aspose::Words::Markup::CustomXmlSchemaCollection::Clear ( )

Removes all elements from the collection.

Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ Clone()

System::SharedPtr<Aspose::Words::Markup::CustomXmlSchemaCollection> Aspose::Words::Markup::CustomXmlSchemaCollection::Clone ( )

Makes a deep clone of this object.

Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ end() [1/2]

const_iterator Aspose::Words::Markup::CustomXmlSchemaCollection::end ( ) const
noexcept

◆ end() [2/2]

iterator Aspose::Words::Markup::CustomXmlSchemaCollection::end ( )
noexcept

◆ get_Count()

int32_t Aspose::Words::Markup::CustomXmlSchemaCollection::get_Count ( )

Gets the number of elements contained in the collection.

Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ GetEnumerator()

System::SharedPtr<System::Collections::Generic::IEnumerator<System::String> > Aspose::Words::Markup::CustomXmlSchemaCollection::GetEnumerator ( )
overridevirtual

Returns an enumerator object that can be used to iterate over all items in the collection.

Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

Implements System::Collections::Generic::IEnumerable< class >.

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Markup::CustomXmlSchemaCollection::GetType ( ) const
overridevirtual

Reimplemented from System::Object.

◆ idx_get()

System::String Aspose::Words::Markup::CustomXmlSchemaCollection::idx_get ( int32_t  index)

Gets or sets the element at the specified index.

Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ idx_set()

void Aspose::Words::Markup::CustomXmlSchemaCollection::idx_set ( int32_t  index,
System::String  value 
)

Gets or sets the element at the specified index.

Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ IndexOf()

int32_t Aspose::Words::Markup::CustomXmlSchemaCollection::IndexOf ( System::String  value)

Returns the zero-based index of the specified value in the collection.

Parameters
valueThe case-sensitive value to locate.
Returns
The zero based index. Negative value if not found.
Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ Is()

virtual bool Aspose::Words::Markup::CustomXmlSchemaCollection::Is ( const System::TypeInfo target) const
overridevirtual

Reimplemented from System::Object.

◆ Remove()

void Aspose::Words::Markup::CustomXmlSchemaCollection::Remove ( System::String  name)

Removes the specified value from the collection.

Parameters
nameThe case-sensitive value to remove.
Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ RemoveAt()

void Aspose::Words::Markup::CustomXmlSchemaCollection::RemoveAt ( int32_t  index)

Removes a value at the specified index.

Parameters
indexThe zero based index.
Examples

Shows how to work with an XML schema collection.

auto doc = MakeObject<Document>();
String xmlPartId = System::Guid::NewGuid().ToString(u"B");
String xmlPartContent = u"<root><text>Hello, World!</text></root>";
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// Add an XML schema association.
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// Clone the custom XML part's XML schema association collection,
// and then add a couple of new schemas to the clone.
SharedPtr<CustomXmlSchemaCollection> schemas = xmlPart->get_Schemas()->Clone();
schemas->Add(u"http://www.w3.org/2001/XMLSchema-instance");
schemas->Add(u"http://schemas.microsoft.com/office/2006/metadata/contentType");
ASSERT_EQ(3, schemas->get_Count());
ASSERT_EQ(2, schemas->IndexOf(u"http://schemas.microsoft.com/office/2006/metadata/contentType"));
// Enumerate the schemas and print each element.
{
SharedPtr<System::Collections::Generic::IEnumerator<String>> enumerator = schemas->GetEnumerator();
while (enumerator->MoveNext())
{
std::cout << enumerator->get_Current() << std::endl;
}
}
// Below are three ways of removing schemas from the collection.
// 1 - Remove a schema by index:
schemas->RemoveAt(2);
// 2 - Remove a schema by value:
schemas->Remove(u"http://www.w3.org/2001/XMLSchema");
// 3 - Use the "Clear" method to empty the collection at once.
schemas->Clear();
ASSERT_EQ(0, schemas->get_Count());

◆ Type()

static const System::TypeInfo& Aspose::Words::Markup::CustomXmlSchemaCollection::Type ( )
static