Skip to content
Last updated

API / geotoolkit / report / parsers / NodeParser / NodeParser

Class: NodeParser

parsers.NodeParser.NodeParser

Hierarchy

Table of contents

Constructors
  • [new NodeParser(nodeName, nodeType)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.report.parsers.nodeparser.nodeparser.md#new nodeparser(nodename, nodetype))
Methods

Contents

Constructors

new NodeParser(nodeName, nodeType)

• Protected new NodeParser(nodeName?, nodeType?)

Parameters

Name Type
Optional nodeNamestring
Optional nodeTypenumber
Methods

addElements

▸ addElements(childElements, context): ParserContext

add child elements

Parameters

Name Type
childElementsParserContext[]
contextParserContext

Returns

ParserContext


createElement

▸ Abstract createElement(node, context): ParserContext

Create element associated with node

Parameters

Name Type Description
nodeElement | Node
contextParserContextThe parsing context to be used to parse the node

Returns

ParserContext


getAttribute

▸ getAttribute(node, attrName, defaultValue?): string

Extracts requested attribute from provided node

Parameters

Name Type Description
nodeElement | NodeXML node
attrNamestringThe name of attribute to obtain
Optional defaultValuestringdefault value

Returns

string

Value of the attribute


getClassName

▸ getClassName(): string

Returns

string


getName

▸ getName(): string

Return parser name

Returns

string


getType

▸ getType(): number

Return node type

Returns

number


parseAttributes

▸ Protected parseAttributes(node, context): ParserContext

Parameters

Name Type Description
nodeElement | Nodenode to parse
contextParserContextparser context

Returns

ParserContext


parseElement

▸ parseElement(node, context): ParserContext

Parameters

Name Type Description
nodeElement | Nodenode
contextParserContextcontext

Returns

ParserContext


tryParseArray

▸ Protected tryParseArray(value): any

Parse string into array of objects, assuming that string value looks like "[value,value,value]" for example "[10,20,30,75.8999,36]" or "[x:10;y:20,x:15;y:45]" <polygon path="x:[1,2,3,4,5];y:[5,4,3,2,1]"/>

Parameters

Name Type Description
valuestringvalue

Returns

any


tryParseJSON

▸ Protected tryParseJSON(value): object

Parse string in to object, assuming that string value looks like "name:value;name:value" for example <group bounds="x:10;y:10;width:100;height:200" limits="auto"/> or <group layoutstyle="left:50%;top:50%;right:0;bottom:0" limits="auto"/>

Parameters

Name Type Description
valuestringvalue

Returns

object


tryParseValue

▸ Protected tryParseValue(value): string | number | boolean

Try parse value to avoid converting it later in run-time

Parameters

Name Type Description
valuestringvalue

Returns

string | number | boolean


getAttribute

▸ Static getAttribute(node, attrName, defaultValue?): string

Extracts requested attribute from provided node

Parameters

Name Type Description
nodeElement | NodeXML node
attrNamestringThe name of attribute to obtain
Optional defaultValuestringdefault value

Returns

string

Value of the attribute


tryParseArray

▸ Static tryParseArray(value): any

Parse string into array of objects, assuming that string value looks like "[value,value,value]" for example "[10,20,30,75.8999,36]" or "[x:10;y:20,x:15;y:45]" <polygon path="x:[1,2,3,4,5];y:[5,4,3,2,1]"/>

Parameters

Name Type Description
valuestringvalue

Returns

any


tryParseJSON

▸ Static tryParseJSON(value): object

Parse string in to object, assuming that string value looks like "name:value;name:value" for example <group bounds="x:10;y:10;width:100;height:200" limits="auto"/> or <group layoutstyle="left:50%;top:50%;right:0;bottom:0" limits="auto"/>

Parameters

Name Type Description
valuestringvalue

Returns

object


tryParseValue

▸ Static tryParseValue(value): string | number | boolean

Try parse value to avoid converting it later in run-time

Parameters

Name Type Description
valuestringvalue

Returns

string | number | boolean