Another boring XML question. URGENT
-
Hi I have 2 XML files. The one looks like the following at the top:
<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
And the other one as follows:
<?xml version="1.0" standalone="yes" ?>
- <dsParrys_offoice_furniture xmlns="http://tempuri.org/dsParrys\_offoice\_furniture.xsd">
I use the following in my XAML to bind to them:
<!--XmlDataProvider used to populate treeview-->
<XmlDataProvider x:Key="dpNewDS" XPath="*"/><!--ProductRange template--> <HierarchicalDataTemplate DataType="ProductRange" ItemsSource="{Binding XPath=\*}"> <WrapPanel> <TextBlock Text="{Binding XPath=ProductRangeDesc}"/> </WrapPanel> </HierarchicalDataTemplate> <!--Products template--> <HierarchicalDataTemplate DataType="Products" ItemsSource ="{Binding XPath=Products}"> <WrapPanel> <TextBlock Text="{Binding XPath=Product}"/> </WrapPanel> </HierarchicalDataTemplate>
As well as these lines in the code behind file: NOTE: I specify the path to the XML files using an OpenFileDialog
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileName = ofd.FileName;
XmlDataProvider dp = this.FindResource("dpNewDS") as XmlDataProvider;
dp.Source = new Uri(fileName);
}Now when I select the FIRST XML file my treeview binds fine, but when I select to the 2nd one (the one with the XMLNS defined), it does not bind correctly. Is there something I should change in my XAML when binding to the 2nd XML file?
-
Hi I have 2 XML files. The one looks like the following at the top:
<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
And the other one as follows:
<?xml version="1.0" standalone="yes" ?>
- <dsParrys_offoice_furniture xmlns="http://tempuri.org/dsParrys\_offoice\_furniture.xsd">
I use the following in my XAML to bind to them:
<!--XmlDataProvider used to populate treeview-->
<XmlDataProvider x:Key="dpNewDS" XPath="*"/><!--ProductRange template--> <HierarchicalDataTemplate DataType="ProductRange" ItemsSource="{Binding XPath=\*}"> <WrapPanel> <TextBlock Text="{Binding XPath=ProductRangeDesc}"/> </WrapPanel> </HierarchicalDataTemplate> <!--Products template--> <HierarchicalDataTemplate DataType="Products" ItemsSource ="{Binding XPath=Products}"> <WrapPanel> <TextBlock Text="{Binding XPath=Product}"/> </WrapPanel> </HierarchicalDataTemplate>
As well as these lines in the code behind file: NOTE: I specify the path to the XML files using an OpenFileDialog
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileName = ofd.FileName;
XmlDataProvider dp = this.FindResource("dpNewDS") as XmlDataProvider;
dp.Source = new Uri(fileName);
}Now when I select the FIRST XML file my treeview binds fine, but when I select to the 2nd one (the one with the XMLNS defined), it does not bind correctly. Is there something I should change in my XAML when binding to the 2nd XML file?
Don't say it's urgent. It's not, we really don't care. Did you cross post this, or did you fail to post it in the WPF forum ?
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
Don't say it's urgent. It's not, we really don't care. Did you cross post this, or did you fail to post it in the WPF forum ?
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
If you don't have an answer to post, why bother to reply? Seriously. And don't refer to "we" when its just you replying, please. This HAS got to do with XML by the way, as well as WPF. When I post this sort of question in the WPF forums I get told that I should post it in the XML forum, now when I post it here I get told I should post it in the WPF forum.
-
If you don't have an answer to post, why bother to reply? Seriously. And don't refer to "we" when its just you replying, please. This HAS got to do with XML by the way, as well as WPF. When I post this sort of question in the WPF forums I get told that I should post it in the XML forum, now when I post it here I get told I should post it in the WPF forum.
Well, I'm sorry that someone told you that, because it seems to me that it has to do with how WPF parses XML, not just XML. So, you'll have more luck in the WPF forum. And I suggest that entirely to try to help you find an answer. I said 'we' because I'm referring to community standards. It's rude to tell us that your question is urgent. If you can't wait for a free answer, find a way to pay for one.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
Hi I have 2 XML files. The one looks like the following at the top:
<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
And the other one as follows:
<?xml version="1.0" standalone="yes" ?>
- <dsParrys_offoice_furniture xmlns="http://tempuri.org/dsParrys\_offoice\_furniture.xsd">
I use the following in my XAML to bind to them:
<!--XmlDataProvider used to populate treeview-->
<XmlDataProvider x:Key="dpNewDS" XPath="*"/><!--ProductRange template--> <HierarchicalDataTemplate DataType="ProductRange" ItemsSource="{Binding XPath=\*}"> <WrapPanel> <TextBlock Text="{Binding XPath=ProductRangeDesc}"/> </WrapPanel> </HierarchicalDataTemplate> <!--Products template--> <HierarchicalDataTemplate DataType="Products" ItemsSource ="{Binding XPath=Products}"> <WrapPanel> <TextBlock Text="{Binding XPath=Product}"/> </WrapPanel> </HierarchicalDataTemplate>
As well as these lines in the code behind file: NOTE: I specify the path to the XML files using an OpenFileDialog
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileName = ofd.FileName;
XmlDataProvider dp = this.FindResource("dpNewDS") as XmlDataProvider;
dp.Source = new Uri(fileName);
}Now when I select the FIRST XML file my treeview binds fine, but when I select to the 2nd one (the one with the XMLNS defined), it does not bind correctly. Is there something I should change in my XAML when binding to the 2nd XML file?