Documentation Menu

1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 10 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Manual arrow Appendix arrow E. Porting MiniXML to the DOMIT Library

E. Porting MiniXML to the DOMIT Library PDF Print E-mail
E. Porting MiniXML to the DOMIT Library

From 4.5.1 the XML parser has been upgraded to DOMIT! (http://www.engageinteractive.com/domit/). This has been done to solve a conflict in the MiniXML library with PHP Version 4.2.2. DOMIT is also a far more mature library and development is ongoing where other libraries seem to have stagnated.

As a result, the MiniXML libraries have been deleted from the source distribution.

Any component or module that relied on the MiniXML libraries has two choices. Either include your own MiniXML source file, or upgrade to using DOMIT! The later is obviously recommended. It's quite easy. It just takes a few steps to convert a few functions over. Just following the following steps.

Finding elements by path

Replace:
$e = &$xml->getElementByPath( 'mosinstall/name' );

With:
$e = &$xml->getElementsByPath( 'name', 1 );

Getting the contents of a text node

Replace:
$e->getValue();

With:
$e->getText();

Getting the child nodes array

Replace:
$e->getAllChildren( );

With:
$e->childNodes;

Loading the XML file

Replace the following type of block

$xmlDoc = new MiniXMLDoc( $dirName . $xmlfile );
$xmlDoc->fromFile( $dirName . $xmlfile );

$element = &$xmlDoc->getElementByPath( 'mosinstall' );
mosDebugVar( $element );

if ( is_null( $element ) ) {
       continue;
}
if ( $element->attribute( "type" ) != "mosbot") {
       continue;
}

With the following type of code block

// Read the file to see if it's a valid MOSBot XML file
$xmlDoc =& new DOMIT_Lite_Document();
$xmlDoc->resolveErrors( true );
if (!$xmlDoc->loadXML( $dirName . $xmlfile, false, true )) {
       continue;
}
$element = &$xmlDoc->documentElement;

if ($element->getTagName() != 'mosinstall') {
       continue;
}
if ($element->getAttribute( "type" ) != "mosbot") {
       continue;
}

Getting the root node

Replace:
$element = &$xmlDoc->getElementByPath( 'mosinstall' );

With:
$element = &$xmlDoc->documentElement;


Last Updated ( Wednesday, 14 September 2005 )
 
< Prev