Solved

Write xml from string

Posted on 2011-03-10
4
487 Views
Last Modified: 2012-05-11
I have what is routine to me in VB but have not been able to accomplish in PHP.
Can someone please give me some code suggestion on how to write the following lines of string to an XML file as per below?

The strings:
Pat,Rafter,30,Aussie
Boris,Becker,17,German
Paul,Raddy,28,Russian

The XML
<doc>
<Record>
  <fname>Pat</fname>
  <lname>Rafter</lname>
  <magicno>30</magicno>
  <village>Aussie</village>
</Record>
<Record>
  <fname>Boris</fname>
  <lname>Becker</lname>
  <magicno>17</magicno>
  <village>German</village>
</Record>
<Record>
  <fname>Paul</fname>
  <lname>Raddy</lname>
  <magicno>28</magicno>
  <village>Russian</village>
</Record>
</doc>
0
Comment
Question by:nepaluz
  • 2
4 Comments
 
LVL 38

Accepted Solution

by:
Aaron Tomosky earned 20 total points
ID: 35102423
Simplexmlwriter

Sorry for the lack of pasteable code, the manual is pretty good
0
 
LVL 17

Assisted Solution

by:nepaluz
nepaluz earned 0 total points
ID: 35102549
Honestly, I expressly asked for code suggestion(s).
0
 
LVL 11

Assisted Solution

by:Amar Bardoliwala
Amar Bardoliwala earned 20 total points
ID: 35104960
0
 
LVL 17

Author Closing Comment

by:nepaluz
ID: 35135966
I give up. I expressly requested for code suggestions but got links to .... I basically do not know.

anyway, after a long evening, I managed to get some code from Daniweb. Thanks all who contributed.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now