Using collections to organize a docbase

How to create collections. How to store and retrieve documents in collections.

Your program must be connected to a docbase, and your program must have an IxiaDocBaseServices object for that docbase:
IxiaDocBaseServices docbase =   // ...

Documents stored in document bases are kept in the repository, in which they can be grouped and organized hierarchically, in a tree-like structure, as they would be in a Windows or Linux file system.

Each node of the tree is called a collection. Collections are containers for documents and other collections.

The root collection is the repository itself: the repository can contain collections and documents that are not in collections.

In TEXTML Console (a management application delivered as part of TEXTML Server), collections are displayed graphically much like the directories (folders) in the Windows file system.

To create collections in a document base:

  1. Get an IxiaCollectionServices object from the IxiaDocbaseServices object.
    IxiaCollectionServices provides access to the services for managing collections in the document base.
    IxiaCollectionServices CollectionSrv = dss.CollectionServices(); 
  2. Create each collection (an IxiaCollection object) with the CreateCollection() method of the IxiaCollectionServices object.
    // collectionName is a String object
    IxiaCollection Collection1 =
    Here are the options:
    • COLLECTION_CREATION_MODE_CREATE_NEW: Creates a new collection and returns it.
    • COLLECTION_CREATION_MODE_CREATE_ALWAYS: Returns the collection if it exists; otherwise, creates a new collection and returns it.
    • COLLECTION_CREATION_MODE_OPEN_EXISTING: Returns the collection if it exists; otherwise, throws a TextmlserverError exception.
    Newly created collections are empty.
  3. Adding documents to a collection. When setting a document's properties in preparation to adding the document to a docbase, specify the name of the collection. If the collection is contained in a higher-level collection, specify the collection name as a path:
    When the document is added to the docbase (by a call to IxiaDocumentServices.setDocuments()), it will automatically be added to the specified collection.
    Note: To separate collection names in a path, always use "/", the forward slash key.
  4. Retrieving a document by its name and collection. Specify the document's collection path in the same string as its name:
    String [] documents = new String[1];
    String documentName = "/news/entertainment/film/review1001.xml";
    documents[0] = documentName;
    IxiaDocumentServices.Result [] result =
        ds.GetDocuments(documents,       // <ds> is an IxiaDocumentServices object
            Constants.TEXTML_DOCUMENT_CONTENT |

You can easily modify sample program SetDocuments to add documents to a specified collection in the specified docbase:


To use sample program GetDocument to get a document that is in a collection, you do not need to change the program. When you run GetDocument, specify the collection path as part of the document name:

getdocument user=domain\user password=yourpass docbase=test server=localhost «
            path=c:\Temp\   docname=news/entertainment/film/review1001.xml

Do not confuse the directory path of document files on disk with the collection path of documents in a docbase. In the above command:

  • docname=news/entertainment/film/review1001.xml is the collection path and document name of a document in docbase test .
  • path=c:\Temp\ is the location on disk where the document will be saved. (The separator is a backslash ("/") because the file system, in this example, is Windows. For Linux, use a forward slash ("/") as you would normally.)