Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default Accessing XML nodes

    Suppose this your XML:

    <content>
    <author>
    <book>
    <title>this is the title</title>
    <description>book description</description>
    <book>
    </author>
    </content>

    How can I easily retrieve the title using the nodeNames? I don't like this way
    of accessing:

    this.childNodes[0].childNodes[0].childNodes[0].childNodes[0].nodeValue

    Just because it's confusing. I would like a notation like this or something
    similar:

    content.author.book.title.nodeValue()

    Is this possible? Grtz, Bart

    Bart_Sportpaleis Guest

  2. Similar Questions and Discussions

    1. Inserting XML nodes
      I want to insert a new XML node in my XML object, but not at the end as ..appendchild() method does, but in the node position of my choice... for...
    2. Check for missing xml nodes or empty nodes
      Hi, Is it possible to check for missing or empty xml nodes "before" putting them into a table or doing a XMLSearch . Sometimes the xml will come...
    3. FreeBSD 5.3 dev nodes
      Hi all, ok, this may be a dumb question, but here goes... I have just started using the 5.X branch of FreeBSD, and needed to mount a hot swap...
    4. Creating nodes with ASP
      I have a page that lists categories on the left, and I'd like to be able to click on one, and have a node pop out, revealing subcategories so users...
    5. referencing XML nodes by name
      I would like to access the info in an XML file by name but Macromedias XML-Xtra instructions only explain how to access data via child-number eg...
  3. #2

    Default Re: Accessing XML nodes

    Wouldn't that be comfortable. Unfortunately, no. But, you can define an object
    and turn the nodes into properties of that object. Than you would have access
    with myObject.title
    Otherwise you could extend the XMLNode class but that might be even more
    confusing.
    Another option: if you don't like working with this syntax, consider the
    XMLConnector component along with a DataHolder or DataSet. This gives you the
    option of binding the XML tree visually and you don't have to work with the
    childNodes syntax.

    LuigiL Guest

  4. #3

    Default Re: Accessing XML nodes

    Bart_Sportpaleis,

    Try this freeware XPath implementation for ActionScript:
    [url]http://www.xfactorstudio.com[/url]

    This library mimics XPath which makes traversing XML structures much easier.
    You can refer to paths like directories (content/author/book/title) instead of
    the awkward approach like you've shown. After I got fed up with the
    "recommended" way to do this, I searched a while and found this and have been
    much happier with it.

    Hope this helps,

    -Chris

    chris.davis Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139