CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Xml formatting: Edit Log



Stefanik
User

Jan 7, 2013, 1:42 PM


Views: 2151
Xml formatting

Hi all.
I should perform an XML formatter.
I've a file with a just one "long" string, formatted as following:


Code
<tag1><tag2>string1</tag2><tag3>string2</tag3></tag1>


I'm thinking of a code similar to:

Code
file -> split if ">" 
$count=0
while line in file
$count=0;
if match "<string>"
then
$count=$count+1
else if match "</string>"
$count=$count-1
end if
"\n"
"\t" for $count times
end while


What do you think?


(This post was edited by Stefanik on Jan 7, 2013, 1:45 PM)


Edit Log:
Post edited by Stefanik (User) on Jan 7, 2013, 1:44 PM
Post edited by Stefanik (User) on Jan 7, 2013, 1:45 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives