<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>VV&#039;s Corner &#187; xml</title>
	<atom:link href="http://vinoaj.com/blog/category/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://vinoaj.com/blog</link>
	<description>my collection of random thoughts, how-to&#039;s and code snippets</description>
	<lastBuildDate>Sat, 04 Dec 2010 15:05:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Creating an XML document with PHP 5&#8242;s DOM Functions</title>
		<link>http://vinoaj.com/blog/2007/04/creating-an-xml-document-with-php-5s-dom-functions/</link>
		<comments>http://vinoaj.com/blog/2007/04/creating-an-xml-document-with-php-5s-dom-functions/#comments</comments>
		<pubDate>Mon, 09 Apr 2007 20:32:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://vinoaj.com/blog/howtos/php/creating-an-xml-document-with-php-5s-dom-functions/</guid>
		<description><![CDATA[PHP 5's DOM Functions (or extension) allows you to create and manipulate XML documents. In fact, it can also be used to create and manipulate any documents adhering to the DOM3 specifications such as HTML and XHTML documents. Creation of a DOM document is a fairly simple affair Instantiate DOMDocument - also specify which version [...]]]></description>
			<content:encoded><![CDATA[<p>PHP 5's <a href="http://au2.php.net/manual/en/ref.dom.php" target="_blank">DOM Functions (or extension)</a> allows you to create and manipulate XML documents.  In fact, it can also be used to create and manipulate any documents adhering to the <a href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html" target="_blank">DOM3 specifications</a> such as HTML and XHTML documents.</p>
<p>Creation of a DOM document is a fairly simple affair</p>
<ul>
<li>Instantiate DOMDocument - also specify which version of XML the document is in and how it is encoded</li>
<li>Create elements through the DOMDocument object</li>
<li>Set your elements' properties (e.g. values, attributes, child nodes)</li>
<li>Append the elements to your parent DOMDocument</li>
<li>Output as fully-formed XML using <code>DOMDocument::saveXML()</code></li>
</ul>
<p>The following example shows you how to create an XML document (using UTF-8 encoding) using PHP 5's DOM functions.</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//First create an XML document</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//The following statement sets XML version 1.0, encoding utf-8</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$dom</span> = <span style="color:#000000; font-weight:bold;">new</span> DOMDocument<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'1.0'</span>, <span style="color:#FF0000;">'utf-8'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Step 1: create the root node</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Now create the root node and declare the XML namespace</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElementNS</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'http://www.w3.org/2005/Atom'</span>, <span style="color:#FF0000;">'entry'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//If you need to add additional namespace declarations, do it now</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'xmlns:gd'</span>,<span style="color:#FF0000;">'http://schemas.google.com/g/2005'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Step 2: create all child nodes</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$category_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'category'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$category_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'scheme'</span>, <span style="color:#FF0000;">'http://schemas.google.com/g/2005#kind'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$category_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'term'</span>, <span style="color:#FF0000;">'http://schemas.google.com/g/2005#event'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$title_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'title'</span>, <span style="color:#0000FF;">$title</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$title_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type'</span>, <span style="color:#FF0000;">'text'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$content_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'content'</span>, <span style="color:#0000FF;">$content</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$content_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type'</span>, <span style="color:#FF0000;">'text'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//In some cases the child node may itself be a parent with its own child nodes</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Create the parent node</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$author_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'author'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Create the child nodes</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$author_name_node</span>&nbsp; &nbsp;= <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'name'</span>, <span style="color:#0000FF;">$author_name</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$author_email_node</span> &nbsp;= <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'email'</span>, <span style="color:#0000FF;">$author_email</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Add the child nodes to the parent</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$author_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$author_name_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$author_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$author_email_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$transparency_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'gd:transparency'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$transparency_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'value'</span>, <span style="color:#FF0000;">'http://schemas.google.com/g/2005#event.opaque'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$eventstatus_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'gd:eventStatus'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$eventstatus_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'value'</span>, <span style="color:#FF0000;">'http://schemas.google.com/g/2005#event.confirmed'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$where_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'gd:where'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$where_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'valueString'</span>, <span style="color:#0000FF;">$where</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$when_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'gd:when'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$when_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'startTime'</span>, <span style="color:#0000FF;">$startTime</span> . <span style="color:#FF0000;">'+10:00'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$when_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'endTime'</span>, <span style="color:#0000FF;">$endTime</span> . <span style="color:#FF0000;">'+10:00'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Another child node which is also a parent</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$reminder_node</span> = <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'gd:reminder'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$reminder_node</span>-&gt;<span style="color:#006600;">setAttribute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'minutes'</span>, <span style="color:#0000FF;">$minutes</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$when_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$reminder_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Step 3: Add child nodes to the parent node</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$category_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$title_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$content_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$author_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$transparency_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$eventstatus_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$where_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$entry_node</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$when_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Append the root node to the document</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$entry_node</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Return the fully-formed XML representation of the DOMDocument</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">return</span> <span style="color:#0000FF;">$dom</span>-&gt;<span style="color:#006600;">saveXML</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://vinoaj.com/blog/2007/04/creating-an-xml-document-with-php-5s-dom-functions/&via=vinoaj&text=Creating an XML document with PHP 5's DOM Functions&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://vinoaj.com/blog/2007/04/creating-an-xml-document-with-php-5s-dom-functions/&via=vinoaj&text=Creating an XML document with PHP 5's DOM Functions&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvinoaj.com%2Fblog%2F2007%2F04%2Fcreating-an-xml-document-with-php-5s-dom-functions%2F&amp;title=Creating%20an%20XML%20document%20with%20PHP%205%E2%80%B2s%20DOM%20Functions" id="wpa2a_2"><img src="http://vinoaj.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://vinoaj.com/blog/2007/04/creating-an-xml-document-with-php-5s-dom-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

