This commit is contained in:
Stephane Delcroix 2017-01-26 09:25:22 +01:00 коммит произвёл GitHub
Родитель ccf784656d
Коммит e3f193712b
4 изменённых файлов: 66 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Xaml.UnitTests.Bz40906">
<Label x:Name="label0">
<![CDATA[Foo]]>
</Label>
<Label x:Name="label1">
<![CDATA[Foo]]>Bar<![CDATA[>><<]]>
</Label>
</ContentPage>

Просмотреть файл

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Xamarin.Forms;
using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
public partial class Bz40906 : ContentPage
{
public Bz40906()
{
InitializeComponent();
}
public Bz40906(bool useCompiledXaml)
{
//this stub will be replaced at compile time
}
[TestFixture]
class Tests
{
[SetUp]
public void Setup()
{
Device.PlatformServices = new MockPlatformServices();
}
[TearDown]
public void TearDown()
{
Device.PlatformServices = null;
}
[TestCase(true)]
[TestCase(false)]
public void ParsingCDATA(bool useCompiledXaml)
{
var page = new Bz40906(useCompiledXaml);
Assert.AreEqual("Foo", page.label0.Text);
Assert.AreEqual("FooBar>><<", page.label1.Text);
}
}
}
}

Просмотреть файл

@ -406,6 +406,9 @@
<Compile Include="Issues\Unreported008.xaml.cs">
<DependentUpon>Unreported008.xaml</DependentUpon>
</Compile>
<Compile Include="Issues\Bz40906.xaml.cs">
<DependentUpon>Bz40906.xaml</DependentUpon>
</Compile>
<Compile Include="Issues\Bz45179.xaml.cs">
<DependentUpon>Bz45179.xaml</DependentUpon>
</Compile>
@ -742,6 +745,9 @@
<EmbeddedResource Include="Issues\Unreported008.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="Issues\Bz40906.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="Issues\Bz45179.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>

Просмотреть файл

@ -104,7 +104,11 @@ namespace Xamarin.Forms.Xaml
case XmlNodeType.Whitespace:
break;
case XmlNodeType.Text:
node.CollectionItems.Add(new ValueNode(reader.Value.Trim(), (IXmlNamespaceResolver)reader));
case XmlNodeType.CDATA:
if (node.CollectionItems.Count == 1 && node.CollectionItems[0] is ValueNode)
((ValueNode)node.CollectionItems[0]).Value += reader.Value.Trim();
else
node.CollectionItems.Add(new ValueNode(reader.Value.Trim(), (IXmlNamespaceResolver)reader));
break;
default:
Debug.WriteLine("Unhandled node {0} {1} {2}", reader.NodeType, reader.Name, reader.Value);