×

Discussion Board

Results 1 to 3 of 3

Thread: Accessing XML

  1. #1
    Regular Contributor
    Join Date
    Sep 2007
    Posts
    54

    Unhappy Accessing XML

    Hi, Do i need to install anything to write and read xml files? As python is new to me and i have totally no idea with regards to xml. Is Python for S60 able to do it? Would appreciate any form of reply. Thanks!

  2. #2
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: Accessing XML

    Quote Originally Posted by nick_santa83 View Post
    Hi, Do i need to install anything to write and read xml files? As python is new to me and i have totally no idea with regards to xml. Is Python for S60 able to do it? Would appreciate any form of reply. Thanks!
    Hello nick_santa83

    Try this : accessing XML !

    If you have some difficulties go back

    BR
    Cyke64
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  3. #3
    Regular Contributor
    Join Date
    Sep 2007
    Posts
    54

    Re: Accessing XML

    Thanks so much I did not manage to install the celementree but used the elementtree instead. One problem is that i realised my xml file that i created does not have the indentation. for example, here's my output
    --------------------------------------------------------------------------
    <xml><image_name>C:\first.jpg</image_name><location_name>home</location_name><time_taken>1400hrs</time_taken></xml>
    --------------------------------------------------------------------------

    is there any way that i make my xml to be like this:

    --------------------------------------------------------------------------
    <xml>
    <image_name>C:\first.jpg</image_name>
    <location_name>home</location_name>
    <time_taken>1400hrs</time_taken>
    </xml>
    --------------------------------------------------------------------------

    Or it doesnt matter? Anyway, here's my code:

    ==========================================================================
    import elementtree.ElementTree as ET

    # build a tree structure
    root = ET.Element("xml")



    title = ET.SubElement(root, "image_name")
    title.text = "C:\\first.jpg"

    location_name = ET.SubElement(root, "location_name")
    location_name.text = "home"

    timetaken = ET.SubElement(root, "time_taken")
    bt_timestamp = "1400hrs"
    timetaken.text = bt_timestamp


    # wrap it in an ElementTree instance, and save as XML
    tree = ET.ElementTree(root)
    tree.write("c://xml_test01.xml")
    ==========================================================================

    Would like to thank Cyke64 once again for helping out

Similar Threads

  1. Parsing wbxml file to xml file using kxml parser
    By ramyashashe in forum Mobile Java General
    Replies: 18
    Last Post: 2010-05-17, 15:56
  2. Xml transformation using asp.net
    By Aruna Gottimukkala in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2007-11-07, 10:06
  3. generating an XML file..
    By mayankkedia in forum Symbian
    Replies: 0
    Last Post: 2007-01-10, 14:42
  4. Sending XML file from server to mobile
    By bvsbh in forum Mobile Java General
    Replies: 1
    Last Post: 2005-11-30, 14:21
  5. XML library
    By wftomas in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2004-10-29, 18:37

Posting Permissions

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