API Docs for: 0.8.2
Show:

FragmentEditor Class

Constructs a FragmentWrapper for a XooML fragment. In the following cases.

  1. XooMLFragment String is passed in and is used as the XooMLFragment
  2. XooMLFragment Element is passed in and is used as the XooMLFragment.
  3. 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
)
protected

Parameters:

  • options Object

    Data to construct a new FragmentWrapper with

    • text String

      Unparsed XML directly from a storage platform.

    • element Element

      XML Element representing a XooML fragment. Required for case 1.

    • associations AssociationEditor[]

      List of associations for the newly constructed XooMLFragment in case 2.
      optional

    • commonData Object

      Common data for the fragment. Look at the constructor for more details. Required for case 2

    • groupingItemURI String

      The URI for the grouping item of the fragment. Required for case 2.

Methods

_fromElement

(
  • element
  • self
)
private

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 Element

    The XML element that represents an association.

  • self FragmentEditor

_fromOptions

(
  • commonData
  • associations
  • namespace
  • self
)
private

Constructs a fragmentEditor based on data passed into the parameters

Parameters:

  • commonData Object

    An object containing common data for the association

    • schemaVersion String

      The version of the schema
      required

    • schemaLocation String

      The location of the schema

    • itemDescribed String

      URI pointing to item for which the XooML fragment is metadata.

    • displayName String

      Display name of the fragment

    • itemDriver String

      The URI of the item driver for the fragment

    • syncDriver String

      The URI of the sync driver for the fragment

    • xooMLDriver String

      The URI of the XooML driver for the fragment

    • GUIDGeneratedOnLastWrite String

      The GUID generated the last time the fragment was written

  • associations AssociationEditor[]

    An array of associations that the fragment has

  • namespace String

    The 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:

Element:

The XooML fragment as an XML element

toString

() String

Returns the XML of a fragment as a string, not the string version of the object. This is used for persisting the fragment across multiple platforms

Returns:

String:

Fragment XML

updateID

() String protected

Updates the GUID of the Fragment

Returns:

String:

The new GUID of the fragment

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

Object

Common Data of the association that is accessible to all applications

commonData.

String

The item described for the fragment. This is a URI that points to grouping item from wich the itemMirror was created

commonData.displayName

String

Text that describes the fragment

commonData.GUIDGeneratedOnLastWrite

String

The unique GUID for the fragment that is updated after every write

commonData.itemDriver

String

The item driver URI for the fragment

commonData.schemaLocation

String

The schema location for the fragment

commonData.schemaVersion

String

The schema version for the fragment

commonData.syncDriver

String

The sync driver URI for the fragment

commonData.xooMLDriver

String

The XooML driver URI for the fragment

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.