Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Another boring XML question. URGENT

Another boring XML question. URGENT

Scheduled Pinned Locked Moved XML / XSL
wpfxmlquestionwcfannouncement
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Etienne_123
    wrote on last edited by
    #1

    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?

    C K 2 Replies Last reply
    0
    • E Etienne_123

      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?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      E 1 Reply Last reply
      0
      • C Christian Graus

        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

        E Offline
        E Offline
        Etienne_123
        wrote on last edited by
        #3

        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.

        C 1 Reply Last reply
        0
        • E Etienne_123

          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.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • E Etienne_123

            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?

            K Offline
            K Offline
            kamagra
            wrote on last edited by
            #5

            Can you please specify the path for your XML files. So that we can look into it in broader way

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups