com.limegroup.gnutella.xml
Class LimeXMLSchema

java.lang.Object
  extended bycom.limegroup.gnutella.xml.LimeXMLSchema

public class LimeXMLSchema
extends java.lang.Object

Stores a XML schema, and provides access to various components of schema


Constructor Summary
LimeXMLSchema(java.io.File schemaFile)
          Creates new LimeXMLSchema
LimeXMLSchema(org.xml.sax.InputSource inputSource)
          Creates new LimeXMLSchema
 
Method Summary
 java.lang.String[] getCanonicalizedFieldNames()
          Returns all the fields(placeholders) names in this schema.
 java.util.List getCanonicalizedFields()
          Returns all the fields(placeholders) in this schema.
 java.util.Map getDefaultFieldEnumerativeValueMap()
          Returns Mapping from FieldName => (EnumerativeValue => Mapped Value) (String ==> Map (String => String))
static java.lang.String getDisplayString(java.lang.String schemaURI)
          Utility method to be used in the gui to display schemas
 java.util.List getEnumerationFields()
          Returns only those fields which are of enumeration type
 java.lang.String getSchemaURI()
          Returns the unique identifier which identifies this particular schema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LimeXMLSchema

public LimeXMLSchema(java.io.File schemaFile)
              throws java.io.IOException
Creates new LimeXMLSchema

Parameters:
schemaFile - The filefrom where to read the schema definition
Throws:
java.io.IOException - If the specified schemaFile doesnt exist, or isnt a valid schema file

LimeXMLSchema

public LimeXMLSchema(org.xml.sax.InputSource inputSource)
              throws java.io.IOException
Creates new LimeXMLSchema

Parameters:
inputSource - The source representing the XML schema definition to be parsed
Throws:
java.io.IOException - If the specified schemaFile doesnt exist, or isnt a valid schema file
Method Detail

getSchemaURI

public java.lang.String getSchemaURI()
Returns the unique identifier which identifies this particular schema

Returns:
the unique identifier which identifies this particular schema

getCanonicalizedFields

public java.util.List getCanonicalizedFields()
Returns all the fields(placeholders) in this schema. The field names are canonicalized as mentioned below:

So as to preserve the structure, Structure.Field will be represented as Structure__Field (Double Underscore is being used as a delimiter to represent the structure).

In case of multiple structured values with same name, as might occur while using + or * in the regular expressions in schema, those should be represented as using the array index using the __ notation (withouth the square brackets) for e.g. myarray[0].name ==> myarray__0__name attribute names for an element in the XML schema should be postfixed with __ (double underscore). So element.attribute ==> element__attribute__

Returns:
unmodifiable list (of SchemaFieldInfo) of all the fields in this schema.

getEnumerationFields

public java.util.List getEnumerationFields()
Returns only those fields which are of enumeration type


getDefaultFieldEnumerativeValueMap

public java.util.Map getDefaultFieldEnumerativeValueMap()
Returns Mapping from FieldName => (EnumerativeValue => Mapped Value) (String ==> Map (String => String))


getCanonicalizedFieldNames

public java.lang.String[] getCanonicalizedFieldNames()
Returns all the fields(placeholders) names in this schema. The field names are canonicalized as mentioned below:

So as to preserve the structure, Structure.Field will be represented as Structure__Field (Double Underscore is being used as a delimiter to represent the structure).

In case of multiple structured values with same name, as might occur while using + or * in the regular expressions in schema, those should be represented as using the array index using the __ notation (withouth the square brackets) for e.g. myarray[0].name ==> myarray__0__name attribute names for an element in the XML schema should be postfixed with __ (double underscore). So element.attribute ==> element__attribute__

Returns:
list (Strings) of all the field names in this schema.

getDisplayString

public static java.lang.String getDisplayString(java.lang.String schemaURI)
Utility method to be used in the gui to display schemas