0

I am developing a WCF REST web service in c# (.net Framework 3.5, using Visual Studio 2010) which pulls rows from an MSSQL DB. One of the columns that gets pulled is type "nvarchar(max)" and always contains a XAML formatted text string who's root node is a <section> element and contained within that are paragraph/run elements. I want to extract the inner text from the <run>element. I am trying to use the XamlReader class in the System.Windows.markup namespace to do this.

According to the msdn documentation on this class, it should have a parse method. http://msdn.microsoft.com/en-us/library/vstudio/cc663064(v=vs.90).aspx but mine does not. Intelli-sense is only giving me the following methods: CancelAsync, Equals, GetHashCode,GetType, LoadAsync, LoadCompleted and ToString.

This is the function I am trying to create (incomplete but you get the idea)

private string extractRunElementFromXaml(string inputXaml)
        {
            XamlReader xr = new XamlReader();
            Object out = xr.Parse(inputXaml); //doesnt work, no Parse method

        }

Any assistance very much appreciated. Thanks

r5d
  • 579
  • 5
  • 24
Tommy
  • 176
  • 1
  • 2
  • 17
  • Are you sure that the database field contains XAML? It seems to be XML (without A) from what you posted, maybe a simple XmlReader will do the job? – nvoigt Jun 18 '13 at 10:43
  • Thanks Nvoigt, yes its definitely XAML. The root node's xmlns confirms this `
    `
    – Tommy Jun 18 '13 at 14:45

1 Answers1

0

I think you might need Service Pack 1 installed for .NET 3.5 as the documentation at the bottom states:

Added new members: Parse(String) method, Parse(String, ParserContext) method.

SP1 feature change.

Please refer to this blog post about .NET version numbering, but for .NET 3.5 and SP1:

.NET Framework 3.5 | Original release | 3.5.21022.8 and 9.0.21022.8

.NET Framework 3.5 | Service pack 1 | 3.5.30729.1 and 9.0.30729.1

Adam Houldsworth
  • 63,413
  • 11
  • 150
  • 187
  • Thanks for that info Adam, you are probably right. I downloaded .NET 3.5 SP1 but when I tried to install it, nothing happened. I should point out that I am relatively new to .net and I wasnt sure how to check the version currently installed on my development PC. The old way was to check "Programs and Features" but when I do that, I dont see .Net 3.5 in there at all. Only 1.1 and 3 different versions of 4.5. This makes me more confused about how my project builds and runs since its target framework is 3.5 and this doesnt appear to be installed on my PC. – Tommy Jun 18 '13 at 14:43