mixed) */ protected $properties = array(); /** * Creates a new XML tool. * * Creates an new XML tool instance. If not $namespaceRegistry is provided, * the default {@link ezcWebdavNamespaceRegistry} will be instanciated and * used. The registry can be accessed through the $namespaceRegistry * property. * * @param ezcWebdavNamespaceRegistry $namespaceRegistry * @return void */ public function __construct( ezcWebdavNamespaceRegistry $namespaceRegistry = null ) { // Initialize properties $this->properties['namespaceRegistry'] = null; $this->namespaceRegistry = ( $namespaceRegistry === null ? new ezcWebdavNamespaceRegistry() : $namespaceRegistry ); } /** * Returns a DOMDocument from the given XML. * * Creates a new DOMDocument with the options set in the class constants * and loads the optionally given $xml string with settings appropriate to * work with it. Returns false if the loading fails. * * @param sting $content * @return DOMDocument|false * @see LIBXML_NOWARNING, LIBXML_NSCLEAN, LIBXML_NOBLANKS */ public function createDomDocument( $content = null ) { $dom = new DOMDocument( self::XML_VERSION, self::XML_ENCODING ); if ( $content !== null ) { if ( $dom->loadXML( $content, LIBXML_NOWARNING | LIBXML_NSCLEAN | LIBXML_NOBLANKS ) === false ) { return false; } } return $dom; } /** * Returns a new DOMElement in the given namespace. * * Retrieves the shortcut for the $namespace and creates a new DOMElement * object with the correct global name for the given $localName. * * @param DOMDocument $dom * @param string $localName * @param string $namespace * @return DOMElement */ public function createDomElement( DOMDocument $dom, $localName, $namespace = self::XML_DEFAULT_NAMESPACE ) { return $dom->createElementNS( $namespace, "{$this->namespaceRegistry[$namespace]}:{$localName}" ); } /** * Property write access. * * @param string $propertyName Name of the property. * @param mixed $propertyValue The value for the property. * * @throws ezcBasePropertyNotFoundException * If a the value for the property options is not an instance of * @throws ezcBaseValueException * If a the value for a property is out of range. * @ignore */ public function __set( $propertyName, $propertyValue ) { switch ( $propertyName ) { case 'namespaceRegistry': if ( ( $propertyValue instanceof ezcWebdavNamespaceRegistry ) === false ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcWebdavNamespaceRegistry' ); } break; default: throw new ezcBasePropertyNotFoundException( $propertyName ); } $this->properties[$propertyName] = $propertyValue; } /** * Property read access. * * @param string $propertyName Name of the property. * @return mixed Value of the property or null. * * @throws ezcBasePropertyNotFoundException * If the the desired property is not found. * @ignore */ public function __get( $propertyName ) { if ( $this->__isset( $propertyName ) === false ) { throw new ezcBasePropertyNotFoundException( $propertyName ); } return $this->properties[$propertyName]; } /** * Property isset access. * * @param string $propertyName Name of the property. * @return bool True is the property is set, otherwise false. * @ignore */ public function __isset( $propertyName ) { return array_key_exists( $propertyName, $this->properties ); } } ?>