/**
	 * Set this packagexml with data from the component.
	 * This is useful in the packager.
	 *
	 * WARNING, this will revert any modifications done to the package.xml file!
	 *
	 * @param Component_2_1 $component
	 *
	 * @return string
	 */
	public function setFromComponent(Component_2_1 $component){
		// Populate the root attributes for this component package.
		$this->setType('component');
		$this->setName($component->getName());
		$this->setVersion($component->getVersion());
		$this->setPackager(Core::GetComponent()->getVersion());

		// Copy over any provide directives.
		foreach ($component->getRootDOM()->getElementsByTagName('provide') as $u) {
			$this->getRootDOM()->appendChild($this->getDOM()->importNode($u));
		}
		
		$this->setProvide('component', $component->getName(), $component->getVersion());
	
		// Copy over any requires directives.
		foreach ($component->getRootDOM()->getElementsByTagName('require') as $u) {
			$this->getRootDOM()->appendChild($this->getDOM()->importNode($u));
		}
	
		// Copy over any upgrade directives.
		// This one can be useful for an existing installation to see if this
		// package can provide a valid upgrade path.
		foreach ($component->getRootDOM()->getElementsByTagName('upgrade') as $u) {
			// In this case, I just need the definition itself, I don't also need the contents of that upgrade.
			$this->setUpgrade($u->getAttribute('from'), $u->getAttribute('to'));
		}
	
		// Tack on description
		$desc = $component->getRootDOM()->getElementsByTagName('description')->item(0);
		if ($desc) {
			$this->setDescription($desc->nodeValue);
		}
	}