WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A simple example of using PHP DOMXML functions
Categories : PHP, XML Click here to Update Your Picture
Peter Tatischev
Date : May 20th 2002
Grade : 2 of 5 (graded 7 times)
Viewed : 15321
File : request.xml
Images : No Images for this code example.
Search : More code by Peter Tatischev
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?php
////////////////////////////////////////////////////////////////////////
//Variables to be set
$coord_sys = "LL";
$datum = "WGS-84";
$format = "IDMS0";
$max_del = 30;
$msisdns = array();
////////////////////////////////////////////////////////////////////////
error_reporting(E_ALL);
//if (!$docnode = domxml_open_mem($theXML))
//echo "SOME ERROR";
//create a DOMXML object by reading the XML data from a file, the two lines above
can be
uncommented to
//create an object by reading it from a string
if (!$docnode = domxml_open_file("http://localhost/post/bot/xml/request.xml"))
echo "SOME ERROR";
//$docnode = create_text_node($theXML);
//get the root element of the document
$root = $docnode->document_element();
echo "ROOT: " . $root->node_name(); //display it (just in case)
if(!$childs = $root->child_nodes()) //creating a list of child nodes of the root,
should be an
array
echo "no child nodes<br>";
if (is_array($childs)) //just to check if what we got above really IS an array
(delete it if you are
sure that everything's working)
echo "\nARRAY\n";
else
echo "\nNONE\n";
while ($node = array_shift($childs)) //traversing the array of child-nodes of the
root
{
if (strcasecmp($node->node_name(), "client") == 0) //the second level of
hierarchy (refer
to the request.xml file for explanations)
{
if (!$client_children = $node->child_nodes())
echo "Error getting childer of client";
while ($extra_node = array_shift($client_children)) //here we only
output the data
about the child nodes, all the necessary data is contained in the children of the
next node
{
if (substr_count($extra_node->node_name(), "#") < 1)
echo "Client_content: " . $extra_node->node_name() . "
content: " .
$extra_node->get_content() . "\n";
}
}
if (strcasecmp($node->node_name(), "lir") == 0) //the node that contains the
necessary
information
{
if (!$client_children = $node->child_nodes()) //creating an array with
all the children
of it
echo "Error getting childer of client";
while ($extra_node = array_shift($client_children)) //traversing the
list of children
of "<LIR>"
{
$sh = 0;
//retrieving information from the GEO_INFO node
if (strcasecmp($extra_node->node_name(), "geo_info") == 0)
{
if (!$client_children_extra = $extra_node->child_nodes())
echo "Error getting childer of geo_info";
while ($array_node = array_shift($client_children_extra))
{
if (substr_count($array_node->node_name(), "#") < 1)
{
//the following set of IF's checks whether we
are looking at the node
the content of which corresponds to one of teh variables we want to set, and if so,
we set it
if (strcasecmp($array_node->node_name
(), "coord_sys") == 0)
$coord_sys = $array_node->get_content();
else if (strcasecmp($array_node->node_name
(), "datum") == 0)
$datum = $array_node->get_content();
else if (strcasecmp($array_node->node_name
(), "format") == 0)
$format = $array_node->get_content();
echo $array_node->node_name() . " content
(geo_info): " .
$array_node->get_content() . "\n";
}
}
}
//retieving data from MSISDN node
else if (strcasecmp($extra_node->node_name(), "msids") == 0)
{
if (!$client_children_extra = $extra_node->child_nodes())
echo "Error getting childer of client";
while ($array_node = array_shift($client_children_extra))
{
if (substr_count($array_node->node_name(), "#") < 1)
{
if (strcasecmp($array_node->node_name
(), "msid") == 0) //in this
case we should add a number to the msisdns array
{
$msisdns[$sh] = $array_node->get_content();
$sh++;
}
echo $array_node->node_name() . " content
(msids): " . $array_node-
>get_content() . "\n";
}
}
}
//retieving data from QoS node
else if (strcasecmp($extra_node->node_name(), "qos") == 0)
{
if (!$client_children_extra = $extra_node->child_nodes())
echo "Error getting childer of client";
while ($array_node = array_shift($client_children_extra))
{
if (substr_count($array_node->node_name(), "#") < 1)
{
echo $array_node->node_name() . " content
(qos): " . $array_node-
>get_content() . "\n";
if (strcasecmp($array_node->node_name
(), "qos") == 0)
$max_del = intval($array_node->get_content
());
}
}
}
}
}
}
//once again displaying the data we got from the XML (this time we use the variables
that
have been initialized)
reset($msisdns);
echo "\nCoordinate system: " . $coord_sys;
echo "\nDatum: " . $datum;
echo "\nFormat of data: " . $format;
echo "\nMaximum delay: " . $max_del;

//traverse through the array we created above
while ($elem = array_shift($msisdns))
echo "\nMSISDN: $elem";
?>



RSS parser using PHP5 and simpleXML
Categories : Rich Site Summary (RSS), PHP, XML
MySQL to XML.
Categories : MySQL, XML, PHP
php Free chat simple fast and customizable chat server that uses a simple filesystem for message and nickname storage
Categories : PHP, AJAX, XML, Complete Programs
Dynamic Loading of XML array data into ComboBox and Display XML data using PHP + DOM + Javascript.
Categories : PHP, Java Script, DOM XML, XML, Arrays
DBXML- A Class to backup databases in XML Format using web interface
Categories : PHP, PHP Classes, Databases, MySQL, XML
SAPIPROCESSOR - is a compact XML-based CMS toolkit
Categories : PHP, Content Management, XML
XML Menu
Categories : PHP, PHP Classes, Navigation, XML, XSL
A very basic and fast XML parser
Categories : PHP, PHP Classes, XML
utf8_decode -- Converts a string with ISO-8859-1 characters encoded with UTF-8 to single-byte ISO-8859-1.
Categories : PHP, PHP Functions, XML
TAB_STRUCT Class: Is supporting Class for the DBXML Class
Categories : PHP, PHP Classes, MySQL, XML, Databases
logger class (PHP5 +)
Categories : PHP, PHP Classes, Log Files, XML
XMLManipulation
Categories : PHP, XML, SimpleXML
Amazon.com API, CURL-REST Parser. Obtain data about Amazon products (PHP5 +)
Categories : PHP, Ecommerce, XML, Web Services, CURL
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Glossword - glossary compiler
Categories : Content Management, PHP, MySQL, XML