Finds if any managed code is being used in a form.
Inheritance: InfoPathFeature
        public static IEnumerable<InfoPathFeature> ParseFeature(XDocument document)
        {
            IEnumerable<XElement> allElements = document.Descendants(xsf2Namespace + managedCode);
            foreach (XElement element in allElements)
            {
                //The enabled attribute is typically null, so check for that.
                //If the attribute exists, then we can also check the value to make sure there's not an enabled="no" scenario.
                if(element.Attribute(enabledAttribute) == null
                    || !string.Equals(element.Attribute(enabledAttribute).Value, "yes", StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }

                //Return an object if enabled="yes"
                ManagedCode mc = new ManagedCode();
                mc.Language = element.Attribute(languageAttribute).Value;
                mc.Version = element.Attribute(versionAttribute).Value;
                yield return mc;
            }

            // nothing left
            yield break;
        }
Example #2
0
        public static IEnumerable <InfoPathFeature> ParseFeature(XDocument document)
        {
            IEnumerable <XElement> allElements = document.Descendants(xsf2Namespace + managedCode);

            foreach (XElement element in allElements)
            {
                //The enabled attribute is typically null, so check for that.
                //If the attribute exists, then we can also check the value to make sure there's not an enabled="no" scenario.
                if (element.Attribute(enabledAttribute) == null ||
                    !string.Equals(element.Attribute(enabledAttribute).Value, "yes", StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }

                //Return an object if enabled="yes"
                ManagedCode mc = new ManagedCode();
                mc.Language = element.Attribute(languageAttribute).Value;
                mc.Version  = element.Attribute(versionAttribute).Value;
                yield return(mc);
            }

            // nothing left
            yield break;
        }