Esempio n. 1
0
        object FillColumn(ContentIterator iter, Shape shape)
        {
            object val;

            switch (shape.BindingType)
            {
            case BindingType.Element:
                val = iter.Node;
                iter.Next();
                break;

            case BindingType.ElementNested: {
                ArrayList rows = new ArrayList();
                rows.Add(iter.Node);
                iter.Next();
                val = new XPathDocumentView(null, rows, shape.NestedShape);
                break;
            }

            case BindingType.Repeat: {
                ArrayList rows     = new ArrayList();
                Shape     subShape = shape.SubShape(0);
                if (subShape.BindingType == BindingType.ElementNested)
                {
                    Shape             nestShape = subShape.NestedShape;
                    XPathDocumentView xivc      = new XPathDocumentView(null, null, nestShape);
                    XPathNode         nd;
                    while (null != (nd = iter.Node) &&
                           subShape.IsParticleMatch(iter.Particle))
                    {
                        rows.Add(nd);
                        iter.Next();
                    }
                    xivc.SetRows(rows);
                    val = xivc;
                }
                else
                {
                    XPathDocumentView xivc = new XPathDocumentView(null, null, subShape);
                    XPathNode         nd;
                    while (null != (nd = iter.Node) &&
                           shape.IsParticleMatch(iter.Particle))
                    {
                        rows.Add(xivc.FillSubRow(iter, subShape, null));
                    }
                    xivc.SetRows(rows);
                    val = xivc;
                }
                break;
            }

            case BindingType.Sequence:
            case BindingType.Choice:
            case BindingType.All: {
                XPathDocumentView docview = new XPathDocumentView(null, null, shape);
                ArrayList         rows    = new ArrayList();
                rows.Add(docview.FillSubRow(iter, shape, null));
                docview.SetRows(rows);
                val = docview;
                break;
            }

            default:
            case BindingType.Text:
            case BindingType.Attribute:
                throw new NotSupportedException();
            }
            return(val);
        }
        object FillColumn(ContentIterator iter, Shape shape) {
            object val;
            switch (shape.BindingType) {
                case BindingType.Element:
                    val = iter.Node;
                    iter.Next();
                    break;

                case BindingType.ElementNested: {
                    ArrayList rows = new ArrayList();
                    rows.Add(iter.Node);
                    iter.Next();
                    val = new XPathDocumentView(null, rows, shape.NestedShape);
                    break;
                }

                case BindingType.Repeat: {
                    ArrayList rows = new ArrayList();
                    Shape subShape = shape.SubShape(0);
                    if (subShape.BindingType == BindingType.ElementNested) {
                        Shape nestShape = subShape.NestedShape;
                        XPathDocumentView xivc = new XPathDocumentView(null, null, nestShape);
                        XPathNode nd;
                        while (null != (nd = iter.Node)
                            && subShape.IsParticleMatch(iter.Particle)) {
                            rows.Add(nd);
                            iter.Next();
                        }
                        xivc.SetRows(rows);
                        val = xivc;
                    }
                    else {
                        XPathDocumentView xivc = new XPathDocumentView(null, null, subShape);
                        XPathNode nd;
                        while (null != (nd = iter.Node)
                            && shape.IsParticleMatch(iter.Particle)) {
                            rows.Add(xivc.FillSubRow(iter, subShape, null));
                        }
                        xivc.SetRows(rows);
                        val = xivc;
                    }
                    break;
                }

                case BindingType.Sequence:
                case BindingType.Choice:
                case BindingType.All: {
                    XPathDocumentView docview = new XPathDocumentView(null, null, shape);
                    ArrayList rows = new ArrayList();
                    rows.Add(docview.FillSubRow(iter, shape, null));
                    docview.SetRows(rows);
                    val = docview;
                    break;
                }

                default:
                    case BindingType.Text:
                case BindingType.Attribute:
                    throw new NotSupportedException();
            }
            return val;
        }