Example #1
0
        // ============= Element Processing ==================================

        private void ReadElement()
        {
            // Accumulated text is enqueued a piece of content before this element
            EnqueueAnyText();
            _hasKeyAttribute = false;
            // Empty Elements are by definition leaf elements and they
            // don't nest.  So we don't need to stack this state.
            bool isEmptyTag = _xmlReader.IsEmptyElement;

            string prefix       = _xmlReader.Prefix;
            string strippedName = _xmlReader.LocalName;

            if (XamlName.ContainsDot(strippedName))
            {
                Debug.Assert(_xmlReader.NodeType == XmlNodeType.Element);
                XamlPropertyName name = XamlPropertyName.Parse(_xmlReader.Name, _xmlReader.NamespaceURI);
                if (_scannerStack.CurrentType == null)
                {
                    throw LineInfo(new XamlParseException(SR.Get(SRID.ParentlessPropertyElement, _xmlReader.Name)));
                }
                ReadPropertyElement(name, _scannerStack.CurrentType, _scannerStack.CurrentTypeNamespace, isEmptyTag);
            }
            else
            {
                XamlName name = new XamlQualifiedName(prefix, strippedName);
                ReadObjectElement(name, isEmptyTag);
            }
        }
Example #2
0
        private void ReadElement()
        {
            this.EnqueueAnyText();
            this._hasKeyAttribute = false;
            bool   isEmptyElement = this._xmlReader.IsEmptyElement;
            string prefix         = this._xmlReader.Prefix;
            string localName      = this._xmlReader.LocalName;

            if (XamlName.ContainsDot(localName))
            {
                XamlPropertyName name = XamlPropertyName.Parse(this._xmlReader.Name, this._xmlReader.NamespaceURI);
                if (this._scannerStack.CurrentType == null)
                {
                    throw this.LineInfo(new XamlParseException(System.Xaml.SR.Get("ParentlessPropertyElement", new object[] { this._xmlReader.Name })));
                }
                this.ReadPropertyElement(name, this._scannerStack.CurrentType, this._scannerStack.CurrentTypeNamespace, isEmptyElement);
            }
            else
            {
                XamlName name2 = new XamlQualifiedName(prefix, localName);
                this.ReadObjectElement(name2, isEmptyElement);
            }
        }