diff --git a/Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs b/Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs index e6453575e..449b887fd 100644 --- a/Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs +++ b/Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs @@ -39,17 +39,6 @@ namespace Xamarin.Forms.Build.Tasks public void Visit(ValueNode node, INode parentNode) { Context.Values[node] = node.Value; - - XmlName propertyName; - if (SetPropertiesVisitor.TryGetPropertyName(node, parentNode, out propertyName)) - { - if (propertyName.NamespaceURI == "http://schemas.openxmlformats.org/markup-compatibility/2006" && - propertyName.LocalName == "Ignorable") - { - (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List())).AddRange( - (node.Value as string).Split(',')); - } - } } public void Visit(MarkupNode node, INode parentNode) @@ -59,12 +48,6 @@ namespace Xamarin.Forms.Build.Tasks public void Visit(ElementNode node, INode parentNode) { - if (node.SkipPrefix((node.NamespaceResolver ?? parentNode.NamespaceResolver).LookupPrefix(node.NamespaceURI))) { - node.Properties.Clear(); - node.CollectionItems.Clear(); - return; - } - var typeref = node.XmlType.GetTypeReference(Module, node); TypeDefinition typedef = typeref.Resolve(); diff --git a/Xamarin.Forms.Build.Tasks/ILRootNode.cs b/Xamarin.Forms.Build.Tasks/ILRootNode.cs index 1c59cd3cd..77e1e8ca8 100644 --- a/Xamarin.Forms.Build.Tasks/ILRootNode.cs +++ b/Xamarin.Forms.Build.Tasks/ILRootNode.cs @@ -1,3 +1,4 @@ +using System.Xml; using Mono.Cecil; using Xamarin.Forms.Xaml; @@ -5,7 +6,7 @@ namespace Xamarin.Forms.Build.Tasks { class ILRootNode : RootNode { - public ILRootNode(XmlType xmlType, TypeReference typeReference) : base(xmlType, null) + public ILRootNode(XmlType xmlType, TypeReference typeReference, IXmlNamespaceResolver nsResolver) : base(xmlType, nsResolver) { TypeReference = typeReference; } diff --git a/Xamarin.Forms.Build.Tasks/SetNamescopesAndRegisterNamesVisitor.cs b/Xamarin.Forms.Build.Tasks/SetNamescopesAndRegisterNamesVisitor.cs index 477328e2a..8e03b925e 100644 --- a/Xamarin.Forms.Build.Tasks/SetNamescopesAndRegisterNamesVisitor.cs +++ b/Xamarin.Forms.Build.Tasks/SetNamescopesAndRegisterNamesVisitor.cs @@ -43,9 +43,6 @@ namespace Xamarin.Forms.Build.Tasks public void Visit(ElementNode node, INode parentNode) { - if (node.SkipPrefix((node.NamespaceResolver ?? parentNode.NamespaceResolver).LookupPrefix(node.NamespaceURI))) - return; - VariableDefinition ns; if (parentNode == null || IsDataTemplate(node, parentNode) || IsStyle(node, parentNode)) ns = CreateNamescope(); diff --git a/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs b/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs index a1c0711a2..b6bdf40b7 100644 --- a/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs +++ b/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs @@ -67,15 +67,9 @@ namespace Xamarin.Forms.Build.Tasks if (skips.Contains(propertyName)) return; - if (node.SkipPrefix((node.NamespaceResolver ?? parentNode.NamespaceResolver)?.LookupPrefix(propertyName.NamespaceURI))) - return; if (propertyName.NamespaceURI == "http://schemas.openxmlformats.org/markup-compatibility/2006" && propertyName.LocalName == "Ignorable") - { - (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List())).AddRange( - (node.Value as string).Split(',')); return; - } SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node); } @@ -85,9 +79,6 @@ namespace Xamarin.Forms.Build.Tasks public void Visit(ElementNode node, INode parentNode) { - if (node.SkipPrefix((node.NamespaceResolver ?? parentNode.NamespaceResolver)?.LookupPrefix(node.NamespaceURI))) - return; - //if this node is an IMarkupExtension, invoke ProvideValue() and replace the variable var vardef = Context.Variables[node]; var vardefref = new VariableDefinitionReference(vardef); diff --git a/Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs b/Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs index 2bf19c268..25efa439b 100644 --- a/Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs +++ b/Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs @@ -52,15 +52,9 @@ namespace Xamarin.Forms.Build.Tasks return; } - if (node.SkipPrefix((node.NamespaceResolver ?? parentNode.NamespaceResolver)?.LookupPrefix(propertyName.NamespaceURI))) - return; if (propertyName.NamespaceURI == "http://schemas.openxmlformats.org/markup-compatibility/2006" && propertyName.LocalName == "Ignorable") - { - (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List())).AddRange( - (node.Value as string).Split(',')); return; - } if (propertyName.LocalName != "MergedWith") return; SetPropertiesVisitor.SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node); diff --git a/Xamarin.Forms.Build.Tasks/XamlCTask.cs b/Xamarin.Forms.Build.Tasks/XamlCTask.cs index ae2a66d07..b119b4e99 100644 --- a/Xamarin.Forms.Build.Tasks/XamlCTask.cs +++ b/Xamarin.Forms.Build.Tasks/XamlCTask.cs @@ -300,6 +300,7 @@ namespace Xamarin.Forms.Build.Tasks rootnode.Accept(new XamlNodeVisitor((node, parent) => node.Parent = parent), null); rootnode.Accept(new ExpandMarkupsVisitor(visitorContext), null); + rootnode.Accept(new PruneIgnoredNodesVisitor(), null); rootnode.Accept(new CreateObjectVisitor(visitorContext), null); rootnode.Accept(new SetNamescopesAndRegisterNamesVisitor(visitorContext), null); rootnode.Accept(new SetFieldVisitor(visitorContext), null); @@ -427,7 +428,7 @@ namespace Xamarin.Forms.Build.Tasks } XamlParser.ParseXaml( - rootnode = new ILRootNode(new XmlType(reader.NamespaceURI, reader.Name, null), typeReference), reader); + rootnode = new ILRootNode(new XmlType(reader.NamespaceURI, reader.Name, null), typeReference, reader as IXmlNamespaceResolver), reader); break; } } diff --git a/Xamarin.Forms.Xaml.UnitTests/McIgnorable.xaml b/Xamarin.Forms.Xaml.UnitTests/McIgnorable.xaml index 1a196d7c5..2dfe1aa1b 100644 --- a/Xamarin.Forms.Xaml.UnitTests/McIgnorable.xaml +++ b/Xamarin.Forms.Xaml.UnitTests/McIgnorable.xaml @@ -12,6 +12,7 @@ +