Пример #1
0
        void FillAttributes(XPathNode nd, Shape shape, object[] cols)
        {
            int i = 0;

            while (i < cols.Length)
            {
                Shape attrShape = shape.SubShape(i);
                if (attrShape.BindingType != BindingType.Attribute)
                {
                    break;
                }
                XmlQualifiedName name   = attrShape.AttributeName;
                XPathNode        ndAttr = nd.GetAttribute(name.Name, name.Namespace);
                if (null != ndAttr)
                {
                    cols[i] = ndAttr;
                }
                i++;
            }
        }
Пример #2
0
        void PopulateFromXPath(XPathNode nd, XPathStep[] steps, int step)
        {
            string ln = steps[step].name.Name;
            string ns = steps[step].name.Namespace;

            if (XPathNodeType.Attribute == steps[step].type)
            {
                XPathNode ndAttr = nd.GetAttribute(ln, ns, true);
                if (null != ndAttr)
                {
                    if (null != ndAttr.SchemaAttribute)
                    {
                        this.rows.Add(ndAttr);
                    }
                }
            }
            else
            {
                XPathNode ndChild = TreeNavigationHelper.GetElementChild(nd, ln, ns, true);
                if (null != ndChild)
                {
                    int nextStep = step + 1;
                    do
                    {
                        if (steps.Length == nextStep)
                        {
                            if (null != ndChild.SchemaType)
                            {
                                this.rows.Add(ndChild);
                            }
                        }
                        else
                        {
                            PopulateFromXPath(ndChild, steps, nextStep);
                        }
                        ndChild = TreeNavigationHelper.GetElementSibling(ndChild, ln, ns, true);
                    } while (null != ndChild);
                }
            }
        }