Q:

Getting list of Variables of map in BPM Metastorm

I'm trying to get list of variables in some map OUTSIDE program automatically. I know I can find them in .process file, with has xml structure.
I also figured out that "x:object" with variable contains "x:Type" ending with "MboField}".
But unfortunately I need to narrow searching criterias more, because I still can't find the main patern to separate variables from other objects.
This is my current code in c#:
            var xdoc = XDocument.Load(patches.ProcessFilePatch);
        var xmlns = XNamespace.Get("http://schema.metastorm.com/Metastorm.Common.Markup");

        IEnumerable<string> values = from x in xdoc.Descendants(xmlns+"Object")
                                     where x.Attribute(xmlns+"Type").Value.ToString().EndsWith("MboField}")
                                     select x.Attribute(xmlns+"Name").Value.ToString();

        VariablesInProcessFile = values.ToList();

Any other ways to find Variables among others?

A:

    private void getVariablesInProcessFile()
    {
        var xdoc = XDocument.Load(patches.ProcessFilePatch);
        var xmlns = XNamespace.Get("http://schema.metastorm.com/Metastorm.Common.Markup");

       var dane = xdoc.Descendants(xmlns + "Object").Where(x => CheckAttributes(x, xmlns)).ToArray();

        IEnumerable<string> valuesE = from x in dane.Descendants(xmlns + "Object")
                                       where x.Attribute(xmlns + "Type").Value.ToString().EndsWith("MboField}")
                                       select x.Attribute(xmlns + "Name").Value.ToString();

        VariablesInProcessFile = valuesE.ToList();
    }

    private bool CheckAttributes(XElement x, XNamespace xmlns)
    {
        var wynik = x.Attribute(xmlns + "Name");

        return wynik != null && (wynik.Value == patches.MapName + "Data" || wynik.Value == patches.altMapName + "Data");
    }

Where "patches" is my own class containing patch to .process file and possible names of group of Variables, usually related to name of the map.

