Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Where should XML be used?

    I am having trouble figuring out where or why XML should be used. I began looking at it because I wanted to have a simple way of creating a database table to hold dates of interest that would be loaded to a page when the user opened a calendar. The pop up for each of the days would get it's text from the table. I was led to believe that XML was the direction to go, but my reading so far hasn't shed any light.

    Some clarification would be nice.
    Scott Stewart
    Always happy to learn from pros.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    XML is ideal for sitatuations where a DB would be overkill but a flatfile too complex (or tedious) to delimit and parse

    XML is also ideal for storing data where disparate processes need to access it, without them having to be on the same platform, or server, or use the same process

    XML can be used to write other markup languages

    With XML you have total separation of style and content



    Does that help? Maybe you have more specific questions?

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts
    I'll chew on your response for a while to see if what you said fits my needs, however, my immediate reaction is to look at another route.

    My appointments or dates of interest include a month day and description. When the web page loads I want to inlcude this info as an array for a tool tip routine. As the user browses the calendar and hovers over a marked date, the tool tip will show what is happening on that day. Right now the info is static on the web page in an array. My thinking was there must be an easier way to change the info and keep it updated. Almost all information is known for the entire year so it is not that big of a deal.

    Thanks for your response.
    Scott Stewart
    Always happy to learn from pros.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So how much data is involved? I mean if it what amount to 1 choice out of 365 stored sentences, and only page has to have access to that info, you may as well keep it all in one big array written in a server side language. Then just print one of them into a javascript variable.

    Or did you have a reason for wanting the data to be in a seperate store? XML could store the whole calender - days, weeks, months, comments etc ... and then you could use XSL to transform it into javascript.

    I've been doing a lot of this kind of small-scale application with XML as the data source - for things like news indexes, timetables and product-info pages - where all the core data is in one XML doc and then I have a few different processes parsing it in different ways, so that users can sort and search through individual pages, and re-order the elements by their own priorities.

    It's cool But I wouldn't put my hand and my heart and say XML is the ideal paradigm here. It's just what I'm interested in that the moment .. 18 months ago I would have been trying to do it all in javascript

    But the #1 advantage I've found with XML as a data medium its portability. XML can represent anything from a textfile to a photograph - or both, from the same XML! We're doing stuff at work where our website (apache/php) shows information to the public, and our intranet (iis/asp) shows the same information but in a completely different order and format. The possibilities are endless ....

    I'm a big fan .... as my rant surely testififes

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Obvioulsy it has taken me a while to get back to this post (work is keeping me from playing). The amount of data I want to display can be three or four events in a single day and several days per month. Each event should have the start time, end time (which may be three days) type of event and location. For example on March 9 through March 11 the pop up would say;

    all day - Registered Paint Horse Show, Houston Livestock Show and Rodeo, Astro Arena.

    March 4th would say; 11:00am - 4:00pm, Horse Judging Competition, Houston Livestock Show and Rodeo, Astro Arena

    And a bunch more.

    I also want to give the kids a page where they can sell things (like a classified adds page. Managed by me.) So I would like to be able to easily enter the data that would ID the seller, describe the item and have a photo if available. I figured I would use MySQL for the DB.

    Perhaps this will help you understand where I am going and why I was thinking XML may be useful here.

    Comments are welcome.
    Scott Stewart
    Always happy to learn from pros.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think XML would be very useful to you; you're dealing with a fairly small amount of very structured data - keeping it in XML would allow you to provide more than one kind of output - for example, you could have a "coming soon" page, which lists the forthcoming events in a straightforward "list and headings" way; but you could also build an interactive calender - using the same XML to make a "point and click" style accessory to put on your pages.

    Just some thoughts; mySQL would work as well - but with XML you have a ready-made transformation language (XSL) which would make the outputs much easier to manage. Also with XSL, the transformation is platform independent - you can move to a different server or rebuild your whole site, without having to modify the XML at all

  • #7
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Thanks for the input!

    I guess I stll have a lot more reading to do before I get a grip on the "big picture" using XML. The tutorials I have found and the book I am using all say exactly the same thing. They don't tie in the overall development apsects.

    For example;
    [HUH?] (future tag like )
    Here's the first page of my document and the user clicks on an item to open a new page that I want to serve using php. The new page is an XML document with embedded XHTML for format using the XSL to interpret the XML tags?
    [/HUH?]
    Scott Stewart
    Always happy to learn from pros.

  • #8
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    The below is by liorean:

    What is XML?
    (see W3C XML in 10 points)

    XML is a set of technologies (see W3C Extensible Markup Language (XML)) for:
    1. Syntax rules for describing document structure (XML well-formedness)
    2. Describing languages that uses the xml syntax rules to describe document structure (DTD, XML Schema, XML Namespaces)
    3. Describing relationships and interactions between structure, data and documents (XLink, XInclude, XPath, XPointer)
    4. Describing how to handle the document structure (xml-stylesheets: XSL (XSLT for transforming into other docuemnt structures, XSL-FO for translatingthe document structure into presentation), CSS (for describing the presentation for the document structure) and other stylesheet languages for their respective usages)
    5. Describing processing (Processing instructions, PI) to apply to a document


    XML is not:
    1. A programming language
    2. The best language for all situations. CSS for example is far easier and more readable than it's XML equivalent would be.
    3. A way to describe semantics (at the moment we must use human-readable specifications and describtive names on structure elements for semantics since we have no way of describing semantics to the computer)


    Properties of XML:
    1. Textual structure representation that is human readable but intended not for humans but for computer interpretation
    2. Verbose instead of compact


    What an XML language is:
    1. A structure description language that conforms to the xml syntax rules
    2. The words, phrases and grammar of an xml document (provided by DTDs or XML Schema)


    What an XML document is:
    1. A single-root hierarchical tree of elements described by their type where each element in turn describes the data and elements it contains


    How do I use XML?
    Normally you shouldn't be concerned with using XML. XML is a way to structure raw data that isn't made for representing documents - if you want to send data between a server and client of between two programs, XML might be the choice to make, but not for a document. Instead, you should search out or create the XML language that is best for representing your document, be that MathML, SVG, XHTML, Docbook, RDF or any other. As for using XML for databases, I'd say it's pretty ok for anything intended for editing raw source by humans, but otherwise use a real database software. XML is not made for speed or efficiency, and is way larger (more verbose) than necessary.

    The above is by liorean.
    Last edited by liorean; 11-17-2005 at 10:22 PM.
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

  • #9
    Regular Coder
    Join Date
    Nov 2003
    Location
    Code Heaven
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ScottinTexas
    I think what u would need better in this situation than XML is the Tabular Data Control.

  • #10
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Dover, Delaware
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So, in essence, I can use access database to export into delimited format that is made for xml, export a database info into xml and have it display to a corporate website for analysis. Is that what we use in application in business sense? Or am I taking things wrong? (using it between servers or two applications)

  • #11
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    XML doesn't seem so exciting at first. But XSL makes it fun. With XSL, you can display the content of your XML file in tables, loop them, use if / else branching, and more. XSL is a W3C standard for the web. This is great since XML can be used for many things. But I don't think XML will replace any binary database systems (although there is the Binary XML work group...). At this time, XML is mostly used for organizing personal things. It can be great for exchanging easily readable data that can be handled by various programs. You control your XML file. The only rules you must be bound by are it's well-formedness.

    XSL is the only web standard for transforming and viewing XML. But it's not the only way to view manage XML. I'm sure several corporate networks have personal XML databases with their own doctypes, along with software to read and write to the XML file to suit it's purposes. And as the XML file changes, the XSL page will display it's format. With the right uses of XSL's "when" and "otherwise" tags, you'll never even need to update the XSL page or manually edit the XML file outside of the applications. But since XSL can't write files (can't write to the web), there's no standard way to handle XML. It's up to the application handling the XML to decide on a script. The writing part may be proprietary, but it's still an XML file obeying the standards of XSL regardless of how the server maintains it, and that's what matters.

    The current limitation of XSL is that it has no interactivity. The user cannot simply use javascript to change the innerHTML of the XML file or adjust the XSL page's sorting. Using math and booleans to branch the possibilities of the XSL page can be hard at first. But due to the fact that XML is so well structered even in script-like features such as this, it's fairly easy to maintain and memorize. In javascript, the only XML based structure is the start and end tags for "script". The content in between is a totally different law and syntax of parsing and writing. The better structure of XML simplifies everything for the user while also maintaining an error free environment that requires just a simple parser. Mini-applications such as cell phones can't parse most javascript in pages. The common behavior in most HTML parsers is to be forgiving of errors. It would be inefficient to teach an XML parser to be forgiving. To keep things simple and less complex, consistency and standards will open many doors for XML.

  • #12
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    XML is great as a way to share data between applications. I'd much rather have my documents stored as XML and readable by anything, as opposed to some proprietary format like MS Word doc files.

    If you're using a low level language like Java or C++ (yes, I know....5 years ago those were my epitome of "HLL"s), XML is a nice alternative to using a relational DB. Though it's been my experience that, in the end, it's simpler and easier to stuff everything into mysql than waste my time playing with the xml details. (doc->children, children->nodes, getNodesByName( name) or whatever).

    It all totally depends on your wants & needs. If you want to share your data with everyone else...maybe an xmlrpc server is the way to go.

    If you want to create data files that lots of different applications share, maybe XML is the answer.

    [Please forgive if this turns out to be a duplicate post. I wound up logged out in the middle of writing it]

    From your description at the top of this post, this really doesn't sound like "the" answer. Unless you're a major player, getting an XML schema noticed just isn't going to happen. It's every bit as easy (if not easier) to stash this sort of info in a relational database. It'll [probably] be faster for the server to query.

    If your site turns huge? Hire someone to implement an xmlrpc server so clients can peek at your calendar that way. If the site doesn't take off? You didn't waste the time futzing with the XML layer in the first place.

    NOTE: For actual desktop applications, or other approaches, I advocate a totally different approach. Each problem requires a unique solution. Sometimes (rarely) the proprietary binary file is the right one.

  • #13
    New Coder
    Join Date
    Jul 2005
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    XML is indeed a very useful file-type
    it's not much of a language but rather it is a useful DB source
    usually used for connection to a game server
    also used in common Speech databases for a game
    also used to compile a database into basic source

    *I may be wrong, hopefully I don't get flamed*
    *ducks for cover with briefcase*

  • #14
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    The most appropriate place i can find xml to be used is generally using a server side language to populate an xml page, similarly to an sql view (but you don't have to keep to 2d data etc) so that distributed applications (for example those dynamic signatures that show game statistics) can read them without direct sql access. This is a pretty good, secure (when sql injection is definately blocked) way of allowing distributed applications read only access to certain areas of a database in a structured way. AFAIK it is best seen as a simple structured data store that doesnt rely on formatting (such as 10 bytes in or delimited by whitespace or commas) but provides data via metadata as tag names

  • #15
    Regular Coder DELOCH's Avatar
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    537
    Thanks
    4
    Thanked 2 Times in 2 Posts
    let me say it in this way:

    XML is not built to do ANYTHING

    XML is good for storing data that can be acessed with XQuery

    XML should be used because it is an ideal language to discribe data

    for example HTML would be a new student you do not know at all, HTML table to XML can be a furniture, data or anything when XML does not know anything about it, so to XML to make sence you can try to see it as a stupid language that thinks of everything as undefined data, although by saying it is extensive, it is the truth:

    XQuery: XQuery for XML is the same as SQL for tables
    XSL(T): XML Stylesheets, a way to turn xml to html, but in style, defines look
    XML: eXtensive Markup Language, a language extensed by other languages
    XForms: XML Forms
    XLink: XML defined Link
    DTD: A powerful language for defining XML elements, can generate XML to XHTML
    XHTML: HTML that is defined and accepted into the XML family (.html, .xml)

    so... yeah, try www.w3schools.com and check out the technologies


  •  

    Posting Permissions

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