This package defines the MXL Schema Instance table model. The following figure shows a diagram of the table model with its 3 levels of information :
  1. Entity (ITable)

    Information specific to an element or attribute. This data is managed in the MxsdEntityTable.

  2. Type (ITable)

    Information specific to an XSD simple or complex type. This data is managed in the MxsdTypeTable.

  3. Content (DFA)

    The structured content of a type is stored as a "deterministic finite automaton" or DFA data structure, defined in package com.ibm.etools.mft.builder.xsd.dfa. The DFA itself is stored as a column in the MxsdTypeTable.

MxsdEntityTable

Entity information includes:

MxsdTypeTable

Type information includes:

Example queries

Find all members of a substitution group in a message set

This example code would be provided as an service API on class MxsdCachePlugin.
	//Input to the query provided by the application
	MxsdEntityTable featureTable = XSIModelPlugin.getDefault().getMSetCacheSchema().getMxsdFeatureTable();
	String msetName, namespace, elementLocalName;
	
	//Prepare the instruments of searching
	MxsdTypeTable typeTable = XSIModelPlugin.getDefault().getMSetCacheSchema().getMxsdTypeTable();
	ISearchPath searchPath = new MessagingSearchPath();
	searchPath.setContextResource(resource);
	
	//Query the substituting column of the table
	String [] where = new String[] { 
		XsiTableModelConstants.MSET_NAME_COLUMN_NAME,
		XsiTableModelConstants.SUBSTITUTION_GROUP_NAME_COLUMN_NAME,
		XsiTableModelConstants.SUBSTITUTION_GROUP_NAMESPACE_COLUMN_NAME,		 
	};
	
	//First value parameter is the msetName; this is indexed.
	//Use a QName constructed from the namespace and localName;
	//the application needs to convert QName prefix to namespace.
	//The type of the substition group column is QName, so this uses the index and is 
	//at worst O(ln N); i.e. better than linear scalability in time
	Object [] value = new Object[] {
		msetName,
		elementLocalName,
		namespace
	};
	
	//Execute the query
	IRow [] substitutingElements = featureTable.selectRowsWithSearchPath(where,value,searchPath);
	
	//Get some values from the row...
	substitutingElements[idx].getColumnValue(featureTable.ENTITY_NAME_COLUMN);
	substitutingElements[idx].getColumnValue(featureTable.ENTITY_NAMESPACE_COLUMN);

Find all extensions of a type in a message set, including local types

This example code would be provided as a service API on class MxsdCachePlugin.
	//Input to the query provided by the application
	String msetName, namespace, typeLocalName;
	IFile resource;

	//Prepare the instruments of searching
	MxsdTypeTable typeTable = XSIModelPlugin.getDefault().getMSetCacheSchema().getMxsdTypeTable();
	ISearchPath searchPath = new MessagingSearchPath();
	searchPath.setContextResource(resource);
	
	//Query the substituting column of the table
	String [] where = new String[] { 
		XsiTableModelConstants.MSET_NAME_COLUMN_NAME,
		XsiTableModelConstants.DERIVATION_KIND_COLUMN_NAME,
		XsiTableModelConstants.BASE_TYPE_NAME_COLUMN_NAME,
		XsiTableModelConstants.BASE_TYPE_NAMESPACE_COLUMN_NAME 
	};
	
	//- First value parameter is the msetName; this is indexed.
	//- Second parameter is the derivation kind, either MSetCacheConstants.EXTENSION 
	//  or MSetCacheConstants.RESTRICTION is allowed; to select both extensions or
	//  restrictions ignore the column in the query.
	//- Third and fourth parameters are the QName constructed from the base type namespace and 
	//  localName.
	//  The type of the substition group column is QName, so this uses the index and is 
	//  at worst O(ln N); i.e. better than linear scalability in time
	Object [] value = new Object[] {
		msetName,
		MSetCacheConstants.EXTENSION,
		elementLocalName,
		namespace
	};
	
	//Since each query will return only the immediate child types, use a stack to
	//recursively visit each child types's children.
	Map allRows = new HashSet();
	Stack traverseStack = new Stack();
	traverseStack.push(value[2]);
	
	//Recursively execute the query
	while(!traverseStack.isEmpty()) {
		
		//Set up the query with the next QName to search
		value[2] = traverseStack.pop();
		
		IRow [] extensionTypes = typeTable.selectRows(where,value);
		
		for(int i=0; i<extensionTypes.length; i++) {
			Object qName = extensionTypes.getColumnValue(typeTable.QNAME_COLUMN);
			if(allRows.containsKey(qName)) continue;
			
			traverseStack.push(qName);
			allRows.put(qName,extensionTypes[i]);
		}
	}
	
	//Convert allRows to an array called 
	Set allRowSet = allRows.values();
	IRow [] result = new IRow[allRowSet.size()];
	allRowSet.toArray(result);
	
	//Result is all the IRows for extensions to the type of the original Qname, 
	//including the original type itself.
	

Package Specification