XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 27th, 2002, 09:30 AM
vladiator vladiator is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 6 vladiator User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Dynamically saved XML file doesn't follow structure

XML Newbie here - please be kind. I am using an XML file as a very small database, and my script can successfully read and manipulate the data. It can also add new entries, and save them to the file.

The problem is, when the script saves the XML file, the new entries are all on one run-on line and do not follow the indentation/structure pattern of the file.

In the following listing, I start with entries 0 and 1 already in the file, then I add entry 2, and the file becomes deformed:

<main>
<job id="0">
<title>Job Title 1</title>
<info>Job info 1</info>
<contact>Contact info 1</contact>
</job>
<job id="1">
<title>Job Title 2</title>
<info>Job info 2</info>
<contact>Contact info 2</contact>
</job>
<job id="3"><title>Job title 3</title><info>Job info 3</info><contact>contact info 3</contact></job></main>

I am using XML DOM with ASP, although I doubt this is the problem or source of any concern at all (since it's just abstraction methods for reading/parsing the XML file, there is no control for such details).

Reply With Quote
  #2  
Old June 27th, 2002, 09:40 AM
northpotomacmd northpotomacmd is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 2 northpotomacmd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I had to do something similar and I used something like this:

filename.WriteLine("<Diag>"+areyDiag+"</Diag>")
filename.WriteLine("<Image>"+areyImage+"</Image>")

and it worked fine. I'm new too so anyone with anything better should feel free to correct me...

Reply With Quote
  #3  
Old June 28th, 2002, 08:31 AM
agreen agreen is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: Indianapolis, IN
Posts: 3 agreen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Any time I have done something similar with php, whether it is writing HTML or XML, I use the new line character "\n" and then if I want to use a tab then I use "\t".

Reply With Quote
  #4  
Old June 28th, 2002, 07:45 PM
vladiator vladiator is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 6 vladiator User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Well the thing is, this isn't like a normal file read/write operation. The XML DOM object abstracts that part, so all you do is like myxml.open(), myxml.appendnode(), myxml.save()

That's why I can't seem to get any control over it - because it does everything for me.

I was thinking about just making a simple flat-file database thing, but you know how pride starts messing with you and you think you can become an XML developer within a day?....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Dynamically saved XML file doesn't follow structure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway