Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User yanhua's Avatar
    Join Date
    Sep 2007
    Posts
    33
    when I use minidom to parse and edit an xml file, it is like this :

    import xml.dom.minidom
    doc = xml.dom.m
    inidom.parse(XmlFile)

    then all the editing is done to the object, 'doc'. Then how do I save 'doc' as an xml file?

    Thanks

  2. #2
    Super Contributor lfd's Avatar
    Join Date
    May 2006
    Location
    Oulu, Finland
    Posts
    622
    Hi yanhua,

    Where is the documentation for minidom?

    What do you get if your print doc? Is there a to_string, to_file...?? available on a minidom object?

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

    Tips and modules:
    http://www.lfdm.net/thesis

  3. #3
    Regular Contributor aaaaapo's Avatar
    Join Date
    Sep 2005
    Location
    Finland, Helsinki
    Posts
    323
    Quote Originally Posted by yanhua View Post
    when I use minidom to parse and edit an xml file, it is like this :

    import xml.dom.minidom
    Are you using xml.dom.minidom in Pys60?
    If the answer is yes, could you tell me how did you do it?

    (I'm using sgmllib to do some basic xml-parsing, but xml.dom.minidom would be much more convenient.)

  4. #4
    Registered User yanhua's Avatar
    Join Date
    Sep 2007
    Posts
    33
    How did i do it?

    I just copy the xml library into the phone. and the console and find it automatically

    Is this what you want to know?

  5. #5
    Regular Contributor aaaaapo's Avatar
    Join Date
    Sep 2005
    Location
    Finland, Helsinki
    Posts
    323
    Quote Originally Posted by yanhua View Post
    I just copy the xml library into the phone. and the console and find it automatically.
    Is this what you want to know?
    I thought xml.dom.minidom needs expat...

    Could you name all the files you copied to the phone?

  6. #6
    Registered User yanhua's Avatar
    Join Date
    Sep 2007
    Posts
    33
    o wait ,
    i encountered such problem:

    i did imported xml.dom.minidom in the phone, and when i run this :
    f = xml.dom.minidom.parse('book.xml')
    the console says:

    ImportError: No module named pyexpat

    =====================================

    I'm sorry if i have misled u

    btw, what module is usually used for xml processing in pys60?
    could it be the elementTree or something?
    Last edited by yanhua; 2007-09-29 at 19:54.

  7. #7
    Registered User sam_tank's Avatar
    Join Date
    Sep 2007
    Location
    Gujrat,India
    Posts
    10
    Extension markup language is same as HTML some syntax are different
    to save xml python u should work with xml.dom.minidom module find this module here.....docs.python.org/lib/module-xml.dom.minidom.html
    When we save and load different xml tags we must keep the same xml tags

    thx..
    Keyur Tank, B.E.I.T
    Gujrat, India

    Pys-60 1.4.0 with Nokia N-72
    Symbian C++,Python

  8. #8
    Regular Contributor tsharju's Avatar
    Join Date
    Jul 2005
    Location
    Espoo, Finland
    Posts
    66
    Quote Originally Posted by yanhua View Post
    btw, what module is usually used for xml processing in pys60?
    could it be the elementTree or something?
    You can use elementTree or even minidom if you install pyexpat. One good option is also to use xmllib.py, since it is pure Python implementation and does not require to install any 3rd party modules. xmllib.py comes with standard Python distribution.

    - Teemu

  9. #9
    Super Contributor lfd's Avatar
    Join Date
    May 2006
    Location
    Oulu, Finland
    Posts
    622
    True, but pure Python means slower when large documents need to be parsed. cElementTree is very fast once loaded! I've used it on few projects already.

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

    Tips and modules:
    http://www.lfdm.net/thesis

Similar Threads

  1. [moved] Theme Studio Error
    By TalJ in forum Themes/Carbide.ui
    Replies: 2
    Last Post: 2009-09-06, 03:39
  2. Replies: 3
    Last Post: 2007-03-07, 03:36
  3. Save a .txt file to specific folder in the phone
    By Amilael in forum Symbian C++
    Replies: 3
    Last Post: 2006-09-20, 08:07
  4. File save problem
    By zwgoal in forum Symbian C++
    Replies: 3
    Last Post: 2005-11-11, 10:11
  5. File Save!
    By georgica1979 in forum Symbian User Interface
    Replies: 7
    Last Post: 2003-04-11, 20:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved