SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 377 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"


The JSimpleXMLElement class includes a method called toString(). This method
takes the parsed XML and converts it into an XML string:
// get the root node
$document =& $parser->document;
$xmlString = $document->toString();
The string returned from the toString() method is missing one vital part of an
XML document, the XML declaration. We must manually add this to $xmlString:
$xmlString = ''
."\n".$xmlString;
APIs and Web Services
[ 284 ]
Now that we have prepared the new contents of the XML file, we need to save it. To
do this, we use the JFile class that we import from the joomla.filesystem library:
if (!JFile::write($pathToXML_File, $xmlString))
, {
// handle failed file save
}
Yes, it really is as easy as that!
There are numerous methods in the JSimpleXMLElement class that allow us to
manipulate and interrogate data. For a full description of all these methods please
refer to the official documentation at: http://api.joomla.org/.
It is vital when working with JSimpleXML and JSimpleXMLElement
to pass objects by reference.


Pages:
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6