FragmentEditor Class
Constructs a FragmentWrapper for a XooML fragment. In the following cases.
- XooMLFragment String is passed in and is used as the XooMLFragment
- XooMLFragment Element is passed in and is used as the XooMLFragment.
- Associations, XooMLDriver, ItemDriver, SyncDriver, groupingItemURI are given and used to create a new XooMLFragment with the given data.
The FragmentWrapper is merely a representation of a XooML fragment, and is used by an itemMirror that actually handles the details of creating deleting and modifying associations.
For ItemMirror core developers only. Enable protected to see.
Constructor
FragmentEditor
-
options
Parameters:
-
options
ObjectData to construct a new FragmentWrapper with
-
text
StringUnparsed XML directly from a storage platform.
-
element
ElementXML Element representing a XooML fragment. Required for case 1.
-
associations
AssociationEditor[]List of associations for the newly constructed XooMLFragment in case 2.
optional -
commonData
ObjectCommon data for the fragment. Look at the constructor for more details. Required for case 2
-
groupingItemURI
StringThe URI for the grouping item of the fragment. Required for case 2.
-
Item Index
Properties
- associations
- commonData
- commonData.
- commonData.displayName
- commonData.GUIDGeneratedOnLastWrite
- commonData.itemDriver
- commonData.schemaLocation
- commonData.schemaVersion
- commonData.syncDriver
- commonData.xooMLDriver
- namespace
- namespace
- namespace.attributes
- namespace.uri
- namespace.URI
- namespace.URI.attributes
- namespace.URI.data
Methods
_fromElement
-
element
-
self
Takes a fragment element in XML and then converts that into a FragmentEditor object. Intended to be one of the ways the object is constructed
Parameters:
-
element
ElementThe XML element that represents an association.
-
self
FragmentEditor
_fromOptions
-
commonData
-
associations
-
namespace
-
self
Constructs a fragmentEditor based on data passed into the parameters
Parameters:
-
commonData
ObjectAn object containing common data for the association
-
schemaVersion
StringThe version of the schema
required -
schemaLocation
StringThe location of the schema
-
itemDescribed
StringURI pointing to item for which the XooML fragment is metadata.
-
displayName
StringDisplay name of the fragment
-
itemDriver
StringThe URI of the item driver for the fragment
-
syncDriver
StringThe URI of the sync driver for the fragment
-
xooMLDriver
StringThe URI of the XooML driver for the fragment
-
GUIDGeneratedOnLastWrite
StringThe GUID generated the last time the fragment was written
-
-
associations
AssociationEditor[]An array of associations that the fragment has
-
namespace
StringThe namespace URI that an app will use for it's own private data
-
self
FragmentEditor
toElement
()
Element
protected
Converts a FragmentEditor object into an XML element, which can then be serialized and saved as a string, or further manipulated with DOM methods
Returns:
The XooML fragment as an XML element
Properties
associations
Object
The associations of the fragment. Each association is accessed by referencing it's ID, which then gives the corresponding AssociationEditor object for manipulating that association.
commonData.
String
The item described for the fragment. This is a URI that points to grouping item from wich the itemMirror was created
commonData.GUIDGeneratedOnLastWrite
String
The unique GUID for the fragment that is updated after every write
namespace
Object
The namespace data of the fragment. Holds both the URI as well as the namespace specific data for the fragment
namespace
Object
The namespace object is an associated array with each key being a namespace URI. These can thene be used to modify fragment namespace attributes and data
namespace.attributes
Object
The attributes of the namespace. This is app specific data that is set for the fragment. Each key pair in the object represents an attribute name and it's corresponding value
namespace.uri
String
The namespace URI for the fragment. Used to set namespace data for both the fragment and it's associations
namespace.URI
Object
The information for a given namespace. Includes both the data, and the attributes. Namespaces URIs must be unique or they will overwrite data from another namespace
namespace.URI.attributes
Object
The attributes of the current namespace, with each attribute having a corresponding value.
namespace.URI.data
String
This is the namespace data stored within the namespace element. Anything can be put here, and it will be stored as a string. ItemMirror will not do anything with the data here and doesn't interact with it at all. It is the responsibility of other applications to properly store information here.