Re: PHP with XML database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



        Hi again
        
        I don't know what the DB should do for you.
        
        If you simple want to select subtrees from your big XML, you can put
        the XML Files to the filesystem and use XPointer for query.
        
        Here an example:

<?php
$xml=<<<END
<result xmlns:xi="http://www.w3.org/2001/XInclude"; xmlns:xhtml="http://www.w3.org/1999/xhtml";>
<xi:include href="http://www.laptop.org/vision/index.shtml#xmlns(xhtml=http://www.w3.org/1999/xhtml)xpointer(//xhtml:div[1]//xhtml:div[1])" parse="xml">
   <xi:fallback>
   <error>not found</error>
   </xi:fallback>
  </xi:include>
</result>
END;

$dom=domDocument::loadXML($xml);
$dom->xinclude();

header("Content-type:text/xml");
echo $dom->saveXML();
?>

This example loads an XML (xhtml) from the web (filesystem is also
possible) and outputs a subtree of the document.
The subtree is selected by an XPointer expression.

The XML: http://www.laptop.org/vision/index.shtml
The XPointer:
"#xmlns(xhtml=http://www.w3.org/1999/xhtml)xpointer(//xhtml:div[1]//xhtml:div[1])"
(the namespace part is a little tricki)

To parse 100MByte takes some time.
A database can improve speed, the query syntax (XPointer) maybe is the
same.
Without knowing what the output of the database should be und the query
parameters, it is not easy to tell what db is the best for you.

A solution could be to split the 100MByte file in small parts and store
the subtrees to blobs in mySql. You can build an index based on XPath
and it could be a real fast solution.



Bernhard

        

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux