Results 1 to 11 of 11

Thread: Newbie in XML

  1. #1

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Newbie in XML

    hi all..

    I just want to know about basically XML...

    I've tried to write an XML code with Notepad. And try to open the xml page using Internet Explorer (fyi. ver. 6)...
    but, when I try to open the page, the browser only show the code.

    What other things should I prepare to build an XML page ? the server ? web server ? or what else ?

    I'm really a newbie in this case. But, want to learn more bout XML. coz I'm interested in XML....

    Could anyone help me ?
    anybody ???

    Wille
    Regards,
    [-w-]

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

  3. #3

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524
    thx, I will try to read it first....



    Wille
    Regards,
    [-w-]

  4. #4

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524
    Well, jonny...
    thx, I've read for a while, nd little bit got the point....

    nd one thing makes me confuse is :

    Code:
    <?xml version="1.0"?>
    <devguru_staff>
       <programmer>
          <name>Bugs Bunny</name>
          <dob>03/21/1970</dob>
          <ssn>111-11-1111</ssn>
       </programmer>
       <programmer>
          <name>Daisy Duck</name>
          <dob>08/09/1949</dob>
          <ssn>222-22-2222</ssn>
       </programmer>
       ...........
    <programmer> ..... </programmer> will loop as the data record count (needed)....

    What I need to know is, should I type all the name, ... etc at my XML document ?
    or can I retrieve it from my Database ? if I can... how ????

    Thx in advance,
    Regards,

    Wille
    Regards,
    [-w-]

  5. #5
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    I dont exactly understand what u want

    But I am posting an example of reading an xml file.

    Also to your first query that when u view the xml file in IE, it displays you the same data as in the file - because actually xml file acts like a database - you can query it (kind-of) to fetch the records and display it using a scripting language(VBScript or JavaScript).

    Also I feel that u want to build your XML file ie fill the data into the XML file from a database - The answer to this is Yes.

    Though I havent shd it to you in the example here- this one is a very basic one.
    Attached Files Attached Files

  6. #6

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    hmm....

    thx jonny...

    I know the point...
    but, I still do not understand something...

    You said that XML is like a database in text file, right ?

    I mean like this...

    suppose, I have a database in SQL Server,

    Code:
    Name         Password
    ===============
    Tom            Tom
    Angie          Angie
    Russfeld     Rusfeld
    .........            ......
    how should I upload from my SQL Server to XML file type... ???

    Should I type one by one ?
    or I should make a coding first to upload it to XML file type ???

    Thx in advance
    Wille
    Regards,
    [-w-]

  7. #7
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    Code:
    how should I upload from my SQL Server to XML file type... ??? 
    
    Should I type one by one ? 
    or I should make a coding first to upload it to XML file type ???
    For that u need to open that file with a server-side language and loop through all the records in the db and write it to the XML file.

    Not type them one by one but may write a code which will do that.

    Lastly just out of curiosity - Why are u trying to convert ur SQL DB into XML???

  8. #8

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524
    then,

    how should I make my XML data... ???


    Sorry to be so stupid here... but still I didn't catch the idea....


    wille
    Regards,
    [-w-]

  9. #9
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    I am not wrting the entire code :

    just the steps ,if u dont get then I will:
    Code:
    open the SQL database.
    Query the database which will fetch you the records u want in the recordset.
    create a xml Object and open the xml file 
    
    Start a loop which will go on till rs.EOF  'rs is the recordset
    
    then use a createNode method to create nodes in the xml file.
    the nodes will contain the data - Name and Password in your case.
    
    complete the loop and close the connection.
    save the xml file.

    PS: it is advisable to save sensitive data like passwords in xml files - because after all they are TEXT files.


    All this scripting shd be in server-side coding(ASP).

    If its not clear,pls let me know I will post an example.

  10. #10
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    I've done this many of times. I just simply create a asp page and loop through the recordset returned from a sproc or whatever. I found it easiest to use microsoft xml parser and create a DOM object and append nodes to the document element. If you need an example, let me know.

  11. #11

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524
    sure... lethal...

    can u give me an example ?

    more example, makes me more understand 'bout this XML concept....

    nd Thx in advance,
    Wille
    Regards,
    [-w-]

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