Difference between revisions of "DOMDocument"

From Virtual World Web Wiki
Jump to: navigation, search
(Documentation for the DOMDocument class)
(Documentation for the DOMDocument class)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Represents a serialization and management boundary in a DOM tree. Serialization does not cross document boundaries. You can construct a document from other documents (as an server instance does for example).
 
Represents a serialization and management boundary in a DOM tree. Serialization does not cross document boundaries. You can construct a document from other documents (as an server instance does for example).
Generally a DOMDocument represents some server managed entity that has other meaning. Document's have a ContextType and ContextID that help you identify different kinds of documents.
+
Generally a DOMDocument represents some server managed entity that has other meaning. There are several sub-classes of DOMDocument that represent several "well known" document types that introduce relevant formal properties.
A Scene document is the chunk of DOM that is loaded and saved and edited when you scene edit, a Participant document represents a user's avatar, etc.
+
 
DOMDocument also defines the main DOM serialization / deserialization methods
 
DOMDocument also defines the main DOM serialization / deserialization methods
  
 
*'''Inherits class: [[DOMObject]]'''
 
*'''Inherits class: [[DOMObject]]'''
 
===Remarks <nowiki>[</nowiki>[{{fullurl:DOMDocument Remarks|action=edit}} edit]<nowiki>]</nowiki>===
 
===Remarks <nowiki>[</nowiki>[{{fullurl:DOMDocument Remarks|action=edit}} edit]<nowiki>]</nowiki>===
{{:DOMDocument Remarks}}
+
{{#ifexist:DOMDocument Remarks|{{:DOMDocument Remarks}}|}}
  
 
===Properties===
 
===Properties===
Line 16: Line 15:
 
::
 
::
 
::The type of server object represented by this DOM document.
 
::The type of server object represented by this DOM document.
 +
 +
:{{CSharp|bool Editing {get; set;} }}
 +
::
 +
::Specifies if this document is being edited
  
 
:{{CSharp|object HostObject {get; set;} }}
 
:{{CSharp|object HostObject {get; set;} }}
Line 45: Line 48:
 
:{{CSharp|DOMDocument(string title, DOMObject[] children)}}
 
:{{CSharp|DOMDocument(string title, DOMObject[] children)}}
 
::
 
::
::Constructs a new DOMCurveKeyframe, setting a title and adding children at the same time
+
::Constructs a new DOMDocument, setting a title and adding children at the same time
  
 
===Methods===
 
===Methods===
:{{CSharp|DOMObject Clone()}}
 
::
 
::Creates a clone of this DOMDocument and all it's children and properties
 
 
 
:{{CSharp|T Deserialize<T>(Byte[] source, SerializationContext context)}}
 
:{{CSharp|T Deserialize<T>(Byte[] source, SerializationContext context)}}
 
::
 
::
Line 71: Line 70:
 
::
 
::
 
::Deserializes the a DOM tree from a stream
 
::Deserializes the a DOM tree from a stream
 +
 +
:{{CSharp|DOMObject DeserializeJSON(string json)}}
 +
::
 +
::Deserializes a DOM object from a json string.
  
 
:{{CSharp|void ReID()}}
 
:{{CSharp|void ReID()}}
Line 88: Line 91:
 
::Serializes the provided DOM tree into the provided stream
 
::Serializes the provided DOM tree into the provided stream
  
:{{CSharp|void SetLatencyTracker(LatencyTracker tracker)}}
+
:{{CSharp|string SerializeJSON(DOMObject instance, Formatting formatting {{=}} Formatting.Indented)}}
 
::
 
::
::Sets the latency tracker for this document tree. Used by the server.
+
::Serialized a DOMObject to a JSON string
  
:{{CSharp|void SetLockType<T>()}}
+
:{{CSharp|void SetLatencyTracker(LatencyTracker tracker)}}
 
::
 
::
::Used to set a type to use for DOM synchronization (this is here because ReaderWriterLockSlim is not available in Unity, but is more efficient and used on the server)
+
::Sets the latency tracker for this document tree. Used by the server.
  
 
__NOTOC____NOEDITSECTION__
 
__NOTOC____NOEDITSECTION__

Latest revision as of 12:08, 30 April 2019

Represents a serialization and management boundary in a DOM tree. Serialization does not cross document boundaries. You can construct a document from other documents (as an server instance does for example). Generally a DOMDocument represents some server managed entity that has other meaning. There are several sub-classes of DOMDocument that represent several "well known" document types that introduce relevant formal properties. DOMDocument also defines the main DOM serialization / deserialization methods

Remarks [edit]

Properties

Guid ContextID {get; set;}
The ID of the document's related server object. The meaning ContextID depends on the ContextType property.
DOMDocumentContextType ContextType {get; set;}
The type of server object represented by this DOM document.
bool Editing {get; set;}
Specifies if this document is being edited
object HostObject {get; set;}
Like "Tag", but mean to be used by a DOM host to associate a document with the server object it represents
LatencyTracker LatencyTracker {get; set;}
Used by the infrastructure for latency calculations
int LightMapMode {get; set;}
Specifies the ligh map mode to use in a scene. This probably doesn't belong on "document" but rather as a runtime-added property of scene documents
long? ViewID {get; set;}
The ID of the server ViewInfo represented by this document. This property should only be set on root documents of views

Events

IdentifierChanged(EventHandler)
Event is raised, when the document and its children identifiers have changed

Constructors

DOMDocument(DOMObject[] children)
Constructs a new DOMDocument, adding children at the same time
DOMDocument(string title, DOMObject[] children)
Constructs a new DOMDocument, setting a title and adding children at the same time

Methods

T Deserialize<T>(Byte[] source, SerializationContext context)
Deserializes the provided bytes into a DOM tree.
T Deserialize<T>(Byte[] source, SerializationContextType contextType)
Deserializes the provided bytes into a DOM tree.
DOMObject Deserialize(Byte[] source, SerializationContextType contextType)
Deserializes the provided bytes into a DOM tree.
DOMObject Deserialize(Byte[] source, SerializationContext context)
Deserializes the provided bytes into a DOM tree.
T Deserialize<T>(Stream stream, SerializationContextType contextType)
Deserializes the a DOM tree from a stream
DOMObject DeserializeJSON(string json)
Deserializes a DOM object from a json string.
void ReID()
Resets the ID property of this and all child objects using IDs generated by its root document
void RunCurvePlayers()
Runs the Update method on all DOMCurvePlayers in the document
Byte[] Serialize<T>(T instance, SerializationContextType contextType)
Serializes the provided DOM tree
void Serialize<T>(Stream stream, T instance, SerializationContextType contextType)
Serializes the provided DOM tree into the provided stream
string SerializeJSON(DOMObject instance, Formatting formatting = Formatting.Indented)
Serialized a DOMObject to a JSON string
void SetLatencyTracker(LatencyTracker tracker)
Sets the latency tracker for this document tree. Used by the server.