dcsimg
A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 53

Thread: 'id' attribute in my XML file - strange things happening

  1. #21
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    Actually... to defend the 'old' way of browsing an XML tree... it doesn't have to be that bad. It can be easier than what most people end up making it...

  2. #22
    Junior Member
    Join Date
    Mar 2002
    Posts
    7
    Yeah, well I'm liking this one better.

  3. #23
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Everything has its place. The real trick is knowing when to use to what.

    That is typically when you see people with experience really shine through.

    Thanks

    Luke

  4. #24
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    It's so good to hear from other developers who think the way I do...

    Too many people think that one-size-fits-all... it's a shame really.

    Oh well!

  5. #25
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    More often than not it is the "one size fits all" type scenario that people end up in problem.

    Typically it comes from the attitude of: "I know Visual Basic, so therefore every solution can be solved in Visual Basic". While this might be true and there might some situations where VB is the right solution, there are a lot of situations where VB isn't the right solution. I see heaps of developers who are "VB and only VB" who spend hours creating a text manipulation app that could be done in 5 lines of Perl.

    Although I am not a big fan of VB I can think of one perfectly good reason to use VB:

    http://www.fosters.com.au/corporate/...vic_bitter.asp

    And it should be used a lot!

    :-)

  6. #26
    Junior Member
    Join Date
    Mar 2002
    Posts
    7

    Smile

    Well, like I said, I am new to Flash and XML... I don't expect this to be a one thing fits all solution, but as I am working with small XML files generated by a PHP backend... this method is a lot simpler to get a handle on then the others I've been working with. I have a deep background in DHTML (javanscript, css, html, etc...) so I know what you mean, and I'm sure I'll know exactly what you mean in relation to Flash soon... but what can I say, I'm getting there!

  7. #27
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035

    Lightbulb

    Weren't talking about you, just u often see a: "this is the ultimate solution to all our problem, I am off to bring about World Peace with this solution"* Which I don't think you have in this case.

    *That is of course unless you are talking to Perl programmers. Please don't shatter their dreams ;-)

    Thanks

    Luke

  8. #28
    Junior Member
    Join Date
    Apr 2001
    Posts
    7

    Thumbs up Re: Wow!

    Okay, Tupps gives a good example of using this feature: fast indexing of XML sections.

    NeoTritium's example, however, really bothers me. What's the point of putting stuff into XML, which is designed as a structured hierarchy, only to dive through it willy-nilly? You might as well just stuff all your data into GET/POST and be done with it.

    I'm not trying to rag on anyone, I'm just suggesting that this technology can be used improperly ... my two cents.

  9. #29
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    NeoTritium's example is perfect - if he plans on letting others have access to the script that generates the XML...

    I think that's one of the larger benefits to an XML structured definition to data... sharing the data with different methods of representation.

    More and more you're seeing technology come along that helps the designer/developer bridge gaps that have existed - XML is one that bridges several gaps, and does it nicely... combined with Flash, it's a perfect way to display your information through the web - on almost any platform, os, or device...

    I could go on, but my point is - I use XML when I want to insure the easiest transfer of data -> presentation on the widest base possible wth the littlest 'restructuring' necessary.

  10. #30
    Junior Member
    Join Date
    Apr 2001
    Posts
    7
    I agree with your assessment of XML and it's exactly why I don't like this use of the ID element.

    One of the reasons XML has been successful at bridging those gaps is because its syntax is tight: for example, you must always have quotes around values, there must be a closing tag for every open tag, etc. This use of the ID tag just becomes an excuse to bypass the structure of the document.

    Another reason is that, if you're sharing your data, other users of your data will know exactly how to use it. As you pointed out, "it's a perfect way to display your information through the web - on almost any platform, os, or device". But that will be impossible if you are using the data in a way that those sharing your data will not understand. They will expect to have to parse your data according to the given structure, while you are designing with the intent of bypassing the structure by using IDs.

    You say that "NeoTritium's example is perfect - if he plans on letting others have access to the script that generates the XML" but I am saying that he shouldn't have to because the XML should be self-descriptive.

  11. #31
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    How about an example??

    You write a book. I buy the book. I put sticky notes in the parts that I want to be able to get to quickly... ofcourse sticky notes == id attributes.

    That's all I'm getting at. Not that id attributes should eb the only way to 'browse' the information - there need to be chapters... paragraphs.. blah... blah - but it's nice to be able to create a shortcut to the data that you need at the particular time.

    Someone else might want other data, and/or they might want it in a different way - id attributes are not the 'one-size-fits-all' that some look for.

    I agree with you that if you will only ever need just that one value.... slap it with the id and you've got a name/value pair. Don't waste your time with XML if you're not going to take advantage of the structured nature of it. But that doesn't mean I won't like using my sticky notes to get to that section of my book that I like...

    On the side, but related, another reason the use the id attribute would be to eliminate uncomfortably long descriptions of 'where' the data is. You have to agree that typing::

    myXML.thisElement

    is a much faster method than typing::

    myXML.firstChild.childNodes[3]

    Which could go on for quite a while!

  12. #32
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    Oh - and about being self-descriptive.... id attributes help fulfill that ability of XML - they just do it in a more direct way (Which might not be what you're looking for... again I don't believe there is a one-size-fits-all answer to life).

  13. #33
    Junior Member
    Join Date
    Mar 2002
    Posts
    7

    Re: Re: Wow!

    Originally posted by Opus42
    What's the point of putting stuff into XML, which is designed as a structured hierarchy, only to dive through it willy-nilly? You might as well just stuff all your data into GET/POST and be done with it.
    Because I would like to put my data into a format that can be interpreted through multiple technologies. A stand-alone Flash app can pull XML data in across all platforms easily... or say I want to throw up a headlines section on a none-flash site... anything that can interpret XML can interpret my data this way. I am not using the ID attributes to replace a good structure, but for MY purposes they are a big help as they take out a lot of the complexities.

    Like Vaykent & tupps keep saying, this isn't a end-all solution... this just happens to be a solution that works well for ME. So do we have this straight that I like this solution and that I'm not saying anyone else has to use it?

  14. #34
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    One use I can think of for this is:

    Take XML document and parse it into an array objects to be manipulated. When the objects are manipulated you only need the XML ID to get back to the original item, when you want to edit the data.

    Now the XML ID field has to be unique (see http://www.w3.org/TR/2000/REC-xml-20001006#id for details). You could use it much like a unique identifier in a database.

    Thanks

    Luke


  15. #35
    Junior Member
    Join Date
    Apr 2001
    Posts
    7
    Okay, okay ... uncle!

    Vaykent and Neotritium, you make good cases for using the ID element. And I suppose you could extend the bookmark idea by tapping into Flash's ability to assign variables on-the-fly, so that users could literally bookmark parts of the data as needed -- that's very cool.

    My only conern, from the beginning, was that some developers are going to take a look at this "discovery" of the ID element and take it as an example of how to parse XML. This is something that, I feel, would lead to some very bad designs and cause confusion for those who would try to re-use the data.

    Good conversation, fellas.

  16. #36
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    Which is exactly why I'm so disgusted at the general approach to take XML and immediately throw it into an array.

    You have to be careful to not limit your creativity.

    Yeah - thanks for the chit-chat!

  17. #37
    Junior Member
    Join Date
    Apr 2001
    Posts
    7

    XML

    I didn't realize that so many people were doing that. There is just so much more that you can do with XML that flattening the data out to an array seems counter-productive, and counter-intuitive when compared to the XML structure.

    I think that Macromedia did a pretty good job with their XMLnode object (although, due to speed issues, I've only really been using it in MX), so I tend to keep a reference to the data structure around and parse through it as I need to.

    Now if only Flash would support DTDs, etc. we could do some very big things.

  18. #38
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Aren't DTD's to help make sure the data is in the right format???

    I suppose there would be pro and cons to using them. Biggest con I can see is it adds extra overhead to the processing of XML. Flash is suppose to be light and fast.

    Thanks

    Luke


  19. #39
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    Yeah... I don't really see the point of a DTD... I mean I understand what they're for, but why?? Why bother checking to make sure the document has correct structure??

    If my XML documents were numerous and large, then I could see the point of automating the validation process with a DTD.... but otherwise I never even bother trying to write one.

    Then bring into that thought Flashs lackluster performance on parsing the XML, and you immediately know DTD's are not for Flash ... err... WERE not for Flash. With MX it seems to speed things up a bit - maybe even enough to handle DTD's for several large XML documents.

    I could also understand handing off your XML document to someone who doesn't understand the basic structure that you want to follow - and wanting to protect that structure by giving the document a DTD.. but that's all in the hope that whatever parser/manipulator they're using will support your DTD... oh well. I say it's not worth it right now.

  20. #40
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    DTD's are realy cool if you are getting other people to write the XML for you. Especially if they are using notepad. Can save hours of debugging. Notepad and IE can solve most of your XML problems.

    One thing that would be cool, although probably more a project for a third party developer would be to create a dynamic UI based on the DTD that was delivered.

    You know all sorts of information about the structure of the data, you could create dynamic fields for entering the data into the fields. Making it a 10 second job to create a UI to build the XML data structures. Might look into it in my spare time :-) (ETA 2010)

    Thanks

    Luke

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center