Solved

Write xml from string

Posted on 2011-03-10
4
477 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
Comment Utility
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
Comment Utility
Honestly, I expressly asked for code suggestion(s).
0
 
LVL 11

Assisted Solution

by:Amar Bardoliwala
Amar Bardoliwala earned 20 total points
Comment Utility
0
 
LVL 17

Author Closing Comment

by:nepaluz
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

743 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

18 Experts available now in Live!

Get 1:1 Help Now