Exemplo n.º 1
0
        public void Load(XmlReader xml)
        {
            _xml = xml;

            List <CompendiumViewRelationship> viewRelationships = new List <CompendiumViewRelationship>();

            if (_xml != null && _xml.NodeType == XmlNodeType.Element && _xml.Name == CompendiumDocumentTag)
            {
                while (_xml.Read())
                {
                    if (_xml.NodeType == XmlNodeType.Element)
                    {
                        switch (_xml.Name)
                        {
                        case NodeDetailsTag:
                            XmlCompendiumNode node = new XmlCompendiumNode(_xml);
                            _nodes.Add(node.Id, node);
                            break;

                        case LinkRelationshipTag:
                            CompendiumLinkRelationship nodeRelationship = new CompendiumLinkRelationship();
                            nodeRelationship.ConsumeLinkXml(_nodes, _xml);
                            break;

                        case ViewRelationshipTag:
                            CompendiumViewRelationship viewRelationship = new CompendiumViewRelationship();
                            viewRelationship.ConsumeViewXml(_xml);
                            viewRelationships.Add(viewRelationship);
                            break;

                        default:
                            break;
                        }
                    }
                    else if (_xml.NodeType == XmlNodeType.EndElement)
                    {
                        if (_xml.Name == CompendiumDocumentTag)
                        {
                            break;
                        }
                    }
                }
            }

            foreach (CompendiumViewRelationship viewRelationship in viewRelationships)
            {
                viewRelationship.BuildRelationships(_nodes);
            }
        }
Exemplo n.º 2
0
        public void Load(XmlReader xml)
        {
            _xml = xml;

            List<CompendiumViewRelationship> viewRelationships = new List<CompendiumViewRelationship>();

            if (_xml != null && _xml.NodeType == XmlNodeType.Element && _xml.Name == CompendiumDocumentTag)
            {
                while (_xml.Read())
                {
                    if (_xml.NodeType == XmlNodeType.Element)
                    {
                        switch (_xml.Name)
                        {
                            case NodeDetailsTag:
                                XmlCompendiumNode node = new XmlCompendiumNode(_xml);
                                _nodes.Add(node.Id, node);
                                break;

                            case LinkRelationshipTag:
                                CompendiumLinkRelationship nodeRelationship = new CompendiumLinkRelationship();
                                nodeRelationship.ConsumeLinkXml(_nodes, _xml);
                                break;

                            case ViewRelationshipTag:
                                CompendiumViewRelationship viewRelationship = new CompendiumViewRelationship();
                                viewRelationship.ConsumeViewXml(_xml);
                                viewRelationships.Add(viewRelationship);
                                break;

                            default:
                                break;
                        }
                    }
                    else if (_xml.NodeType == XmlNodeType.EndElement)
                    {
                        if (_xml.Name == CompendiumDocumentTag)
                        {
                            break;
                        }
                    }
                }
            }

            foreach (CompendiumViewRelationship viewRelationship in viewRelationships)
            {
                viewRelationship.BuildRelationships(_nodes);
            }
        }