how to perform the html to xml conversion.....
Actually i used the grab the data from a website by using FILE_GET_CONTENTS and save it in my Hard disk as *.txt file by using FILE_PUT_CONTENTS.
i just want to convert that data into .xml file.To extract the particular data from that content.
3 replies to this topic
#1
Posted 14 November 2011 - 07:49 PM
|
|
|
#2
Posted 14 November 2011 - 08:20 PM
Why not just treat it as an XML file? Though you probably would need to do a bit of cleanup (ie terminating unended tags, enclosing non-quoted values in quotes, etc.), to make the HTML code into valid XML code.
#3
Posted 14 November 2011 - 08:37 PM
Thanks for rly dude....
i simply create a new xml file and named it as *.xml and using FILE_PUT_CONTENTS function i stored that retrieved data into *.xml file. but it doesn't work properly.....
i simply create a new xml file and named it as *.xml and using FILE_PUT_CONTENTS function i stored that retrieved data into *.xml file. but it doesn't work properly.....
#4
Posted 14 November 2011 - 09:00 PM
One thing I could say is make sure that the XML text is valid. Some requirements that I can think of, for an XML file to be valid, are:
Again, these are just some I can think of at the moment. There's more at XML Syntax .
- There should be a root tag.
- Tags should be properly nested.
That is, if P is the parent element and DIV is the child, then you must first end the child element, before you can end the parent element. This is WRONG: "<p><div>hello</p></div>" This is RIGHT: "<p><div>hello</div></p>"
- Each opening tag must have a corresponding closing tag.
This is WRONG: "<p> hello"
This is RIGHT: "<p> hello </p>"
(You must close every tag you open.)
- Each value, of a tag's attribute, must be quoted.
This is WRONG: "<font size=5>...</font>"
This is RIGHT: "<font size="5">...</font>"
Again, these are just some I can think of at the moment. There's more at XML Syntax .
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









