Example #1
0
        private bool ReadObjectElement_Object(string xmlns, string name, XamlScannerNode node)
        {
            if (IsXDataElement(xmlns, name))
            {
                // If XData don't Enqueue the <x:XData> node.
                // just queue the InnerXml as TEXT (w/ IsTextXML == true).
                // This will advance the "current" xml node to the </x:XData>
                // which will be skipped when we return and the main loop
                // Read()s to the "next" XmlNode.
                ReadInnerXDataSection();
                return(true);
            }

            IList <XamlTypeName> typeArgs = null;

            if (_typeArgumentAttribute != null)
            {
                string error;
                typeArgs = XamlTypeName.ParseListInternal(_typeArgumentAttribute.Value, _parserContext.FindNamespaceByPrefix, out error);
                if (typeArgs == null)
                {
                    throw new XamlParseException(_typeArgumentAttribute.LineNumber, _typeArgumentAttribute.LinePosition, error);
                }
            }
            XamlTypeName typeName = new XamlTypeName(xmlns, name, typeArgs);

            node.Type = _parserContext.GetXamlType(typeName, true);

            // Finish initializing the attributes in the context of the
            // current Element.
            PostprocessAttributes(node);

            if (_scannerStack.Depth > 0)
            {
                // Sub-elements (and Text) are the definition of Content
                _scannerStack.CurrentlyInContent = true;
            }

            if (!node.IsEmptyTag)
            {
                node.NodeType = ScannerNodeType.ELEMENT;
                _scannerStack.Push(node.Type, node.TypeNamespace);
            }
            else
            {
                node.NodeType = ScannerNodeType.EMPTYELEMENT;
            }
            return(false);
        }
Example #2
0
        private bool ReadObjectElement_Object(string xmlns, string name, XamlScannerNode node)
        {
            if (this.IsXDataElement(xmlns, name))
            {
                this.ReadInnerXDataSection();
                return(true);
            }
            IList <XamlTypeName> typeArguments = null;

            if (this._typeArgumentAttribute != null)
            {
                string str;
                typeArguments = XamlTypeName.ParseListInternal(this._typeArgumentAttribute.Value, new Func <string, string>(this._parserContext.FindNamespaceByPrefix), out str);
                if (typeArguments == null)
                {
                    throw new XamlParseException(this._typeArgumentAttribute.LineNumber, this._typeArgumentAttribute.LinePosition, str);
                }
            }
            XamlTypeName typeName = new XamlTypeName(xmlns, name, typeArguments);

            node.Type = this._parserContext.GetXamlType(typeName, true);
            this.PostprocessAttributes(node);
            if (this._scannerStack.Depth > 0)
            {
                this._scannerStack.CurrentlyInContent = true;
            }
            if (!node.IsEmptyTag)
            {
                node.NodeType = ScannerNodeType.ELEMENT;
                this._scannerStack.Push(node.Type, node.TypeNamespace);
            }
            else
            {
                node.NodeType = ScannerNodeType.EMPTYELEMENT;
            }
            return(false);
        }