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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts

    complete newbie at xml, need direction.. :D

    I'm a complete newbie at XML, and am trying to figure out what can it do for my site as its the next big thing. So, just for the heck of it, I'm creating a review section of my own for future links to other websites from my site.

    I guess it would look something like this

    <SITEREVIEW>
    <clubIDcode> </clubIDcode>
    <sitename> </sitename>
    <sitelink> </sitelink>
    <contact> </contact>
    <type> </type>
    <SCORES>
    <presentation> </presentation>
    <content> </content>
    <update> </update>
    <organisation> </organisation>
    <overall> </overall>
    </SCORES>
    <official> </official>
    <REQUIREMENTS>
    <requirement> </requirement>
    <requirement> </requirement>
    <requirement> </requirement>
    .
    .
    .
    </REQUIREMENTS>
    <FEATURES>
    <feature> </feature>
    <feature> </feature>
    .
    .
    .
    </FEATURES>
    </SITEREVIEW>

    Now that would mean that I have to have all this information set up in xml files. I was wondering if I can avoid that, and just read from text files and then setting them up in the xml file format, and then calling them into the site. That possible? Or is this method too slow? Can someone point me in the right direction? If I had a choice of language, I'd rather use Php. I'm checking PHP.net as I type this for more information.

    Thanks
    Duniyadnd

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,459
    Thanks
    1
    Thanked 23 Times in 21 Posts
    What you have is doable in XML. I'm wondering why you'd want to do it via XML.

    Don't get me wrong: I love XML. (That's why I moderate this forum.) But I sense the data you want might be better structured in a group of tables than in a tree (which is what generic XML is organized as).

    Information like this might be better stored in a MySQL database you access from PHP. It would give you better interaction with the data, and allow you to modify it from a web-based interface without too much trouble. For the record, my fellow moderator Simon (aka firepages) makes a wonderful little package called phpdev for Windows users, as a testbed Apache + PHP + MySQL server for developing your own server-based scripts.

    I don' t know how to use the XML parsing functions of PHP. Sorry.

    If you're absolutely determined to use XML, I'd recommend you look up the RDF specification at the W3C (http://www.w3.org ). But I barely understand that myself, and a PHP+MySQL database would probably be easier for you.

    Cheers!
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Alex

    Yeah, I know I can do it in a database, but I'm trying to come up with an excuse to use XML/XSL but I just can't find any for my site. The link option was the closest. How have people used XML to their advantage so that its better to use the tree than a database?

    Duniyadnd

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've done a bit of using XML as a pseudo database. The killer advantage is environment independence.

    PHP has native parsing functions which are well described in the PHP documentation. They work well, but I find them kinda quirky - there's a few stings in there if you don't read all the documentaion and notes quite carefully ...

    XSLT is much more fun ... but itself may not have the processing capabilities to provide the kind of interaction you want, so you might still have to generate some native code. That would be sufficient to provide read-only DB style functionality .. but writing back to it is much more tricky ...

    .. and I can't help you there cos I don't know, but it's definitely possible with both approaches.

    I think XML can useful for small db applications, with the disadvantage of speed, and the advantage of platform and process independence for your data. I favour the latter ... because it's a breath of fresh air for data sharing with other websites .. and because process is cheap
    Last edited by brothercake; 01-13-2003 at 01:37 AM.

  • #5
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,459
    Thanks
    1
    Thanked 23 Times in 21 Posts
    There's always a middle ground (if you can figure out how to do it). Have the PHP generate the XML for other sites...
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Alex Vincent
    Have the PHP generate the XML for other sites...
    Nice idea But tricky ...

    PHP's native extensions can't create XML directly, but you can create a text-file with XML-syntax data in it, and save it as .xml; there's no validation there, so you'd have to be very careful.

    But any server-based XSLT processor would have the capability ... I'm sure there'll be stuff about it, out there somewhere .. possibly Sablotron's PHP extension documentation is a good place to start
    Last edited by brothercake; 01-14-2003 at 03:22 PM.

  • #7
    New Coder
    Join Date
    Dec 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Are you trying to parse that information in PHP? Here is a basic tutorial on using the built in XML parsing functions of PHP.

    http://www.php-help.org/content/PHP/...L_with_PHP.cfm


  •  

    Posting Permissions

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