Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Monday, September 8, 2008

Create Dynamic XML file using PHP

/* XML File name */
$filename = "evergreenphp.xml";

/* Path for XML filename */
$path_xmls = "/www/htdocs/phpdocs/missing_man";

/* File mode to Open the file */
$handle = fopen($filename, "w");

/* Sample values for the Array */
$image_array = array("1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg");

/* Writing the Header area */
$top_header = "
\n\n";
$player_list = fwrite($handle, $top_header);

/* Writing the Middle area */
for($i=0; $i < count($image_array); $i++){
$image_list = "images/".$image_array[$i]."\n";
$player_list = fwrite($handle, $image_list);
}

/* Writing the Footer area */
$bottom_footer = "
\n
";
$player_list = fwrite($handle, $bottom_footer);
fclose($handle);

/*

Output :
-------

< main>
< nodeA>
< bild>images/1.jpg
< bild>images/2.jpg
< bild>images/3.jpg
< bild>images/4.jpg
< bild>images/5.jpg
< /nodeA>
< /main>

*/
?>

Sunday, September 7, 2008

Introduction to XML

What is XML?

XML: eXtensible Markup Language
XML is a framework for defining markup languages:
* there is no fixed collection of markup tags - we may define our own tags,
tailored for our kind of information

* each XML language is targeted at its own application domain, but the
languages will share many features

" there is a common set of generic tools for processing documents

XML is not a replacement for HTML:
* HTML should ideally be just another XML language
* in fact, XHTML is just that
* XHTML is a (very popular) XML language for hypertext markup

XML is designed to:

* separate syntax from semantics to provide a common framework for
structuring information (browser rendering semantics is completely defined
by stylesheets);

* allow tailor-made markup for any imaginable application domain
* support internationalization (Unicode) and platform independence
* be the future of structured information, including databases

2000 -- XHTML 1.0 (XML version of HTML 4.01)

Popular Posts