function __construct() { parent::__construct('<?xml version="1.0" encoding="UTF-8"?> <manifest identifier="cctd0015" xmlns="http://www.imsglobal.org/xsd/imsccv1p2/imscp_v1p1" xmlns:lom="http://ltsc.ieee.org/xsd/imsccv1p2/LOM/resource" xmlns:lomimscc="http://ltsc.ieee.org/xsd/imsccv1p2/LOM/manifest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsccv1p2/imscp_v1p1 http://www.imsglobal.org/profile/cc/ccv1p2/ccv1p2_imscp_v1p2_v1p0.xsd http://ltsc.ieee.org/xsd/imsccv1p2/LOM/resource http://www.imsglobal.org/profile/cc/ccv1p2/LOM/ccv1p2_lomresource_v1p0.xsd http://ltsc.ieee.org/xsd/imsccv1p2/LOM/manifest http://www.imsglobal.org/profile/cc/ccv1p2/LOM/ccv1p2_lommanifest_v1p0.xsd"> <metadata> <schema>IMS Common Cartridge</schema> <schemaversion>1.2.0</schemaversion> <lomimscc:lom> <lomimscc:general> <lomimscc:title> <lomimscc:string language="en-US">Common Cartridge Test Data Set - Validation Cartridge 1</lomimscc:string> </lomimscc:title> <lomimscc:description> <lomimscc:string language="en-US">Sample Common Cartridge with a Basic Learning Tools Interoperability Link</lomimscc:string> </lomimscc:description> </lomimscc:general> </lomimscc:lom> </metadata> <organizations> <organization identifier="T_1000" structure="rooted-hierarchy"> <item identifier="T_00000"> <item identifier="T_00001" identifierref="T_00001_R"> <title>BLTI Test</title> </item> <item identifier="T_00005" identifierref="T_00005_R"> <title>Web Link Test</title> </item> </item> </organization> </organizations> <resources> <resource identifier="T_00001_R" type="imsbasiclti_xmlv1p0"> <file href="LTI.xml"/> <dependency identifierref="BLTI001_Icon"/> </resource> <resource identifier="T_00005_R" type="imswl_xmlv1p2"> <file href="WebLink.xml"/> </resource> </resources> </manifest>'); $xpath = new \DOMXpath($this); $res = $xpath->query(self::resource_xpath)->item(0); $this->delete_children_ns(self::CC_1_2_CP, $res); $items = $xpath->query(self::item_xpath)->item(0); $this->delete_children_ns(self::CC_1_2_CP, $items); $lom = $xpath->query(self::lom_general_xpath)->item(0); $this->delete_children_ns(self::LOMIMSCC_NS, $lom); }
function __construct() { parent::__construct('<?xml version="1.0" encoding="UTF-8"?> <webLink xmlns="http://www.imsglobal.org/xsd/imsccv1p2/imswl_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsccv1p2/imswl_v1p2 http://www.imsglobal.org/profile/cc/ccv1p2/ccv1p2_imswl_v1p2.xsd"> <title>Wikipedia - Psychology</title> <url href="http://en.wikipedia.org/wiki/Psychology" target="_iframe"/> </webLink>'); $this->set_namespace(CC::WL_NS); $this->delete_tag('title'); $this->delete_tag('url'); }
public function saveXML(\DOMNode $node = NULL, $options = NULL) { // Clear out empty nodes // http://stackoverflow.com/questions/8603237/remove-empty-tags-from-a-xml-with-php $xpath = new \DOMXPath($this); foreach ($xpath->query('//*[not(node())]') as $entry) { $entry->parentNode->removeChild($entry); } return parent::saveXML($node, $options); }