Parse XML

Parse XML

First I add code and External Assemblies to the .NET GLobal section of the Mapping tab:

using System;
using System.Collections.Generic;
using System.Xml;
XmlDocument demographicsXML = new XmlDocument();
XmlNodeList nodes;

External Assemblies: System.dll,,System.Xml.dll,System.Data.dll

Second I populate the global variables using a Repeat Each Row Before Operation:

using System;
using System.Collections.Generic;
using System.Xml;
void CSharpProcedure()
{
 string demographicsString = "<Demographics>"+Starfish.OriginData["DEMOGRAPHICS"].ToString()+"</Demographics>";
 demographicsXML.LoadXml(demographicsString);
 nodes = demographicsXML.DocumentElement.SelectNodes("/Demographics");
}

Third, I populate a field with data from the global variable:

object ScriptedField()
{
 string res = "";
 foreach (XmlNode node in nodes)
 {
  res = node["EXTITLE"].InnerText;
 }
 return res;
}
    • Related Articles

    • Validate and parse JSON

      This is a link to a page that will validate/parse your JSON: http://jsonlint.com/
    • XML (Xpath) Connector

      There is currently no text on this page. Parameter Description File Root Element Name Namespace XML Connection Edit Screen
    • Parse text and look up ID based on result

      This script parses out the first Lead Source from a comma or semi-colon separated list and then gets the Lead Source ID from an xRef list. Function ScriptedField Dim ls Dim res ls = "@@ORG:CUSTOM07@@" If Len(ls) <> 2 Then If InStr(ls,",") > 0 Then ls ...
    • File System Connector

      File System Origin The File System Connector reads all files from a folder specified in the Directory field. The Username and Password fields are not used. Filter can be used to filter for certain file names/extensions. To search for all files with ...
    • Estated Connnector

      Establishing a connection In the API Token box, paste the API Token that has been provided to you in your Estated account. Find it under Property Data API -> API Keys. If you are just testing, you can use the Sandbox Key provided. You must then also ...