You Are Here:

Community: Developer Discussion Boards

#1 Old convert file.txt to file.xml - 2008-11-03, 18:17

Join Date: Nov 2008
Posts: 1
ndoe
Offline
Registered User
hello all iam newbie for creating file in python and i have task for my collage can you all help me the task like this
i have file name for that file is example.txt and content of file like this
Code:
elementary
30802160
1
15518
30802170
2
15530
juniorhigh
30802180
1
15518
30802190
2
15530
seniorhigh
30802200
1
15518
30802210
2
15530
and i want to convert to example.xml with content like this
Code:
<object>
  <school province = "bali" object_id = "00009876">
   <list school="base" >
     <object_ref name = "1"> 30802160</object_ref>
     <object_ref name = "2"> 30802170</object_ref>
     <object_ref name = "3"> 30802180</object_ref>
     <object_ref name = "4"> 30802190</object_ref>
     <object_ref name = "5"> 30802200</object_ref>
     <object_ref name = "6"> 30802210</object_ref>
   </list>   
      <object classname = "elementary" object_id = " 30802160">
           <integer name = "Sid">1</integer>
           <integer name = "Address">15518</integer>
       </object>
      <object classname = "elementary" object_id = " 30802170">
           <integer name = "Sid">2</integer>
           <integer name = "Address">15530</integer>
       </object>
      <object classname = "juniorhigh" object_id = " 30802180">
           <integer name = "Sid">1</integer>
           <integer name = "Address">15518</integer>
       </object>
      <object classname = "juniorhigh" object_id = " 30802190">
           <integer name = "Sid">2</integer>
           <integer name = "Address">15530</integer>
       </object>
      <object classname = "seniorhigh" object_id = " 30802200">
           <integer name = "Sid">1</integer>
           <integer name = "Address">15518</integer>
       </object>
      <object classname = "seniorhigh" object_id = " 30802210">
           <integer name = "Sid">2</integer>
           <integer name = "Address">15530</integer>
       </object>
   </school>
</object>
can you show me the code if the example.txt change the source code is not change
thanks for your help
Last edited by ndoe : 2008-11-05 at 07:16.
Reply With Quote

#2 Old Re: convert file.txt to file.xml - 2008-11-04, 09:57

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Hello.

Please repost your file.txt and file.xml and enclose them in [CODEƒ]...[/CODEƒ] tags, otherwise it is not possible to see what the example files are really like. Press the #-button in the editing toolbar to get the [CODEƒ]...[/CODEƒ] tags or type them manually around the example text, like this:

[CODEƒ]
elementary
30802160
1

...
[/CODEƒ]

It will look like this:

Code:
elementary
30802160
1

...
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ