A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: XML / MX & DTD's

  1. #1
    []D[][]V[][]D
    Join Date
    Feb 2001
    Location
    Clearwater - FL
    Posts
    227

    XML / MX & DTD's

    -Sitting in XML for Java class today , trying not to get used to pure Java syntax for the sake of not confusing my Ascript.....exploring the fabulous (not) possibilities of SAX and DOM and all the many ways to look busy at work using XSLT....

    ....and it occurs to me that DTD's dont seem to have any relevance to XML files intended for interpretation by Flash since there is no true linear structure in a .swf. Does anyone know anything about this specifically?

    Also, about XSLT - anyone know if it has the capability to produce .swf's, .pngs?

    Just curious - and on the curious note - what kind of projects is everybody working on with Flash and XML? Does everyone think it will be around a while?

    Frankly, I have been quite let down by XML. I am starting to share the opinion of my instructor that you can do just about everything XML can do with a pipe delimited file. Why are companies flocking to this technology? Trendy?


  2. #2
    Junior Member
    Join Date
    Feb 2003
    Location
    London, UK
    Posts
    12
    Hey.

    Well, XML can look fairly pointless, but there is genuinely a lot you can do very easily with XML you can't easily do with pipe delimited files.

    If you're just transferring data between databases, there's nothing wrong with pipe-delimited files. But to do anything else with your data, XML is a lot more powerful. Any data you can model as a tree you can encode as XML, which you can manipulate in memory and store to disk, send to other servers, stick in a db, whatever. In fact XML is basically just a tree structure - nothing new and trendy in that.

    But it's much, much easier to validate, manipulate, transform and search complex data when it's represented as an XML document than when it's represented as a pipe delimited file. And as a bonus, it's human readable.

    In addition, code which operates on XML documents is much easier to code, read and debug since you're using human readable strings. For example, to search for a node/attribute called "eventDate" in an XML file is much, much easier than going through a bunch of indexed arrays - to make sense of the data in a pipe delimited files really requires that you first stick it in a db.

    In all of the commercial projects I've worked on in the last 3 years XML has cropped up somewhere in the system, even if only as a format for configuration files (and just about every modern open-source app has at least its configuration file in XML format - human readable, easy to manipulate, allows complex data structures...)

    I think XML is here to stay. Everyone uses it because it is genuinely a very good way to represent complex data and you can manipulate it in very powerful ways using a relatively simple set of APIs.

    You can produce word documents, rtf files, and pretty much any kind of document you want from an XML doc using XML FO - go to http://www.w3.org/Style/XSL/ and check it out.

    Sorry to write an essay. Actually I'm just trying to avoid working on an XML parser in actionscript...

  3. #3
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Ahh the old XML can be done in a pipe delimted file argument.

    I agree that there has been a lot of hype about XML and people seem to be cramming it into every technology out there. This is what happens when something becomes a buzzword.

    XML is just a way to describe data. Plain and simple. However you are simply looking at a way of getting a single peice of data into a system. When you describe complex data structures the eXtensible part of XML comes into play.

    I have on a number of projects been able to add elements to my data structure, without breaking existing applications. New nodes should simply be ignored by the existing system. This makes it fantastically powerful, especially when you are talking about 100's of reports etc which have been built on your data.

    I don't see your pipe delimited file doing that.
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112
    You had specific questions. I'll answer those and then answer the non-specific.

    DTD's allow you to define an XML-based standard. If an XML processor is a validating processor, it can use a DTD to confirm that the XML document conforms to the standard. Think Quality Assurance. Think Protocol.

    As for Flash, DTD's, and XML... The XML processor in Flash is a non-validating processor - which means Flash can not use a DTD to confirm that an XML document it recieves is valid. DTD's still serve a purpose. YOU can learn the format/protocol/standard defined in a DTD by reading it yourself, and writing XML that conforms... or by manually adding to the Flash XML processor so that Flash 'understands' the standard it will be reading in.

    As for your comment about DTD's being irrelevant because there is no 'linear structure' to a SWF... I'm confused.

    As to XSLT producing a binary file like a SWF... Sure... maybe in some round about way, but not normally. Why would you want to do that anyway??? Craation of graphics from an SVG or XSL-FO point of view... sure... but from a raw XML -> raw SWF point of view... not really.

    As for projects involving XML... everything I do uses XML-ish technologies - since I'm about the only one I know who ~knows~ XML (see the analogy-complaint at the end).

    For the most part I use XML to store data, and for an inter-process communication protocol.

    How long will XML be around?? How long has SGML been around?

    As to the rest.....

    < sigh > Can I be a little stronger than usual?? If that's your instructors opinion, then he/she shouldn't be teaching XML-anything at all.

    I teach an XML class for a State College, and every single person I talk to is skeptical at first because they think XML is just a buzzword. It would be if you didn't have enormous amounts of major companies moving in support of XML.

    Imagine every single person in the world speaking the same verbal language... yeah, that'd save time and money. Same with XML.

    Imagine developing something in Java, then being able to 'hand-it-off' to PHP or C++, or Flash, or MySQL - and then have have it completely understood... yeah, that'd save time and money. That's XML.

    Imagine being able to reconfigure the Flash MX authoring environment using notepad... oh, wait... you can. Config files are in an XML-based format.

    Imagine being able to write a chat client in Java that communicated with a chat client written in Flash, or PHP, or OCaml, or Python, or Perl, or Ruby, or C, or C++, or ASP, or VB .NET, or ... oh wait - you can. It's called Jabber and it uses XML as it's messaging format since languages too many to list have XML support built in.

    Imagine being able to explain that the fifth item in your Pipe Delimited file (1|2|3|4|5|...) is actually the third child of the 2 item in your PD file. Sure, you ~could~ do that without XML, but it's a natural part of XML to allow you to do that anyway. What about saying that the fifth item is supposed to have the color blue? Again - sure, you ~could~ do that in your PD file... but XML is meant to do that.

    Yes - XML is more 'bloated' in size than your PD file - it's also more readable, more transferrable, more extensible, more robust, ... the benefits usually outweigh the detriments.

    No - XML should not be used everywhere. Are major companies using XML every single place they can? Yup.

    Yes - XML ~was~ a buzzword... back when people weren't using it. See the above comment.

    I know this post has been a little stronger than my normal post, and I wanted it to be. Simply put - look around. XML is everywhere, and there's a good reason so many 'smarter-than-me' people use it. Don't feel like your jumping on the bandwagon - understand that you're leaving the starting blocks a little later than everyone else (which if you take that analogy a little further... one thing that pisses me off about XML is that the 'finish line' keeps moving. XML-ish technologies are expanding too quickly... the applications of XML, the XML based standards, the implemetations of XML - call it whatever you want - it's all moving too quickly to keep up).

    Even if you ran as fast as you could into the world of XML - you wouldn't be able to 'know' everything. It's already too ubiquitous, too usefull, and too developer-friendly.
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

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