Remarks
See Also
Developer's Guide
Members
Constructors
Creates a new instance of GraphMLIOHandler.
Properties
If set to true, an existing graph instance will be cleared before the graph is read into this instance, otherwise the loaded graph will be merged into the existing one.
The default is true.
Gets the mapper for the overrides of the deserialization properties.
Gets the mapper for the overrides of the serialization properties.
Methods
Parameters
- type: string
- A string which represents the type of the event to register as listed in events.
- listener: function(evt:EventArgs, sender:this): void
- The function which will be invoked when the event is raised.
- options?: ListenerOptions
- Options which specify how the listener will be invoked.
This method can optionally use a custom event handler for the actual deserialization.
This method creates and configures the necessary handler itself.
Parameters
- dataType: Constructor<TValue>
- The type of the mapper values
- keyDefinitionPredicate: function(Element): boolean
- Predicate function to select the correct GraphML attributeRepresents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj: Element
- The object to compare against the criteria defined within the method represented by this delegate.
Return Value- boolean
trueif obj meets the criteria defined within the method represented by this delegate; otherwise,false.
- graphData: function(IGraph, TValue): void
- Delegate that stores the graph data dynamicallyEncapsulates a method that has two parameters and does not return a value.Parameters
- arg1: IGraph
- The first parameter of the method that this delegate encapsulates.
- arg2: TValue
- The second parameter of the method that this delegate encapsulates.
- deserializationCallback?: function(IParseContext, Node, Constructor): TValue
- Custom deserialization callback.Encapsulates a method that has three parameters and returns a value of the type specified by the
TResultparameter.Parameters- arg1: IParseContext
- The first parameter of the method that this delegate encapsulates.
- arg2: Node
- The second parameter of the method that this delegate encapsulates.
- arg3: Constructor
- The third parameter of the method that this delegate encapsulates.
Return Value- TValue
- The return value of the method that this delegate encapsulates.
This method can optionally use a custom event handler for the actual deserialization.
This method creates and configures the necessary handler itself.
Parameters
- dataType: Constructor<TValue>
- The type of the mapper values
- name: string
- The name of the attribute
- graphData: function(IGraph, TValue): void
- Delegate that stores the graph data dynamicallyEncapsulates a method that has two parameters and does not return a value.Parameters
- arg1: IGraph
- The first parameter of the method that this delegate encapsulates.
- arg2: TValue
- The second parameter of the method that this delegate encapsulates.
- deserializationCallback?: function(IParseContext, Node, Constructor): TValue
- custom deserialization callback.Encapsulates a method that has three parameters and returns a value of the type specified by the
TResultparameter.Parameters- arg1: IParseContext
- The first parameter of the method that this delegate encapsulates.
- arg2: Node
- The second parameter of the method that this delegate encapsulates.
- arg3: Constructor
- The third parameter of the method that this delegate encapsulates.
Return Value- TValue
- The return value of the method that this delegate encapsulates.
- uri?: string
- The optional URI of the key definition to disambiguate keys.
This method can optionally use a custom event handler for the actual serialization.
This method creates and configures the necessary handler itself.
Parameters
- dataType: Constructor<TValue>
- The type of the mapper values
- name: string
- The name of the attribute
- graphData: TValue
- the data that is written at the top level
- serializationCallback?: function(IWriteContext, TValue, Constructor): void
- custom serialization callback.Encapsulates a method that has two parameters and does not return a value.Parameters
- arg1: IWriteContext
- The first parameter of the method that this delegate encapsulates.
- arg2: TValue
- The second parameter of the method that this delegate encapsulates.
- arg3: Constructor
- The third parameter of the method that this delegate encapsulates.
- declaredKeyType?: KeyType
- The key type to write in the declaration. If this is omitted or
null, the type is inferred automatically fromTValue - uri?: string
- The optional URI to add to the key definition to disambiguate keys.
This method can optionally use a custom event handler for the actual serialization.
This method creates and configures the necessary handler itself.
Parameters
- dataType: Constructor<TValue>
- The type of the mapper values
- name: string
- The name of the attribute
- graphData: function(IGraph): TValue
- Delegate that retrieves the graph data dynamicallyEncapsulates a method that has one parameters and returns a value of the type specified by the
TResultparameter.Parameters- arg: IGraph
- The parameter of the method that this delegate encapsulates.
Return Value- TValue
- The return value of the method that this delegate encapsulates.
- serializationCallback?: function(IWriteContext, TValue, Constructor): void
- custom serialization callback.Encapsulates a method that has two parameters and does not return a value.Parameters
- arg1: IWriteContext
- The first parameter of the method that this delegate encapsulates.
- arg2: TValue
- The second parameter of the method that this delegate encapsulates.
- arg3: Constructor
- The third parameter of the method that this delegate encapsulates.
- declaredKeyType?: KeyType
- The key type to write in the declaration. If this is omitted or
null, the type is inferred automatically fromTValue - uri?: string
- The optional URI to add to the key definition to disambiguate keys.
Register an IMapper<K, V> instance for use as an input data target.
Parameters
- keyType: Constructor<TKey>
- The type of the mapper keys
- dataType: Constructor<TData>
- The type of the mapper values
- name: string
- The name of the attribute
- mapper: IMapper<TKey, TData>conversion
- the mapper that serves as data source
See Also
Developer's Guide
addInputMapper
<TKey, TData> (keyType: Constructor<TKey>dataType: Constructor<TData>keyDefinitionPredicate: function(Element): boolean)Register an IMapper<K, V> instance for use as an input data target.
addInputMapper
<TKey, TData> (This method uses a custom event handler for the actual deserialization.
This method creates and configures the necessary handler itself.
Parameters
- keyType: Constructor<TKey>
- The type of the mapper keys
- dataType: Constructor<TData>
- The type of the mapper values
- keyDefinitionPredicate: function(Element): boolean
- The predicate function that will determine whether to create an IInputHandler for the given key definition.Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj: Element
- The object to compare against the criteria defined within the method represented by this delegate.
Return Value- boolean
trueif obj meets the criteria defined within the method represented by this delegate; otherwise,false.
- mapper: IMapper<TKey, TData>conversion
- the mapper that serves as data source
- deserializationCallback: function(IParseContext, Node, Constructor): TData
- custom deserialization callback.Encapsulates a method that has three parameters and returns a value of the type specified by the
TResultparameter.Parameters- arg1: IParseContext
- The first parameter of the method that this delegate encapsulates.
- arg2: Node
- The second parameter of the method that this delegate encapsulates.
- arg3: Constructor
- The third parameter of the method that this delegate encapsulates.
Return Value- TData
- The return value of the method that this delegate encapsulates.
Parameters
- namespaceURI: string
- The namespace URI
- shortName: string
- The namespace prefix
Throws
- Exception ({ name: 'ArgumentError' })
- If
namespaceURIisnull.
addOutputMapper
<TModelItem, TValue> (modelItemType: Constructor<TModelItem>dataType: Constructor<TValue>name: string)Register an IMapper<K, V> instance for use as an output data source
addOutputMapper
<TModelItem, TValue> (Parameters
- modelItemType: Constructor<TModelItem>
- The type of the mapper keys
- dataType: Constructor<TValue>
- The type of the mapper values
- name: string
- The name of the attribute
- mapper: IMapper<TModelItem, TValue>conversion
- the mapper that serves as data source
See Also
Developer's Guide
addOutputMapper
<TModelItem, TValue> (modelItemType: Constructor<TModelItem>dataType: Constructor<TValue>name: stringuri: string)Register an IMapper<K, V> instance for use as an output data source.
addOutputMapper
<TModelItem, TValue> (This method uses a custom event handler for the actual serialization.
This method creates and configures the necessary handler itself.
Parameters
- modelItemType: Constructor<TModelItem>
- The type of the mapper keys
- dataType: Constructor<TValue>
- The type of the mapper values
- name: string
- The name of the attribute
- uri: string
- The URI to add to the key definition to disambiguate keys.
- mapper: IMapper<TModelItem, TValue>conversion
- the mapper that serves as data source
- serializationCallback: function(IWriteContext, TValue, Constructor): void
- custom serialization callback.Encapsulates a method that has two parameters and does not return a value.Parameters
- arg1: IWriteContext
- The first parameter of the method that this delegate encapsulates.
- arg2: TValue
- The second parameter of the method that this delegate encapsulates.
- arg3: Constructor
- The third parameter of the method that this delegate encapsulates.
- declaredKeyType: KeyType
- The key type to write in the declaration.
Parameters
- schemaNamespace: string
- The namespace URI for this schema location
- schemaLocation: string
- The schema location
Throws
- Exception ({ name: 'ArgumentError' })
- If
schemaNamespaceisnull.
Parameters
- tType: Constructor<T>
- metadata: TypeMetadata<T>
- The metadata for the type and its properties.
See Also
Developer's Guide
API
- addXamlNamespaceMapping
The module is an object where the keys are XML tag names and the values are the types to be mapped.
This is used both for writing and parsing objects.
Parameters
- xmlNamespace: string
- The XML namespace that corresponds to
module. - module: any
- The module that is mapped to the XML namespace. The keys are the names of the XML tags. The values are the types.
See Also
Developer's Guide
API
- IXamlNameMapper, createXamlNameMapper, addTypeInformation
Allows for configuration of the initial IParseContext that is used for reading a GraphML file.
rootContext instance or a new IParseContext instance that wraps the given rootContext instance. Thus, it is recommended to create an instance of ChildParseContext that wraps the given rootContext instance if custom configuration is necessary.Parameters
- rootContext: IParseContext
- The initial parse context that is created by the framework.
Return Value
- IParseContext
- A suitably configured parse context.
Allows for configuration of the initial IWriteContext that is used for writing a GraphML file.
rootContext via the IWriteContext interface. Instead, create an instance of ChildWriteContext that wraps the provided context and configure that one.Parameters
- rootContext: IWriteContext
- The initial write context that is created by the framework.
Return Value
- IWriteContext
- A suitably configured write context.
Creates the default value serializer context and returns it.
Return Value
- IValueSerializerContext
- An implementation of the IValueSerializerContext interface.
Configure mappings from CLR to XML names.
Return Value
- IXamlNameMapper
- The configured IXamlNameMapper.
Configure mappings from XML namespaces to prefixes.
Return Value
- IXamlPrefixMapper
- The configured IXamlPrefixMapper.
Factory method that creates and configures a suitable IXmlWriter implementation.
Return Value
- IXmlWriter
- A suitable IXmlWriter instance for the serialization
See Also
API
- writer
Parses the XML document document into an graph instance.
document into an graph instance.Parameters
- graph: IGraph
- The graph instance that is populated.
- document: Document
- The XML document instance to parse.
- context: IParseContext
- The initial parse context.
Return Value
See Also
Parameters
- graph: IGraph
- The graph that is to be populated with nodes and edges as read from the document.
- document: Document
- The XML document.
Return Value
Throws
See Also
Developer's Guide
Parameters
- graph: IGraph
- The Graph object that is to be populated with nodes and edges as read from the GraphML data.
- data: string
- A string that contains GraphML data.
Return Value
See Also
Developer's Guide
Parameters
- graph: IGraph
- The graph that is to be populated with nodes and edges as read from the URL.
- url: string
- The URL of the file to be read.
Return Value
Throws
See Also
Developer's Guide
Parameters
- type: string
- A string which represents the type of the event to register as listed in events.
- listener: function(evt:EventArgs, sender:this): void
- The function which will be invoked when the event is raised.
- options?: ListenerOptions
- Options which specify how the listener will be invoked.
Events
Occurs when XML content is about to be deserialized.
Subscribe to this event to provide custom deserialization handling for XML content.
The event handlers added to this event are called in inverse order, i.e. handlers that have been added later are called earlier.
The current XML content is provided by xmlNode. If you want to return deserialized content, set the value of the result property.
- context: IParseContextfinal
- Gets the context in which the xmlNode shall be deserialized.
- handled: booleanfinalwritable
- Gets or sets a value indicating whether this HandleDeserializationEventArgs is handled.
- result: anyfinalwritable
- Gets or sets the result of the deserialization, which is
nullinitially. - targetType: Constructorfinal
- Gets the type of the resulting instance that is required by the requesting deserializer or
nullif the target type is not known in advance. - xmlNode: Nodefinal
- Gets the XML node that contains the data to deserialize.
See Also
Developer's Guide
Occurs when XML content is about to be serialized.
Subscribe to this event to provide custom serialization handling for XML content.
The event handlers added to this event are called in reverse order, i.e. handlers that have been added later are called earlier.
The current item is provided by item.
- context: IWriteContextfinal
- Gets the context to be used for writing.
- handled: booleanfinalwritable
- Gets or sets a value indicating whether this HandleSerializationEventArgs is handled.
- item: anyfinal
- Gets the item that should be serialized.
- sourceType: Constructorfinal
- Gets the type in the inheritance of the item that should be used for serialization.
- writer: IXmlWriterfinal
- Gets the writer for writing the XML output.
See Also
Developer's Guide
Occurs before inline references are evaluated.
- context: IParseContextfinal
- Gets the current parse context that can be used by the event handler for additional information.
- handled: booleanfinal
- Gets whether the last event handler invocation has actually handled the event.
- referenceId: stringfinal
- Gets the reference ID that should be evaluated by the event handler.
- value: anyfinalwritable
- Gets or sets the reference value that is encapsulated by this instance.
See Also
Occurs when the document has been parsed.
- context: IParseContextfinal
- Gets the context that is being used for parsing.
- element: Elementfinal
- Gets the XML element that is currently parsed.
See Also
Developer's Guide
Occurs when the parsing of a document is just about to begin.
- context: IParseContextfinal
- Gets the context that is being used for parsing.
- element: Elementfinal
- Gets the XML element that is currently parsed.
See Also
Developer's Guide
Occurs when a GraphML attribute is about to be read.
Subscribe to this event to dynamically register one or more IInputHandler instance(s) for a given GraphML attribute key definition.
The current key definition is provided by keyDefinition. If you want to register an IInputHandler for this GraphML attribute, you can add the handler with addInputHandler method. Implementations should also consider the handled property.
- context: IParseContextfinal
- Gets the IParseContext instance that can be queried for further information.
- handled: booleanfinalwritable
- Gets or sets whether the current GraphML attribute has been processed.
- handlers: IEnumerable<IInputHandler>final
- Gets the IInputHandlers that have been registered on this event argument instance so far.
- keyDefinition: Elementfinal
- Gets the key definition of the GraphML attribute.
See Also
Developer's Guide
Occurs when a name is queried.
This event can be used to override name mappings to XML names in XAML.
If the event handler determines that it map resolve type to a xml name, it should place the result into the result property and thus mark the event as handled.
It is valid to provide only part of the XML name by setting the other part to null. In that case, the default name determination rules are used for that part.
- context: IWriteContextfinal
- Gets the context in which the type shall be mapped.
- handled: booleanfinalwritable
- Gets or sets a value indicating whether this QueryNameEventArgs is handled.
- result: XmlNamefinalwritable
- Gets or sets the result of the name query, which is
nullinitially. - type: Constructorfinal
- Gets the type for which the XML name is queried.
Occurs when a GraphML attribute is about to be written.
Subscribe to this event to dynamically register one or more IOutputHandler instance(s) for a given GraphML attribute key definition.
The event handlers added to this event are called in inverse order, i.e. handlers that have been added later are called earlier.
If you want to register an IOutputHandler for this GraphML attribute, you can add the handler with addOutputHandler.
- context: IWriteContextfinal
- Gets the context for which the handlers are queried.
- handlers: IEnumerable<IOutputHandler>final
- Gets the IOutputHandlers that have been registered on this event argument instance so far.
- scope: KeyScopefinal
- Gets the scope where the handlers should be added.
See Also
Developer's Guide
Occurs when a reference is queried.
This event can be used to provide names of external or internal references for objects.
The reference targets are not serialized to the GraphML file if they are set to EXTERNAL. To resolve these references when parsing, you typically have to subscribe to the resolve-reference event.
- context: IWriteContextfinal
- Gets the current write context that can be used by the event handler for additional information.
- handled: booleanfinal
- Gets whether the last event handler invocation has actually handled the event.
- referenceId: stringfinalwritable
- Gets or sets the reference id that should be evaluated by the event handler.
- referenceType: GraphMLReferenceTypeconversionfinalwritable
- Gets or sets the type of the reference being queried.
- value: anyfinal
- Gets the reference value that is encapsulated by this instance.
See Also
Developer's Guide
API
- referenceId, referenceType
Occurs when a type is queried.
- context: IParseContextfinal
- Gets the context in which the shall be mapped.
- handled: booleanfinalwritable
- Gets or sets a value indicating whether this QueryTypeEventArgs is handled.
- result: Constructorfinalwritable
- Gets or sets the result of the type query, which is
nullinitially. - xmlName: XmlNamefinal
- Gets the fully qualified XML name that should be resolved to a type.
See Also
Occurs after references are evaluated.
- context: IParseContextfinal
- Gets the current parse context that can be used by the event handler for additional information.
- handled: booleanfinal
- Gets whether the last event handler invocation has actually handled the event.
- referenceId: stringfinal
- Gets the reference ID that should be evaluated by the event handler.
- value: anyfinalwritable
- Gets or sets the reference value that is encapsulated by this instance.
See Also
Developer's Guide
API
- override-resolve-reference
Occurs when the writing of a document is just about to begin.
- context: IWriteContextfinal
- Gets the context that is being used for writing.
- item: anyfinal
- Gets the item that is currently being written or
nullif nothing is applicable.
See Also
Developer's Guide
Occurs when the writing of a document has been finished.
- context: IWriteContextfinal
- Gets the context that is being used for writing.
- item: anyfinal
- Gets the item that is currently being written or
nullif nothing is applicable.
See Also
Developer's Guide
Static Methods
createMapperInputHandler
<TKey, TData> (modelItemType: Constructor<TKey>dataType: Constructor<TData>): MapperInputHandler<TKey, TData>static
createMapperInputHandler
<TKey, TData> (TKey and TData.Parameters
- modelItemType: Constructor<TKey>
- The type of the mapper keys
- dataType: Constructor<TData>
- The type of the mapper entries
- mapper: IMapper<TKey, TData>conversion
- The mapper to use.
- deserializationCallback: function(IParseContext, Node, Constructor): TData
- Optional deserialization callback for complex data.Encapsulates a method that has three parameters and returns a value of the type specified by the
TResultparameter.Parameters- arg1: IParseContext
- The first parameter of the method that this delegate encapsulates.
- arg2: Node
- The second parameter of the method that this delegate encapsulates.
- arg3: Constructor
- The third parameter of the method that this delegate encapsulates.
Return Value- TData
- The return value of the method that this delegate encapsulates.
Return Value
- MapperInputHandler<TKey, TData>
- A suitable MapperInputHandler<TKey, TData> implementation
createMapperOutputHandler
<TKey, TData> (modelItemType: Constructor<TKey>dataType: Constructor<TData>name: string): MapperOutputHandler<TKey, TData>static
createMapperOutputHandler
<TKey, TData> (TKey and TData.Parameters
- modelItemType: Constructor<TKey>
- The type of the mapper keys
- dataType: Constructor<TData>
- The type of the mapper entries
- name: string
- The name of the graphml attribute
- mapper: IMapper<TKey, TData>conversion
- The mapper to use.
- serializationCallback: function(IWriteContext, TData, Constructor): void
- Optional serialization callback for complex data.Encapsulates a method that has two parameters and does not return a value.Parameters
- arg1: IWriteContext
- The first parameter of the method that this delegate encapsulates.
- arg2: TData
- The second parameter of the method that this delegate encapsulates.
- arg3: Constructor
- The third parameter of the method that this delegate encapsulates.
Return Value
- MapperOutputHandler<TKey, TData>
- A suitable MapperOutputHandler<TKey, TData> implementation
Parameters
- definition: Element
- The key definition to check
- name: string
- The name that should be matched
Return Value
- boolean
trueif the name attribute indefinitionmatchesname
Checks whether the scope attribute in definition matches scope
scope attribute in definition matches scopeParameters
- definition: Element
- The key definition to check
- scope: KeyScope
- The scope that should be matched
Return Value
- boolean
trueif the scope attribute indefinitionmatchesscope
Checks whether the type attribute in definition matches type
type attribute in definition matches typeParameters
- definition: Element
- The key definition to check
- type: KeyType
- The type that should be matched
Return Value
- boolean
trueif the type attribute indefinitionmatchestype