# OpenLayers.Format.OWSContext.v0_3_1

Read and write OWSContext version 0.3.1.

#### Inherits from

- OpenLayers.Format.XML

Summary

OpenLayers.Format.OWSContext.v0_3_1 | Read and write OWSContext version 0.3.1.
Properties |
namespaces | {Object} Mapping of namespace aliases to namespace URIs.
Constants |
VERSION | {String} 0.3.1
Properties |
schemaLocation | {String} Schema location
defaultPrefix | {String} Default namespace prefix to use.
extractAttributes | {Boolean} Extract attributes from GML.
xy | {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) Changing is not recommended, a new Format should be instantiated.
regExes | Compiled regular expressions for manipulating strings.
featureNS | {String} The namespace uri to use for writing InlineGeometry
featureType | {String} The name to use as the feature type when writing out InlineGeometry
geometryName | {String} The name to use for the geometry attribute when writing out InlineGeometry
nestingLayerLookup | {Object} Hashtable lookup for nesting layer nodes.
Constructor |
OpenLayers.Format.OWSContext.v0_3_1 | Instances of this class are not created directly.
Functions |
setNestingPath | Set the nestingPath property of the layer depending on the position of the layer in hierarchy of layers.
decomposeNestingPath | “a”, “a/b”, “a/b/c”
read | Read OWS context data from a string or DOMElement, and return a list of layers.
processLayer | Recursive function to get back a flat list of layers from the hierarchic layer structure.
write |
Properties |
readers | Contains public functions, grouped by namespace prefix, that will be applied when a namespaced node is found matching the function name.
writers | As a compliment to the readers property, this structure contains public writing functions grouped by namespace alias and named like the node names they produce.

### Properties

### namespaces

{Object} Mapping of namespace aliases to namespace URIs.

### Constants

### VERSION

{String} 0.3.1

### Properties

### schemaLocation

{String} Schema location

### defaultPrefix

{String} Default namespace prefix to use.

### extractAttributes

{Boolean} Extract attributes from GML. Default is true.

### xy

{Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) Changing is not recommended, a new Format should be instantiated.

### regExes

Compiled regular expressions for manipulating strings.

### featureNS

{String} The namespace uri to use for writing InlineGeometry

### featureType

{String} The name to use as the feature type when writing out InlineGeometry

### geometryName

{String} The name to use for the geometry attribute when writing out InlineGeometry

### nestingLayerLookup

{Object} Hashtable lookup for nesting layer nodes. Used while writing the OWS context document. It is necessary to keep track of the nestingPaths for which nesting layer nodes have already been created, so (nesting) layer nodes are added to those nodes.

#### For example

#### If there are three layers with nestingPaths

layer1.metadata.nestingPath = “a/b/” layer2.metadata.nestingPath = “a/b/” layer2.metadata.nestingPath = “a/c”

then a nesting layer node “a” should be created once and added to the resource list, a nesting layer node “b” should be created once and added under “a”, and a nesting layer node “c” should be created and added under “a”. The lookup paths for these nodes will be “a”, “a/b”, and “a/c” respectively.

### Constructor

### OpenLayers.Format.OWSContext.v0_3_1

Instances of this class are not created directly. Use the OpenLayers.Format.OWSContext constructor instead.

#### Parameters

options | {Object} An optional object whose properties will be set on this instance.

### Functions

### setNestingPath

> setNestingPath : function( | l | )

Set the nestingPath property of the layer depending on the position of the layer in hierarchy of layers.

#### Parameters

l | {Object} An object that may have a layersContext array property.

### decomposeNestingPath

> decomposeNestingPath: function( | nPath | )

#### Takes a nestingPath like “a/b/c” and decomposes it into subpaths

”a”, “a/b”, “a/b/c”

#### Parameters

nPath | {Array} the nesting path

#### Returns

Array({String}) Array with subpaths, or empty array if there is nothing to decompose

### read

> read: function( | data | )

Read OWS context data from a string or DOMElement, and return a list of layers.

#### Parameters

data | {String} or {DOMElement} data to read/parse.

#### Returns

{Object} The context object with a flat layer list as a property named layersContext.

### processLayer

> processLayer: function( | layerArray,
> | layer | )

Recursive function to get back a flat list of layers from the hierarchic layer structure.

#### Parameters

layerArray | {Array({Object})} Array of layerContext objects
layerContext | {Object} layerContext object

### write

> write: function( | context,
> | options | )

#### Parameters

context | {Object} An object representing the map context.
options | {Object} Optional object.

#### Returns

{String} An OWS Context document string.

### Properties

### readers

Contains public functions, grouped by namespace prefix, that will be applied when a namespaced node is found matching the function name. The function will be applied in the scope of this parser with two arguments: the node being read and a context object passed from the parent.

### writers

As a compliment to the readers property, this structure contains public writing functions grouped by namespace alias and named like the node names they produce.

> setNestingPath : function( | l | )

Set the nestingPath property of the layer depending on the position of the layer in hierarchy of layers.

> decomposeNestingPath: function( | nPath | )

“a”, “a/b”, “a/b/c”

> read: function( | data | )

Read OWS context data from a string or DOMElement, and return a list of layers.

> processLayer: function( | layerArray,
> | layer | )

Recursive function to get back a flat list of layers from the hierarchic layer structure.

> write: function( | context,
> | options | )

Read and write XML.
Read and write OWS Context documents.
Close