internal bool IsXmlNamespaceSupported(string xmlNamespace, out string newXmlNamespace) { string str; string fullName; if (((this._mergedSettings.LocalAssembly != null) && ClrNamespaceUriParser.TryParseUri(xmlNamespace, out str, out fullName)) && string.IsNullOrEmpty(fullName)) { fullName = this._mergedSettings.LocalAssembly.FullName; newXmlNamespace = ClrNamespaceUriParser.GetUri(str, fullName); return(true); } bool flag = this._context.SchemaContext.TryGetCompatibleXamlNamespace(xmlNamespace, out newXmlNamespace); if (newXmlNamespace == null) { newXmlNamespace = string.Empty; } return(flag); }
private XamlNamespace GetXamlNamespace(string xmlns) { XamlNamespace namespace2 = null; string str; string str2; if (this.NamespaceByUriList.TryGetValue(xmlns, out namespace2)) { return(namespace2); } if (ClrNamespaceUriParser.TryParseUri(xmlns, out str, out str2)) { namespace2 = new XamlNamespace(this, str, str2); } else { namespace2 = new XamlNamespace(this); } return(TryAdd <string, XamlNamespace>(this.NamespaceByUriList, xmlns, namespace2)); }
// Return true if the passed namespace is known, meaning that it maps // to a set of assemblies and clr namespaces internal bool IsXmlNamespaceSupported(string xmlNamespace, out string newXmlNamespace) { // 4 cases: refer to Framework\XamlParser.IsXmlNamespaceSupported // startins with clr-namespace: // Namespace is known // http://schemas.microsoft.com/winfx/2006/xaml/presentation/options // We're inside of a XmlDataIsland // First, substitute in the LocalAssembly if needed if (_mergedSettings.LocalAssembly != null) { string clrNs, assemblyName; if (ClrNamespaceUriParser.TryParseUri(xmlNamespace, out clrNs, out assemblyName) && String.IsNullOrEmpty(assemblyName)) { assemblyName = _mergedSettings.LocalAssembly.FullName; newXmlNamespace = ClrNamespaceUriParser.GetUri(clrNs, assemblyName); return(true); } } bool result = _context.SchemaContext.TryGetCompatibleXamlNamespace(xmlNamespace, out newXmlNamespace); if (newXmlNamespace == null) { newXmlNamespace = string.Empty; } // we need to treat all namespaces inside of XmlDataIslands as Supported. // we need to tree Freeze as known, if it is around... don't hardcode. //else if (xmlNamespace == XamlReaderHelper.PresentationOptionsNamespaceURI) //{ // // PresentationOptions is expected to be marked as 'ignorable' in most Xaml // // so that other Xaml parsers don't have to interpret it, but this parser // // does handle it to support it's Freeze attribute. // return true; //} return(result); }
public virtual string GetPreferredPrefix(string xmlns) { string prefixForClrNs; if (xmlns == null) { throw new ArgumentNullException("xmlns"); } this.UpdateXmlNsInfo(); if (this._preferredPrefixes == null) { this.InitializePreferredPrefixes(); } if (this._preferredPrefixes.TryGetValue(xmlns, out prefixForClrNs)) { return(prefixForClrNs); } if (XamlLanguage.XamlNamespaces.Contains(xmlns)) { prefixForClrNs = "x"; } else { string str2; string str3; if (ClrNamespaceUriParser.TryParseUri(xmlns, out str2, out str3)) { prefixForClrNs = this.GetPrefixForClrNs(str2, str3); } else { prefixForClrNs = "p"; } } return(TryAdd <string, string>(this._preferredPrefixes, xmlns, prefixForClrNs)); }