• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XmlManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中XmlManager的典型用法代码示例。如果您正苦于以下问题:PHP XmlManager类的具体用法?PHP XmlManager怎么用?PHP XmlManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XmlManager类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testRemoveNamespace

 /**
  * testRemoveNamespace method
  *
  * @access public
  * @return void
  */
 function testRemoveNamespace()
 {
     $this->Rss->addNs('custom', 'http://example.com/dtd.xml');
     $this->Rss->addNs('custom2', 'http://example.com/dtd2.xml');
     $manager =& XmlManager::getInstance();
     $expected = array('custom' => 'http://example.com/dtd.xml', 'custom2' => 'http://example.com/dtd2.xml');
     $this->assertEqual($manager->namespaces, $expected);
     $this->Rss->removeNs('custom');
     $expected = array('custom2' => 'http://example.com/dtd2.xml');
     $this->assertEqual($manager->namespaces, $expected);
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:17,代码来源:rss.test.php


示例2: options

 /**
  * Sets/gets global XML options
  *
  * @param array $options
  * @return array
  * @access public
  * @static
  */
 function options($options = array())
 {
     $_this =& XmlManager::getInstance();
     $_this->options = array_merge($_this->options, $options);
     return $_this->options;
 }
开发者ID:5chain,项目名称:CrowdFund,代码行数:14,代码来源:xml.php


示例3: XmlManager

EXPECTED RESULT:
book1 = <book><title>Knowledge Discovery in Databases.</title></book>
ACTUAL RESULT:
<?php 
$book_name = 'book1';
$book_content = '<book><title>Knowledge Discovery in Databases.</title></book>';
$mgr = new XmlManager();
if ($mgr->existsContainer("test.dbxml")) {
    $mgr->removeContainer("test.dbxml");
}
$con = $mgr->createContainer("test.dbxml");
$con->putDocument($book_name, $book_content);
$doc = $con->getDocument($book_name);
$s = $doc->getContentAsString();
print $doc->getName() . " = {$s}\n";
unset($doc);
unset($con);
$mgr->removeContainer("test.dbxml");
开发者ID:kanbang,项目名称:Colt,代码行数:18,代码来源:01.php


示例4: RetrieveConfigurationPropertiesFromXml

 function RetrieveConfigurationPropertiesFromXml($Path)
 {
     $FauxContext = "0";
     if ($this->ConfigFile == "") {
         $this->ErrorManager->AddError($FauxContext, $this->Name, "RetrieveConfigurationPropertiesFromXml", "You must supply a path to the configuration file");
     }
     // Retrieve config file contents
     $File = new File();
     $File->Name = $this->ConfigFile;
     $File->Path = $Path;
     $FileManager = new FileManager();
     $FileManager->ErrorManager =& $this->ErrorManager;
     $File = $FileManager->Get($File);
     // If there were errors retrieving the config file and we're in the CWD, report an error
     if ($this->ErrorManager->ErrorCount > 0 && $Path == $this->CurrentWorkingDirectory) {
         $this->ErrorManager->Clear();
         $this->ErrorManager->AddError($FauxContext, $this->Name, "RetrieveConfigurationPropertiesFromXml", "The root configuration file could not be found/read (_config.xml).");
         // If failed to retrieve the file from a non-root directory,
         // just accept the root file
     } elseif ($this->ErrorManager->ErrorCount > 0) {
         $this->ErrorManager->Clear();
         // If no errors occurred, continue to retrieve new configuration settings
     } else {
         // Create an XML Parser to retrieve configuration settings
         $XMan = new XmlManager();
         $XMan->ErrorManager =& $this->ErrorManager;
         $MyConfig = $XMan->ParseNode($File->Body);
         if ($MyConfig && $this->ErrorManager->ErrorCount == 0) {
             $this->StyleUrl = $XMan->GetNodeValueByName($MyConfig, "StyleUrl");
             $this->PageTitle = $XMan->GetNodeValueByName($MyConfig, "PageTitle");
             $this->PageIntroduction = $XMan->GetNodeValueByName($MyConfig, "PageIntroduction");
             $this->PageIntroduction = str_replace("[", "<", $this->PageIntroduction);
             $this->PageIntroduction = str_replace("]", ">", $this->PageIntroduction);
             $this->PageIntroduction = str_replace("\n", "<br />", $this->PageIntroduction);
             $this->DisplayHiddenFiles = $XMan->GetNodeValueByName($MyConfig, "DisplayHiddenFiles");
             $this->BrowseSubFolders = $XMan->GetNodeValueByName($MyConfig, "BrowseSubFolders");
             $this->SortBy = $XMan->GetNodeValueByName($MyConfig, "SortBy");
             $this->SortDirection = $XMan->GetNodeValueByName($MyConfig, "SortDirection");
             $this->DateFormat = $XMan->GetNodeValueByName($MyConfig, "DateFormat");
             $this->UsePageIntroductionInSubFolders = ForceBool($XMan->GetNodeValueByName($MyConfig, "UsePageIntroductionInSubFolders"), false);
             $this->PluginHeight = ForceInt($XMan->GetNodeValueByName($MyConfig, "PluginHeight"), $this->PluginHeight);
             $this->PluginWidth = ForceInt($XMan->GetNodeValueByName($MyConfig, "PluginWidth"), $this->PluginWidth);
             $this->FilesPerPage = ForceIncomingInt("fpp", ForceInt($XMan->GetNodeValueByName($MyConfig, "FilesPerPage"), $this->FilesPerPage));
             $this->MaxFilesPerPage = ForceInt($XMan->GetNodeValueByName($MyConfig, "MaxFilesPerPage"), $this->MaxFilesPerPage);
             $this->FitImagesToPage = ForceBool($XMan->GetNodeValueByName($MyConfig, "FitImagesToPage"), $this->FitImagesToPage);
             $this->UseThumbnails = ForceBool($XMan->GetNodeValueByName($MyConfig, "UseThumbnails"), $this->UseThumbnails);
             $this->HideFiles = explode(",", $XMan->GetNodeValueByName($MyConfig, "HideFiles"));
             for ($i = 0; $i < count($this->HideFiles); $i++) {
                 $this->FullyQualifiedHideFiles[] = $this->CurrentBrowsingDirectory . "/" . $this->HideFiles[$i];
             }
         }
     }
     return $this->ErrorManager->Iif();
 }
开发者ID:jdegges,项目名称:pipweb,代码行数:54,代码来源:index.php


示例5: foreach

Create two XML Containers within a Berkeley DB environment,
then within a Berkeley DB transaction add a document to
each container.

EXPECTED RESULT:
Success
ACTUAL RESULT:
<?php 
$book_name = 'book1';
$book_content = '<book><title>Knowledge Discovery in Databases.</title></book>';
foreach (array_merge(glob("__db*"), glob("log.O"), glob("test*.dbxml")) as $file) {
    @unlink($file);
}
$env = new Db4Env();
$env->open();
$mgr = new XmlManager($env);
$config = new XmlContainerConfig();
$config->setTransactional(true);
$mgr->setDefaultContainerConfig($config);
$con1 = $mgr->createContainer("test.dbxml");
$con2 = $mgr->createContainer("test2.dbxml");
$txn = $mgr->createTransaction();
$con1->putDocument($txn, $book_name, $book_content);
$con2->putDocument($txn, $book_name, $book_content);
$txn->commit();
unset($con1);
unset($con2);
unset($mgr);
$env->close();
print "Success\n";
开发者ID:kanbang,项目名称:Colt,代码行数:30,代码来源:10.php


示例6: resolveDocument

Currently non-functional.
<?php 
$book_name = 'book1';
$book_content = '<book><title>Knowledge Discovery in Databases.</title></book>';
class myResolver extends XmlResolver
{
    function resolveDocument($uri, &$result)
    {
        print "In resolveDocument({$uri})\n";
        $result = new XmlValue("<a><b>b</b></a>");
        return true;
    }
    function resolveCollection($uri, &$result)
    {
        print "In resolveCollection({$uri})\n";
        return false;
    }
}
$r = new myResolver();
$mgr = new XmlManager();
$mgr->registerResolver($r);
$con = $mgr->createContainer("test.dbxml");
$con->putDocument($book_name, $book_content);
$results = $mgr->query("doc('myscheme:xxx')/root");
print_r($results);
开发者ID:kanbang,项目名称:Colt,代码行数:25,代码来源:12.php


示例7: XmlManager

Create an XmlContainer, add a document that includes a
namespace definition, create a query context, define a
namespace prefix to URI mapping, query the container
for the document within a context, iterate over the
result set displaying the values returned.

EXPECTED RESULT:
book1_ns = <book xmlns:books="http://foo.bar.com/books.dtd"><books:title>Knowledge Discovery in Databases.</books:title></book>
ACTUAL RESULT:
<?php 
$book_name = 'book1_ns';
$book_content = "<book xmlns:books='http://foo.bar.com/books.dtd'><books:title>Knowledge Discovery in Databases.</books:title></book>";
$container_name = 'test.dbxml';
$mgr = new XmlManager(null);
if (file_exists("test.dbxml")) {
    $mgr->removeContainer("test.dbxml");
}
$con = $mgr->createContainer("test.dbxml");
$con->putDocument($book_name, $book_content);
$qc = $mgr->createQueryContext();
$qc->setNamespace("books2", "http://foo.bar.com/books.dtd");
$results = $mgr->query("collection('test.dbxml')/*[books2:title='Knowledge Discovery in Databases.']", $qc);
$results->reset();
while ($results->hasNext()) {
    $val = $results->next();
    $doc = $val->asDocument();
    print $doc->getName() . " = " . $val->asString() . "\n";
}
开发者ID:kanbang,项目名称:Colt,代码行数:28,代码来源:03.php


示例8: File

}
// If the folder exists, and there is a _config.xml file in the folder, reconfigure the filebrowser
if ($Config->CurrentWorkingDirectory != $Config->CurrentBrowsingDirectory) {
    $Config->RetrieveConfigurationPropertiesFromXml($Config->CurrentBrowsingDirectory);
}
// -----------------------------------
// 2. RETRIEVE FILE EXTENSION SETTINGS
// -----------------------------------
$File = new File();
$File->Name = $Config->FileTypesFile;
$File->Path = $Config->CurrentWorkingDirectory;
$FileManager = new FileManager();
$FileManager->ErrorManager =& $Config->ErrorManager;
$File = $FileManager->Get($File);
// Create an XML Parser to retrieve configuration settings
$XmlManager = new XmlManager();
$XmlManager->ErrorManager =& $ErrorManager;
$FileTypes = $XmlManager->ParseNode($File->Body);
// Create an array of all defined file types
$FileCollections = array();
$FolderCollection = array();
$ExtensionLibrary = array();
for ($i = 0; $i < count($FileTypes->Child); $i++) {
    if ($FileTypes->Child[$i]->Name == "FileGroup") {
        $FileCollections[$i] = new FileCollection($FileTypes->Child[$i]->Attributes["Name"]);
        for ($j = 0; $j < count($FileTypes->Child[$i]->Child); $j++) {
            $Node = $FileTypes->Child[$i]->Child[$j];
            if ($Node->Name == "Extensions") {
                // Ignore all items with a handler method of none
                if (@$Node->Attributes["HandlerMethod"] != "None") {
                    $CurrentExtensionArray = explode(",", $Node->Value);
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:31,代码来源:index.php


示例9: getParsedDefListFromXml

 protected function getParsedDefListFromXml()
 {
     $xml_mgr = new XmlManager();
     $defs = $xml_mgr->getList($this->db_type);
     $defs = array_map(array($this, 'parseDef'), $defs);
     return $defs;
 }
开发者ID:GameCrusherTechnology,项目名称:HeroTowerServer,代码行数:7,代码来源:XmlManager.class.php


示例10: XmlManager

Create an XML Container, rename that container, delete the
container, and repeat.
EXPECTED RESULT:
Success
ACTUAL RESULT:
<?php 
$mgr = new XmlManager();
for ($i = 0; $i < 5; $i++) {
    $con = $mgr->createContainer("test1.dbxml");
    unset($con);
    $mgr->renameContainer("test1.dbxml", "test2.dbxml");
    $con = $mgr->openContainer("test2.dbxml");
    unset($con);
    $mgr->removeContainer("test2.dbxml");
}
print "Success\n";
开发者ID:kanbang,项目名称:Colt,代码行数:16,代码来源:07.php


示例11: XmlManager

Displays the behavior of XmlInputStream.  When a is stream is created it can
only be destroyed by passing it to putDocument.  Also, once it is passed
to putDocument, if it is accessed again it will cause a segment fault

EXPECTED RESULT:
book1.xml = <book><title>Knowledge Discovery in Databases.</title></book>
ACTUAL RESULT:
<?php 
$file_name = "book1.xml";
$mgr = new XmlManager();
if ($mgr->existsContainer("test.dbxml")) {
    $mgr->removeContainer("test.dbxml");
}
$con = $mgr->createContainer("test.dbxml");
$inputstream = $mgr->createLocalFileInputStream($file_name);
$con->putDocument($file_name, $inputstream);
$doc = $con->getDocument($file_name);
$s = $doc->getContentAsString();
print $doc->getName() . " = {$s}\n";
unset($doc);
unset($con);
$mgr->removeContainer("test.dbxml");
开发者ID:kanbang,项目名称:Colt,代码行数:22,代码来源:14.php


示例12: XmlManager

Create an XmlManager/XmlContainer, add a document, query the container
for the document, iterate over the result set displaying the
values returned.

EXPECTED RESULT:
book1 = <book><title>Knowledge Discovery in Databases.</title></book>
ACTUAL RESULT:
<?php 
$book_name = 'book1';
$book_content = '<book><title>Knowledge Discovery in Databases.</title></book>';
$container_name = 'test.dbxml';
$mgr = new XmlManager();
if (file_exists("test.dbxml")) {
    $mgr->removeContainer("test.dbxml");
}
$con = $mgr->createContainer("test.dbxml");
$con->putDocument($book_name, $book_content);
$results = $mgr->query("collection('test.dbxml')/book");
$results->reset();
while ($results->hasNext()) {
    $val = $results->next();
    $doc = $val->asDocument();
    print $doc->getName() . " = " . $val->asString() . "\n";
}
开发者ID:kanbang,项目名称:Colt,代码行数:24,代码来源:02.php


示例13: unlink

Create an XmlContainer, define an equality string index
for booktitle elements, add a document, create a query
context, define a variable binding, query the container
for the document within a context referencing the variable
defined, iterate over the result set displaying the values
returned.

EXPECTED RESULT:
book1 = <book><title>Knowledge Discovery in Databases.</title></book>
ACTUAL RESULT:
<?php 
$book_name = 'book1';
$book_content = "<book><title>Knowledge Discovery in Databases.</title></book>";
$container_name = 'test.dbxml';
unlink($container_name);
$mgr = new XmlManager(null);
$con = $mgr->createContainer("test.dbxml");
$con->addIndex("", "title", "node-element-equality-string");
$con->putDocument($book_name, $book_content);
$qc = $mgr->createQueryContext();
$qc->setVariableValue("title", "Knowledge Discovery in Databases.");
$results = $mgr->query("collection('test.dbxml')//*[title=\$title]", $qc);
$results->reset();
while ($results->hasNext()) {
    $val = $results->next();
    $doc = $val->asDocument();
    print $doc->getName() . " = " . $val->asString() . "\n";
}
开发者ID:kanbang,项目名称:Colt,代码行数:28,代码来源:05.php


示例14: testNamespaces

 /**
  * testNamespaces method
  *
  * @access public
  * @return void
  */
 function testNamespaces()
 {
     $source = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>';
     $xml = new Xml($source);
     $expects = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e" xmlns:f="http://example.com/f"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>';
     $_xml = XmlManager::getInstance();
     $xml->addNamespace('f', 'http://example.com/f');
     $result = $xml->toString(array('cdata' => false));
     $this->assertEqual($expects, $result);
 }
开发者ID:slywalker,项目名称:CakePHPWorkshopKansai,代码行数:16,代码来源:xml.test.php


示例15: foreach

Create an use a transactional XML Container:
add a document, get the document, display the content of
the document.

EXPECTED RESULT:
book1 = <book><title>Knowledge Discovery in Databases.</title></book>
ACTUAL RESULT:
<?php 
$book_name = 'book1';
$book_content = '<book><title>Knowledge Discovery in Databases.</title></book>';
foreach (array_merge(glob("__db*"), glob("log.O"), glob("test*.dbxml")) as $file) {
    @unlink($file);
}
$env = new Db4Env();
$env->open();
$mgr = new XmlManager($env);
$con = $mgr->createContainer("test.dbxml");
$con->putDocument($book_name, $book_content);
$doc = $con->getDocument($book_name);
$s = $doc->getContentAsString();
print $doc->getName() . " = {$s}\n";
unset($doc);
unset($con);
$mgr->removeContainer("test.dbxml");
$env->close();
开发者ID:kanbang,项目名称:Colt,代码行数:25,代码来源:08.php


示例16: XmlManager

EXPECTED RESULT:
book1 = <book><title>Knowledge Discovery in Databases.</title></book>
ACTUAL RESULT:
<?php 
#
# This is a very simple example of using try/catch and XmlException
# to get information on an exception thrown from Berkeley DB XML.
# The line that generates the exception is the query, which uses
# bad XQuery syntax.
#
$book_name = 'book1';
$book_content = '<book><title>Knowledge Discovery in Databases.</title></book>';
$mgr = new XmlManager();
try {
    $con = $mgr->createContainer("test.dbxml");
    $con->putDocument($book_name, $book_content);
    $qc = $mgr->createQueryContext();
    $res = $mgr->query("collection('test.dbxml')/x[", $qc);
    $doc = $con->getDocument("foo");
    $s = $doc->getContentAsString();
    print $doc->getName() . " = {$s}\n";
    unset($doc);
    unset($con);
} catch (XmlException $xe) {
    print "XmlException message: " . $xe->what() . "\n";
    print "XmlException code: " . $xe->getExceptionCode() . "\n";
    print "XmlException dbErrno: " . $xe->getDbErrno() . "\n";
    print "Query line: " . $xe->getQueryLine() . "\n";
    print "Query column: " . $xe->getQueryColumn() . "\n";
    unset($con);
}
开发者ID:kanbang,项目名称:Colt,代码行数:31,代码来源:exceptionExample.php


示例17: unlink

Create an XmlContainer, define an equality string index
for booktitle elements, add a document, query the container
for the document, iterate over the result set displaying
the values returned.

EXPECTED RESULT:
book1 = <book><title>Knowledge Discovery in Databases.</title></book>
ACTUAL RESULT:
<?php 
$book_name = 'book1';
$book_content = "<book><title>Knowledge Discovery in Databases.</title></book>";
$container_name = 'test.dbxml';
unlink($container_name);
$mgr = new XmlManager(null);
$con = $mgr->createContainer("test.dbxml");
$con->addIndex("", "title", "node-element-equality-string");
$con->putDocument($book_name, $book_content);
$results = $mgr->query("collection('test.dbxml')//*[title='Knowledge Discovery in Databases.']");
$results->reset();
while ($results->hasNext()) {
    $val = $results->next();
    $doc = $val->asDocument();
    print $doc->getName() . " = " . $val->asString() . "\n";
}
开发者ID:kanbang,项目名称:Colt,代码行数:24,代码来源:04.php



注:本文中的XmlManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XmlParser类代码示例发布时间:2022-05-23
下一篇:
PHP Xml类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap