diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2008-08-15 01:29:47 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2008-08-15 01:29:47 +0200 |
commit | 370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch) | |
tree | 491674f4c242e4d6ba0d04eafa305174c35a3391 /includes/XmlTypeCheck.php | |
parent | f4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff) |
Update auf 1.13.0
Diffstat (limited to 'includes/XmlTypeCheck.php')
-rw-r--r-- | includes/XmlTypeCheck.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/includes/XmlTypeCheck.php b/includes/XmlTypeCheck.php index 639d1f85..09b8c20a 100644 --- a/includes/XmlTypeCheck.php +++ b/includes/XmlTypeCheck.php @@ -6,16 +6,16 @@ class XmlTypeCheck { * well-formed XML. Note that this doesn't check schema validity. */ public $wellFormed = false; - + /** * Name of the document's root element, including any namespace * as an expanded URL. */ public $rootElement = ''; - + private $softNamespaces; private $namespaces = array(); - + /** * @param $file string filename * @param $softNamespaces bool @@ -28,17 +28,17 @@ class XmlTypeCheck { $this->softNamespaces = $softNamespaces; $this->run( $file ); } - + private function run( $fname ) { if( $this->softNamespaces ) { $parser = xml_parser_create( 'UTF-8' ); } else { $parser = xml_parser_create_ns( 'UTF-8' ); } - + // case folding violates XML standard, turn it off xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false ); - + xml_set_element_handler( $parser, array( $this, 'elementOpen' ), false ); $file = fopen( $fname, "rb" ); @@ -52,9 +52,9 @@ class XmlTypeCheck { return; } } while( !feof( $file ) ); - + $this->wellFormed = true; - + fclose( $file ); xml_parser_free( $parser ); } @@ -70,14 +70,14 @@ class XmlTypeCheck { $this->namespaces[substr( $attrib, strlen( 'xmlns:' ) )] = $val; } } - + if( strpos( $name, ':' ) === false ) { $ns = ''; $subname = $name; } else { list( $ns, $subname ) = explode( ':', $name, 2 ); } - + if( isset( $this->namespaces[$ns] ) ) { $name = $this->namespaces[$ns] . ':' . $subname; } else { @@ -85,7 +85,7 @@ class XmlTypeCheck { // But..... we'll just let it slide in soft mode. } } - + // We only need the first open element $this->rootElement = $name; xml_set_element_handler( $parser, false, false ); |