本文整理汇总了PHP中XMLCustomWriter::getXml方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLCustomWriter::getXml方法的具体用法?PHP XMLCustomWriter::getXml怎么用?PHP XMLCustomWriter::getXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLCustomWriter
的用法示例。
在下文中一共展示了XMLCustomWriter::getXml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* @copydoc Filter::process()
* @param $input MetadataDescription
*/
function &process(&$input)
{
// Start the XML document.
$doc =& XMLCustomWriter::createDocument();
// Create the root element.
$root =& XMLCustomWriter::createElement($doc, 'xMetaDiss:xMetaDiss');
// Add the XML namespace and schema.
XMLCustomWriter::setAttribute($root, 'xmlns:xMetaDiss', 'http://www.d-nb.de/standards/xmetadissplus/');
XMLCustomWriter::setAttribute($root, 'xmlns:cc', 'http://www.d-nb.de/standards/cc/');
XMLCustomWriter::setAttribute($root, 'xmlns:dc', 'http://purl.org/dc/elements/1.1/');
XMLCustomWriter::setAttribute($root, 'xmlns:dcmitype', 'http://purl.org/dc/dcmitype');
XMLCustomWriter::setAttribute($root, 'xmlns:dcterms', 'http://purl.org/dc/terms/');
XMLCustomWriter::setAttribute($root, 'xmlns:ddb', 'http://www.d-nb.de/standards/ddb/');
XMLCustomWriter::setAttribute($root, 'xmlns:doi', 'http://www.d-nb.de/standards/doi/');
XMLCustomWriter::setAttribute($root, 'xmlns:hdl', 'http://www.d-nb.de/standards/hdl/');
XMLCustomWriter::setAttribute($root, 'xmlns:pc', 'http://www.d-nb.de/standards/pc/');
XMLCustomWriter::setAttribute($root, 'xmlns', 'http://www.d-nb.de/standards/subject/');
XMLCustomWriter::setAttribute($root, 'xmlns:thesis', 'http://www.ndltd.org/standards/metadata/etdms/1.0/');
XMLCustomWriter::setAttribute($root, 'xmlns:urn', 'http://www.d-nb.de/standards/urn/');
XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.d-nb.de/standards/xmetadissplus/ http://www.d-nb.de/standards/xmetadissplus/xmetadissplus.xsd');
// Prepare the XMDP document hierarchy from the XMDP MetadataDescription instance.
$documentHierarchy =& $this->_buildDocumentHierarchy($doc, $root, $input);
// Recursively join the document hierarchy into a single document.
$root =& $this->_joinNodes($documentHierarchy);
XMLCustomWriter::appendChild($doc, $root);
// Retrieve the XML from the DOM.
$output = XMLCustomWriter::getXml($doc);
return $output;
}
示例2:
/**
* @copydoc Filter::process()
* @param $input MetadataDescription
*/
function &process(&$input)
{
// Start the XML document.
$doc =& XMLCustomWriter::createDocument();
// Create the root element.
$root =& XMLCustomWriter::createElement($doc, 'mods');
// Add the XML namespace and schema.
XMLCustomWriter::setAttribute($root, 'version', '3.4');
XMLCustomWriter::setAttribute($root, 'xmlns', 'http://www.loc.gov/mods/v3');
XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-4.xsd');
// Prepare the MODS document hierarchy from the MODS MetadataDescription instance.
$documentHierarchy =& $this->_buildDocumentHierarchy($doc, $root, $input);
// Recursively join the document hierarchy into a single document.
$root =& $this->_joinNodes($documentHierarchy);
XMLCustomWriter::appendChild($doc, $root);
// Retrieve the XML from the DOM.
$output = XMLCustomWriter::getXml($doc);
return $output;
}
示例3: _getArticleListXml
/**
* Retrieve the XML for a batch of articles to be updated.
*
* @param $articles DBResultFactory The articles to be included
* in the list.
* @param $totalCount integer The overall number of changed articles
* (not only the current batch).
* @param $numDeleted integer An output parameter that returns
* the number of documents that will be deleted.
*
* @return string The XML ready to be consumed by the Solr data
* import service.
*/
function _getArticleListXml(&$articles, $totalCount, &$numDeleted)
{
// Create the DOM document.
$articleDoc =& XMLCustomWriter::createDocument();
assert(is_a($articleDoc, 'DOMDocument'));
// Create the root node.
$articleList =& XMLCustomWriter::createElement($articleDoc, 'articleList');
XMLCustomWriter::appendChild($articleDoc, $articleList);
// Run through all articles in the batch and generate an
// XML list for them.
$numDeleted = 0;
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
/* @var $publishedArticleDao PublishedArticleDAO */
foreach ($articles as $article) {
if (!is_a($article, 'PublishedArticle')) {
// Try to upgrade the article to a published article.
$publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($article->getId());
if (is_a($publishedArticle, 'PublishedArticle')) {
unset($article);
$article =& $publishedArticle;
unset($publishedArticle);
}
}
$journal = $this->_getJournal($article->getJournalId());
// Check the publication state and subscription state of the article.
if ($this->_isArticleAccessAuthorized($article)) {
// Mark the article for update.
$this->_addArticleXml($articleDoc, $article, $journal);
} else {
// Mark the article for deletion.
$numDeleted++;
$this->_addArticleXml($articleDoc, $article, $journal, true);
}
unset($journal, $article);
}
// Add the "has more" attribute so that the server knows
// whether more batches may have to be pulled (useful for
// pull indexing only).
$hasMore = count($articles) < $totalCount ? 'yes' : 'no';
$articleDoc->documentElement->setAttribute('hasMore', $hasMore);
// Return XML.
return XMLCustomWriter::getXml($articleDoc);
}
示例4: solrQuery
function solrQuery(&$xmlDoc)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->getSetting('solrUrl') . '/update');
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type:text/xml; charset=utf-8"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POSTFIELDS, XMLCustomWriter::getXml($xmlDoc));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
if (curl_errno($ch)) {
curl_close($ch);
fatalError('CURL Error: ' . curl_error($ch));
} else {
curl_close($ch);
$xmlParser = new XMLParser();
$result = null;
@($result =& $xmlParser->parseTextStruct($data, array("int")));
if ($result) {
foreach ($result as $nodeSet) {
foreach ($nodeSet as $node) {
if (isset($node['attributes']['name']) && $node['attributes']['name'] == 'status' && $node['value'] == 0) {
return true;
}
}
}
}
return false;
}
}