5 Replies Latest reply on Nov 28, 2006 2:15 PM by ntsiii

    XML tag names

    KE3000
      Hi,

      Using Flex for the first time...

      I have some XML data which I have figured to read with the WebService component, and this is working well. Next I'd like to load the XML data into a datagrid, and choose which elements/attributes to display in the grid colums. Unfortunately the XML data has elements which contains a dot in the name like fx. <abc.xyz>text</abc.xyz>.
      How do I select elements with names like these?
      I have tryed to escape the dot like "abc\.xyz" but apparently this is not the way to do it - any ideas?

      Regards
        • 1. Re: XML tag names
          ntsiii Level 3
          You will need to use "bracket notation" to select these kinds of node.

          For example, try: myXML.["abc.xyz"].text().toString();

          Tracy
          • 2. Re: XML tag names
            KE3000 Level 1
            Thanks Tracy,

            I'm unable to compile your suggestion. Here's what I try to accomplish.

            Given this example xml (stripped for values):
            <Documents>
            <Document.Folder/>
            <Document.Folder/>
            </Documents>

            I'm trying to set the dataProvider property on a datagrid (I guess I could set this programmatically - anyway, I'd like to know if it's possible in the declarative way).

            This does not compile.
            dataProvider='{WS.GetFolders.lastResult.tempuri::GetFoldersResult.Documents.["Document.Fol der"]}'

            This does (but it will select any node)
            dataProvider='{WS.GetFolders.lastResult.tempuri::GetFoldersResult.Documents.*}'

            Is it possible to declare a nodename containing a dot at all?

            Regards
            • 3. Re: XML tag names
              ntsiii Level 3
              Try:
              dataProvider='{WS.GetFolders.lastResult.tempuri::GetFoldersResult.Documents["Document.Fold er"]}'

              That is take out the dot before the bracket.

              Tracy
              • 4. Re: XML tag names
                KE3000 Level 1
                Thanks Tracy.

                I'm 95% sure that I also tryed without the dot, before submitting my last reply - and this had no effect either. So I wonder what else I did wrong then, as I have just started flex and entered your suggestion - and it works perfectly...

                Kenneth


                • 5. Re: XML tag names
                  ntsiii Level 3
                  Sorry I got it wrong the first time.

                  You know, sometimes you just need to make the computer understand that you will not accept "no" for an answer.

                  Tracy