![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Binding, XPath & Namespaces Does anyone know if its possible to use an XPath binding into XML that uses namespaces? For example, this doesn't work, because I haven't defined the namespaces: <Grid> <Grid.Resources> <XmlDataProvider x:Key="data"> <data:root xmlns:data="http://data"> <data:item>blah</data:item> </data:root> </XmlDataProvider> </Grid.Resources> <TextBlock Text="{Binding Source={StaticResource data}, XPath=/data:root/data:item}" /> </Grid> Instead I get the exception: XPathException:Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function. But, how can I provide it? - Doug |
| | #2 (permalink) |
| Guest | Re: Binding, XPath & Namespaces Doug wrote: > Does anyone know if its possible to use an XPath binding into XML that > uses namespaces? > > ... code snipped for brevity ... > > But, how can I provide it? This[1] should explain it. HTH, Drew [1] http://winfx.msdn.microsoft.com/libr...e18fc4284b.asp |
| | #3 (permalink) |
| Guest | Re: Binding, XPath & Namespaces Wow, how on earth did I not find that! Thanks! - Doug > Doug wrote: > >> Does anyone know if its possible to use an XPath binding into XML >> that uses namespaces? >> >> ... code snipped for brevity ... >> >> But, how can I provide it? >> > This[1] should explain it. > > HTH, > Drew > [1] > http://winfx.msdn.microsoft.com/libr.../library/en-us > /wcp_conceptual/html/a47c832f-dc84-48f2-96d5-cde18fc4284b.asp > |
| | #4 (permalink) |
| Guest | Re: Binding, XPath & Namespaces Unfortunately I can't work out what this maps to in the November SDK. XmlDataNameSpaceManager is gone. Now it looks like it might be the System.Xml.XmlNamespaceManager from System.Xml.dll, but I'm having a bit of trouble creating it with XAML. - Doug > Wow, how on earth did I not find that! Thanks! > > - Doug > >> Doug wrote: >> >>> Does anyone know if its possible to use an XPath binding into XML >>> that uses namespaces? >>> >>> ... code snipped for brevity ... >>> >>> But, how can I provide it? >>> >> This[1] should explain it. >> >> HTH, >> Drew >> [1] >> http://winfx.msdn.microsoft.com/libr...=/library/en-u >> s >> /wcp_conceptual/html/a47c832f-dc84-48f2-96d5-cde18fc4284b.asp |
| | #5 (permalink) |
| Guest | Re: Binding, XPath & Namespaces Looks like I jumped the gun. XmlDataNameSpaceManager which was a subclass of XmlNamespaceManager has been removed. Instead this can be done using the utility subclass XmlNamespaceMappingCollection (probably just the same thing with a new name). For example: <XmlNamespaceMappingCollection x:Key="myNamespaces"> <XmlNamespaceMapping Prefix="y" Uri="http://schemas.somecompany.com/12/2005/y" /> </XmlNamespaceMappingCollection> - Doug > Unfortunately I can't work out what this maps to in the November SDK. > > XmlDataNameSpaceManager is gone. Now it looks like it might be the > System.Xml.XmlNamespaceManager from System.Xml.dll, but I'm having a > bit of trouble creating it with XAML. > > - Doug > >> Wow, how on earth did I not find that! Thanks! >> >> - Doug >> >>> Doug wrote: >>> >>>> Does anyone know if its possible to use an XPath binding into XML >>>> that uses namespaces? >>>> >>>> ... code snipped for brevity ... >>>> >>>> But, how can I provide it? >>>> >>> This[1] should explain it. >>> >>> HTH, >>> Drew >>> [1] >>> http://winfx.msdn.microsoft.com/libr...l=/library/en- >>> u >>> s >>> /wcp_conceptual/html/a47c832f-dc84-48f2-96d5-cde18fc4284b.asp |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Binding inside binding question | Yoavo | Avalon | 0 | 12-03-2007 08:24 AM |
| Binding Question (Binding in General) | Jason | Avalon | 2 | 05-09-2007 04:41 AM |
| Calling an XPath on a Binding with an XmlNode causes StackOverflowException | Keith Patrick | Avalon | 0 | 01-05-2007 10:22 AM |
| Xml Binding - Why does XPath return nothing? | jmagaram | Avalon | 0 | 10-13-2006 04:25 PM |
| Xml Binding - Why does XPath return nothing? | jmagaram | Avalon | 0 | 10-13-2006 04:24 PM |