// ReadObjectElement: reads the entire start tag. This may result in // more than one Scanner Nodes. The results are enqueued onto a list // rather than returned directly, then the caller can de-queue the nodes // one at a time. private void ReadObjectElement(XamlName name, bool isEmptyTag) { _typeArgumentAttribute = null; XamlScannerNode node = new XamlScannerNode(_xmlLineInfo); // Scan for xmlns(s) before attempting to resolve the type. // So while we are there, collect up all the attributes. // Enqueue the xmlns attributes first. // PostProcess and Enqueue the other attributes after. PreprocessAttributes(); node.Prefix = name.Prefix; node.IsEmptyTag = isEmptyTag; // It is possible for an application to provide XML nodes via XmlNodeReader // where the URI is defined but there was no xmlns attribute for use to resolve against. // See app Paperboy Debug.Assert(_xmlReader.NodeType == XmlNodeType.Element); string xamlNs = _xmlReader.NamespaceURI; if (xamlNs == null) { ReadObjectElement_NoNamespace(name, node); } else // if (xamlNs != null) { node.TypeNamespace = xamlNs; // First check if the XML element is a // Directive Property <x:Key> // XamlSchemaContext schemaContext = _parserContext.SchemaContext; XamlMember dirProperty = schemaContext.GetXamlDirective(xamlNs, name.Name); if (dirProperty != null) { ReadObjectElement_DirectiveProperty(dirProperty, node); } else // normal Element Case. { bool sawXData = ReadObjectElement_Object(xamlNs, name.Name, node); if (sawXData) { return; } } } _readNodesQueue.Enqueue(node); // Now add the processed attributes from the rest of the start tag. while (HaveUnprocessedAttributes) { EnqueueAnotherAttribute(isEmptyTag); } }
private static XamlMember GetDirective(MemberBase directive, XamlSchemaContext context) { var directiveName = TranslateDirectiveName(directive); var xamlMember = from ns in context.GetAllXamlNamespaces() let dir = context.GetXamlDirective(ns, directiveName) where dir != null select dir; return(new DirectiveAdapter(xamlMember.First())); }