XML/HTML help

Discussion in 'Web Design & Coding' started by ming, Jun 20, 2006.

  1. ming

    ming OSNN Advanced

    Messages:
    4,252
    Location:
    UK
    Hi all

    I'm a noob when it comes to design and coding. Have no experience with coding and stuff so I'd like to ask for some quick help with xml/html.
    Basically, I've got a .xml file on my drive which I'd like to display as an html file but have no idea what I need to do to get it to show it.
    To be more precise, I'm using Azureus which has generated stats into the xml file.
    Can someone guide me on how I can get the coding in html to show up in a web browser?

    I've come across this code in w3cschool but don't know how to change elements of it to accommodate the stuff for the my stats xml file.
    Code:
    <html>
    <body>
    <xml
    src="cd_catalog.xml"
    id="xmldso"
    async="false">
    </xml>
    <table
    datasrc="#xmldso"
    width="100%"
    border="1">
    <thead>
    <th>Title</th>
    <th>Artist</th>
    <th>Year</th>
    </thead>
    <tr align="left">
    <td><span datafld="TITLE"></span></td>
    <td><span datafld="ARTIST"></span></td>
    <td><span datafld="YEAR"></span></td>
    </tr>
    </table>
    </body>
    </html>
    I can see that the
    <xml
    src="cd_catalog.xml" part is the file name, but what is the id="xmldso"
    async="false" part?
     
  2. Bman

    Bman OSNN Veteran Original

    Messages:
    8,799
    Location:
    Ottawa, Ontario
    Have you simply tried renaming it to .html, I know this shouldn't work, but I have come accross some files that can do that.
     
  3. ming

    ming OSNN Advanced

    Messages:
    4,252
    Location:
    UK
    never tried... but then again, Azureus wouldn't be able to update the file if I did rename the file.
     
  4. Bman

    Bman OSNN Veteran Original

    Messages:
    8,799
    Location:
    Ottawa, Ontario
    Ok, please explain again.

    What are you doing with this file, is this a file you downloaded as a torrent, your trying to convert it to html and reupload it?

    I'm abit confused...
     
  5. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    You will need to use XSLT to transform the document into HTML.

    What is the format of your XML file you want to convert to HTML?
     
  6. ming

    ming OSNN Advanced

    Messages:
    4,252
    Location:
    UK
    I've got a .xml file on HDD, trying to get it to show up in web browser to show the statistics of Azureus... maybe as a table.

    Because I have no idea about html/xml coding, I don't know what I'm doing and what I'm supposed to do to get it to display properly in the browser.
     
  7. Bman

    Bman OSNN Veteran Original

    Messages:
    8,799
    Location:
    Ottawa, Ontario
    Geffy is right with XSLT, shouldn't Azureus have something to automaticly show you those statistics?
     
  8. ming

    ming OSNN Advanced

    Messages:
    4,252
    Location:
    UK

    err... only know it's a .xml file. :p
    <?xml version="1.0" encoding="UTF-8" ?>
     
  9. ming

    ming OSNN Advanced

    Messages:
    4,252
    Location:
    UK
    OK, managed to get the xml file to show up how i want it to show it.
    However, how can I convert the date from "1147096254" to 01/01/2006 or 01/01/06? Also, how can I add a decimal to a number if the xml updates in integer?
     
  10. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    can you paste a copy of your XML file here, or PM me a copy and I can try to whip up a quick XSLT for you
     
  11. ming

    ming OSNN Advanced

    Messages:
    4,252
    Location:
    UK
    This is what I can see in the xml file generated by azureus... with the exception of the filename. But the xml code is there. :p

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="Az_stats.xsl"?>
    <STATS>
        <AZUREUS_VERSION>2.4.0.2</AZUREUS_VERSION>
        <GLOBAL>
            <DOWNLOAD_SPEED>
                <TEXT>0 B/s</TEXT>
                <RAW>0</RAW>
            </DOWNLOAD_SPEED>
            <UPLOAD_SPEED>
                <TEXT>0 B/s</TEXT>
                <RAW>0</RAW>
            </UPLOAD_SPEED>
        </GLOBAL>
        <DOWNLOADS>
            <DOWNLOAD>
                <TORRENT>
                    <NAME>abc.txt</NAME>
                    <TORRENT_FILE>D:\abd.txt.torrent</TORRENT_FILE>
                    <HASH>98123453DB02731217784C1BE3E88AE</HASH>
                    <SIZE>
                        <TEXT>922.92 MB</TEXT>
                        <RAW>967789872</RAW>
                    </SIZE>
                    <PIECE_LENGTH>526288</PIECE_LENGTH>
                    <PIECE_COUNT>1146</PIECE_COUNT>
                    <FILE_COUNT>1</FILE_COUNT>
                    <COMMENT>abc file</COMMENT>
                    <CREATED_BY>Azureus/2.4.0.2</CREATED_BY>
                    <CREATION_DATE>115434290</CREATION_DATE>
                </TORRENT>
                <DOWNLOAD_STATUS>Queued</DOWNLOAD_STATUS>
                <DOWNLOAD_DIR>D:\abc.txt</DOWNLOAD_DIR>
                <TARGET_FILE>D:\abc.txt</TARGET_FILE>
                <TRACKER_STATUS>Waiting to Scrape</TRACKER_STATUS>
                <COMPLETED>1000</COMPLETED>
                <DOWNLOADED>
                    <TEXT>931.60 MB</TEXT>
                    <RAW>976646453</RAW>
                </DOWNLOADED>
                <UPLOADED>
                    <TEXT>583.73 MB</TEXT>
                    <RAW>612753902</RAW>
                </UPLOADED>
                <DISCARDED>
                    <TEXT>6.81 MB</TEXT>
                    <RAW>7128524</RAW>
                </DISCARDED>
                <DOWNLOAD_SPEED>
                    <TEXT>0 B/s</TEXT>
                    <RAW>0</RAW>
                </DOWNLOAD_SPEED>
                <UPLOAD_SPEED>
                    <TEXT>0 B/s</TEXT>
                    <RAW>0</RAW>
                </UPLOAD_SPEED>
                <TOTAL_SPEED>
                    <TEXT>0 B/s</TEXT>
                    <RAW>0</RAW>
                </TOTAL_SPEED>
                <ELAPSED></ELAPSED>
                <ETA></ETA>
                <HASH_FAILS>0</HASH_FAILS>
                <SHARE_RATIO>631</SHARE_RATIO>
                <TOTAL_SEEDS>0</TOTAL_SEEDS>
                <TOTAL_LEECHERS>0</TOTAL_LEECHERS>
                <PEERS>
                </PEERS>
            </DOWNLOAD>
        </DOWNLOADS>
    </STATS>
    If it's possible, could you whip up some awesome .xsl code to show advanced statistics? ;) cheers.
     
  12. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    Looks like azureus includes an XSL file for its stats. Is there a Az_stats.xsl file in the same directory as the XML stats file? If not, try to find it and then copy it into the same directory and then try to open the file with Firefox or something.

    if that doesnt work, just want kind of data do you want displayed out of the XML file?
     
  13. ming

    ming OSNN Advanced

    Messages:
    4,252
    Location:
    UK
    There is... but I had to create it myself which flopped. :p
    I'd like it to show stuff like:

    Name of Torrent
    Creation Date (in DD/MM/YY format)
    Size of Torrent
    Downloaded (amount)
    Uploaded (amount)
    Ratio (D:L) (I couldn't get the decimal to work)
     
  14. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    argh, thought I had it right, but its just not coming together :p