Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExternalObject"/> class.
 /// </summary>
 /// <param name="attributeValueXhtml">
 /// The owning <see cref="AttributeValueXHTML"/>
 /// </param>
 public ExternalObject(AttributeValueXHTML attributeValueXhtml)
 {
     this.Owner = attributeValueXhtml;
 }
        /// <summary>
        /// Generates a <see cref="SpecElementWithAttributes"/> object from its XML representation.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        public override void ReadXml(XmlReader reader)
        {
            base.ReadXml(reader);

            using (var specElementWithAttributesReader = reader.ReadSubtree())
            {
                while (specElementWithAttributesReader.Read())
                {
                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "ALTERNATIVE-ID")
                    {
                        var alternativeId = new AlternativeId(this);
                        alternativeId.ReadXml(specElementWithAttributesReader);
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "TYPE")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            this.ReadSpecType(subtree);
                        }
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "CHILDREN")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            this.ReadHierarchy(subtree);
                        }
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && specElementWithAttributesReader.LocalName == "ATTRIBUTE-VALUE-BOOLEAN")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            var attributeValueBoolean = new AttributeValueBoolean(this);
                            attributeValueBoolean.ReadXml(subtree);
                        }
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && specElementWithAttributesReader.LocalName == "ATTRIBUTE-VALUE-DATE")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            var attributeValueDate = new AttributeValueDate(this);
                            attributeValueDate.ReadXml(subtree);
                        }
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && specElementWithAttributesReader.LocalName == "ATTRIBUTE-VALUE-ENUMERATION")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            var attributeValueEnumeration = new AttributeValueEnumeration(this);
                            attributeValueEnumeration.ReadXml(subtree);
                        }
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && specElementWithAttributesReader.LocalName == "ATTRIBUTE-VALUE-INTEGER")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            var attributeValueInteger = new AttributeValueInteger(this);
                            attributeValueInteger.ReadXml(subtree);
                        }
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && specElementWithAttributesReader.LocalName == "ATTRIBUTE-VALUE-REAL")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            var attributeValueReal = new AttributeValueReal(this);
                            attributeValueReal.ReadXml(subtree);
                        }
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && specElementWithAttributesReader.LocalName == "ATTRIBUTE-VALUE-STRING")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            var attributeValueString = new AttributeValueString(this);
                            attributeValueString.ReadXml(subtree);
                        }
                    }

                    if (specElementWithAttributesReader.MoveToContent() == XmlNodeType.Element && specElementWithAttributesReader.LocalName == "ATTRIBUTE-VALUE-XHTML")
                    {
                        using (var subtree = specElementWithAttributesReader.ReadSubtree())
                        {
                            subtree.MoveToContent();
                            var attributeValueXhtml = new AttributeValueXHTML(this);
                            attributeValueXhtml.ReadXml(subtree);
                        }
                    }

                    this.ReadObjectSpecificElements(specElementWithAttributesReader);
                }
            }
        }