com.edustructures.sifworks
Interface ElementDef


public interface ElementDef

Encapsulates metadata for a SIF element or attribute.

The ElementDef interface is fundamental to programming with the ADK. It's primarily used internally for parsing and rendering of SIF Data Objects across all versions of the SIF Specification, but is also used by in ADK programming to uniquely identify SIF Data Objects, elements, and attributes.

An instance of ElementDef captures the following characteristics of each XML element and attribute in the SIF data model:

Version:
1.0

Method Summary
 void defineVersionInfo(SIFVersion version, java.lang.String tag, int sequence, int flags)
          Add a version-specific definition of the tag to this ElementDef.
 java.util.List<ElementDef> getChildren()
          Gets all of metadata objects defined as children of this metadata object
 java.lang.String getClassName()
          The name of the class that encapsulates elements of this type.
 SIFVersion getEarliestVersion()
          Gets the earliest version of SIF that supports the element or attribute described by this metadata
 java.lang.String getFQClassName()
          Gets the fully-qualified Java class name of the class that encapsulates elements of this type.
 SIFVersion getLatestVersion()
          Gets the latest version of SIF that supports the element or attribute described by this metadata
 java.lang.String getPackage()
          Gets the package of the class that encapsulates elements of this type.
 ElementDef getParent()
          Gets the parent metadata object, or null if this metadata describes a root-level SIF Data Object element
 ElementDef getRoot()
          Gets the root metadata object
 java.lang.String getSDOPath()
          Constructs a path to this ElementDef object, comprised of the names of its ancestry delimited by an underscore.
 int getSequence(SIFVersion version)
          Gets the element sequence number
 java.lang.String getSQPPath(SIFVersion version)
          Constructs a path to this element/attribute in the SIF Query Pattern format.
 SIFTypeConverter getTypeConverter()
          Returns the type converter suitable for parsing the SIF XML value into the proper datatype
 ElementVersionInfo getVersionInfo(SIFVersion version)
          Gets version-specific information for this element
 boolean hasSimpleContent()
          Returns true if the element referenced contains simple content, such as a string or int
 boolean isAttribute(SIFVersion version)
          Determines if this metadata describes an XML attribute
 boolean isCollapsed(SIFVersion version)
          Determines if this element should not be written in this version of SIF, but that rather it's children should be written in it's place.
 boolean isDeprecated(SIFVersion version)
          Determines if this metadata describes a deprecated element or attribute in this version of SIF
 boolean isDoNotEncode()
          Determines if the content of this element can be automatically encoded when written to an output stream by the SIFWriter class when automatic encoding is enabled (the default behavior in ADK 1.5.1.0 and later).
 boolean isField()
          Determines if this metadata describes a SIF field; that is, an element that has no children
 boolean isObject()
          Determines if this metadata describes a root-level SIF Data Object
 boolean isRepeatable(SIFVersion version)
          Determines if this metadata describes a repeatable element in this version of SIF
 boolean isSupported(SIFVersion version)
          Determines if this metadata describes an element that is contained in the specified version of SIF.
 java.lang.String name()
          Gets the version-independent name of this element or attribute.
 int sequence(SIFVersion version)
          Gets the sequence number
 java.lang.String tag(SIFVersion version)
          Gets the tag name
 

Method Detail

name

java.lang.String name()
Gets the version-independent name of this element or attribute. To get the actual tag name, which is SIF version-dependent, call the tag method.

Returns:
The version-independent name, which is usually equal to the element or attribute name in SIF 1.0r1, the first version of the SIF Specification supported by the SDO framework
See Also:
tag(com.edustructures.sifworks.SIFVersion)

getTypeConverter

SIFTypeConverter getTypeConverter()
Returns the type converter suitable for parsing the SIF XML value into the proper datatype

Returns:
a SIFTypeConverter

getVersionInfo

ElementVersionInfo getVersionInfo(SIFVersion version)
Gets version-specific information for this element

Parameters:
version - Identifies the version of SIF to return the version information for
Returns:
version-specific information for this element

tag

java.lang.String tag(SIFVersion version)
Gets the tag name

Parameters:
version - Identifies the version of SIF to return the tag name for
Returns:
The element tag or attribute name specific to this version of SIF

sequence

int sequence(SIFVersion version)
Gets the sequence number

Parameters:
version - Identifies the version of SIF to return the sequence number for
Returns:
The element sequence number for this version of SIF

getSDOPath

java.lang.String getSDOPath()
Constructs a path to this ElementDef object, comprised of the names of its ancestry delimited by an underscore. The path can be used to lookup an ElementDef object via the SIFDTD.lookupMetaData method. Note the strings used in the path generated by this method are not necessarily the same as the element or attribute tag names used in SIF XML messages. Rather, they are version-independent names typically equal to the tag name of the element in SIF 1.0r1.

Returns:
A path string (e.g. "StudentPersonal_RefId")

getSQPPath

java.lang.String getSQPPath(SIFVersion version)
Constructs a path to this element/attribute in the SIF Query Pattern format. The path is comprised of element tag and attribute names, which are dependent on the version of SIF specified. The root-level SIF Data Object element is excluded from the path.

Parameters:
version - Identifies the version of SIF to return the path for
Returns:
A path to this element/attribute (e.g. "@RefId", "Email/@Type", etc.)

getParent

ElementDef getParent()
Gets the parent metadata object, or null if this metadata describes a root-level SIF Data Object element

Returns:
The parent metadata object

getChildren

java.util.List<ElementDef> getChildren()
Gets all of metadata objects defined as children of this metadata object

Returns:
The child metadata objects

getRoot

ElementDef getRoot()
Gets the root metadata object

Returns:
The root metadata object

getClassName

java.lang.String getClassName()
The name of the class that encapsulates elements of this type.

Returns:
The implementation class name excluding package information
See Also:
getFQClassName()

getFQClassName

java.lang.String getFQClassName()
Gets the fully-qualified Java class name of the class that encapsulates elements of this type.

Returns:
The implementation class name including package information
See Also:
getClassName(), getPackage()

getPackage

java.lang.String getPackage()
Gets the package of the class that encapsulates elements of this type.

Returns:
The Java package name where the implementation class is found
See Also:
getFQClassName()

getSequence

int getSequence(SIFVersion version)
Gets the element sequence number

Parameters:
version - The SIF Version to retrieve the sequence number for
Returns:
The zero-based sequence number of this element

isAttribute

boolean isAttribute(SIFVersion version)
Determines if this metadata describes an XML attribute

Parameters:
version - The SIFVersion to use when checking if this object is an attribute
Returns:
true if this metadata describes an XML attribute

isField

boolean isField()
Determines if this metadata describes a SIF field; that is, an element that has no children

Returns:
True if this element is a field of its parent

isObject

boolean isObject()
Determines if this metadata describes a root-level SIF Data Object

Returns:
True if this element represents a topic (e.g. StudentPersonal)

isSupported

boolean isSupported(SIFVersion version)
Determines if this metadata describes an element that is contained in the specified version of SIF.

Parameters:
version - The version of the SIF Specification
Returns:
TRUE if the metadata is included in the specified version of SIF

isDeprecated

boolean isDeprecated(SIFVersion version)
Determines if this metadata describes a deprecated element or attribute in this version of SIF

Parameters:
version - The SIFVersion to check
Returns:
True if this element is deprecated in the specified version of SIF

isRepeatable

boolean isRepeatable(SIFVersion version)
Determines if this metadata describes a repeatable element in this version of SIF

Parameters:
version - The SIF version to check
Returns:
True if the element is repeatable in the specified version of SIF

isCollapsed

boolean isCollapsed(SIFVersion version)
Determines if this element should not be written in this version of SIF, but that rather it's children should be written in it's place. This is helpful for cases where a set of elements valid for one version of SIF were moved inside of a new container element in a subsequent version (e.g. StudentPersonal/Email )

Parameters:
version -
Returns:
True if the element is collapsed in the specified version of SIF

isDoNotEncode

boolean isDoNotEncode()
Determines if the content of this element can be automatically encoded when written to an output stream by the SIFWriter class when automatic encoding is enabled (the default behavior in ADK 1.5.1.0 and later). Encoding converts all invalid XML characters to valid XML entities. Some elements contain XML content and should not be encoded.

Returns:
True if the element should not have XML encoding applied

getEarliestVersion

SIFVersion getEarliestVersion()
Gets the earliest version of SIF that supports the element or attribute described by this metadata

Returns:
The first SIFVersion this element appeared in

getLatestVersion

SIFVersion getLatestVersion()
Gets the latest version of SIF that supports the element or attribute described by this metadata

Returns:
The latest SIFVersion this element appeared in

defineVersionInfo

void defineVersionInfo(SIFVersion version,
                       java.lang.String tag,
                       int sequence,
                       int flags)
Add a version-specific definition of the tag to this ElementDef.

Parameters:
version - A SIFVersion constant (other than SIF10r1, which is implicitly defined by all ElementDef class constructors)
tag - The element tag name for this version of SIF
sequence - The sequence number for this version of SIF
flags - One or more flags such as FD_DEPRECATED

hasSimpleContent

boolean hasSimpleContent()
Returns true if the element referenced contains simple content, such as a string or int

Returns:
True if this element represents simple content


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.