XmlToDictionary

<< Fare clic per visualizzazione il sommario >>

Percorso:  I servizi di Jamio openwork > Rest Service >

XmlToDictionary

Service

Rest

 

Method

XmlToDictionary

 

Description

Converts an Xml string in a Dictionary(string, object).

 

Input

Name

Description

Type

Optional

xml

A string containing data in Xml format.

String

 

fields

A list containing the names of the first-level fields to return in the Dictionary; a null or empty list implies that all fields are returned.

List of string

 

xmlFieldNames

A list containing the names of fields (regardless of the level) that have to be mapped to the corresponding fields specified in the dictionaryFieldNames list; a null or empty list implies that the field names in the Xml structure will be used as keys in the returned dictionary.

List of string

 

dictionaryFieldNames

A list containing the names of the dictionary keys corresponding to the field names specified in the xmlFieldNames list; a null or empty list implies that the field names in the Xml structure will be used as keys in the returned dictionary.

List of string

 

valuesIfNull

A Key/Value pair collection containing values to assign to the specified fields if their returned value is null.

Ex.: if valuesIfNull contains

“first_name”, “”

“trim_user”, false

the returned Dataset will have any field named “first_name” (at any level) valued with “” instead of null, and any field named “trim_user” (at any level) valued with false instead of null.

Dataset

 

Output

Name

Description

Type

Optional

returnValue

A dataset.

Dataset

 

 

Remarks

The xmlFieldNames and dictionaryFieldNames lists must have the same number of elements.

As an example, if xmlFieldNames[0] = “?xml” and dictionaryFieldNames[0] = “xmlInfo” and xmlFieldNames[1] = “@pageid” and dictionaryFieldNames[1] = “pageid”, then the “?xml” field in the Xml structure will be returned as the “xmlInfo” field in the dataset and the “@pageid” field as the “pageid” field; fields not present in the xmlFieldNames list will retain their names in the returned dataset.