public function namespaceToPhp($xmlNS)
    {
        $ns = $xmlNS;
        $ns = $this->expandNS($ns);
        if (preg_match('/urn:/', $ns)) {
            //@todo check if there are any components of namespace which are
            $ns = preg_replace('/-/', '_', $ns);
            $ns = preg_replace('/urn:/', '', $ns);
            $ns = preg_replace('/:/', '\\', $ns);
        }

        /**
         if (preg_match('/http:\/\//', $ns)) {
         $ns = preg_replace('/http:\/\//', '', $ns);
         $ns = preg_replace('/\//','\\', $ns);
         $ns = preg_replace('/\./', '\\',$ns);
         }*/

        $matches = array();
        if (preg_match("#((http|https|ftp)://(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|\"|'|:|\<|$|\.\s)#", $ns, $matches)) {
            $elements = explode("/", $matches[3]);
            $domain = $elements[0];
            array_shift($elements);
            //print_r($domain."\n");
            $ns = implode("\\", array_reverse(explode(".", $domain)));
            //$ns = preg_replace('/\./', '\\', );
            //print $ns."\n";
            foreach ($elements as $key => $value) {
                if ($value != '') {
                    $value = preg_replace('/\./', '_', $value);
                    $ns .= "\\" . $value;
                }
            }
        }


        $ns = explode('\\', $ns);
        $i = 0;
        foreach ($ns as $elem) {
            if (preg_match('/^([0-9]+)(.*)$/', $elem)) {
                $ns[$i] = "_".$elem;
            }

            if (in_array($elem, $this->reservedWords)) {
                $ns[$i] = "_".$elem;
            }
            $i++;
        }

        $ns = implode('\\', $ns);

        return $ns;
    }
public function namespaceToPhp($xmlNS)
    {
        $ns = $xmlNS;
        $ns = $this->expandNS($ns);
        if (preg_match('/urn:/', $ns)) {
            //@todo check if there are any components of namespace which are
            $ns = preg_replace('/-/', '_', $ns);
            $ns = preg_replace('/urn:/', '', $ns);
            $ns = preg_replace('/:/', '\\', $ns);
        }

        /**
         if (preg_match('/http:\/\//', $ns)) {
         $ns = preg_replace('/http:\/\//', '', $ns);
         $ns = preg_replace('/\//','\\', $ns);
         $ns = preg_replace('/\./', '\\',$ns);
         }*/

        $matches = array();
        if (preg_match("#((http|https|ftp)://(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|\"|'|:|\<|$|\.\s)#", $ns, $matches)) {
            $elements = explode("/", $matches[3]);
            $domain = $elements[0];
            array_shift($elements);
            //print_r($domain."\n");
            $ns = implode("\\", array_reverse(explode(".", $domain)));
            //$ns = preg_replace('/\./', '\\', );
            //print $ns."\n";
            foreach ($elements as $key => $value) {
                if ($value != '') {
                    $value = preg_replace('/\./', '_', $value);
                    $ns .= "\\" . $value;
                }
            }
        }


        $ns = explode('\\', $ns);
        $i = 0;
        foreach ($ns as $elem) {
            if (preg_match('/^([0-9]+)(.*)$/', $elem)) {
                $ns[$i] = "_".$elem;
            }

            if (in_array($elem, $this->reservedWords)) {
                $ns[$i] = "_".$elem;
            }
            $i++;
        }

        $ns = implode('\\', $ns);

        return $ns;
    }
public function namespaceToPhp ( $ xmlNS ) { $ ns = $ xmlNS ; $ ns = $ this -> expandNS ( $ ns ) ; if ( preg_match ( '/urn:/' , $ ns ) ) { //@todo check if there are any components of namespace which are $ ns = preg_replace ( '/-/' , '_' , $ ns ) ; $ ns = preg_replace ( '/urn:/' , '' , $ ns ) ; $ ns = preg_replace ( '/:/' , '\\' , $ ns ) ; } /**
         if (preg_match('/http:\/\//', $ns)) {
         $ns = preg_replace('/http:\/\//', '', $ns);
         $ns = preg_replace('/\//','\\', $ns);
         $ns = preg_replace('/\./', '\\',$ns);
         }*/ $ matches = array ( ) ; if ( preg_match ( "#((http|https|ftp)://(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|\"|'|:|\<|$|\.\s)#" , $ ns , $ matches ) ) { $ elements = explode ( "/" , $ matches [ 3 ] ) ; $ domain = $ elements [ 0 ] ; array_shift ( $ elements ) ; //print_r($domain."\n"); $ ns = implode ( "\\" , array_reverse ( explode ( "." , $ domain ) ) ) ; //$ns = preg_replace('/\./', '\\', ); //print $ns."\n"; foreach ( $ elements as $ key => $ value ) { if ( $ value != '' ) { $ value = preg_replace ( '/\./' , '_' , $ value ) ; $ ns .= "\\" . $ value ; } } } $ ns = explode ( '\\' , $ ns ) ; $ i = 0 ; foreach ( $ ns as $ elem ) { if ( preg_match ( '/^([0-9]+)(.*)$/' , $ elem ) ) { $ ns [ $ i ] = "_" . $ elem ; } if ( in_array ( $ elem , $ this -> reservedWords ) ) { $ ns [ $ i ] = "_" . $ elem ; } $ i ++ ; } $ ns = implode ( '\\' , $ ns ) ; return $ ns ; }
Convert XML URI to PHP complient namespace

@param string $xmlNS XML URI

@return string
Convert XML URI to PHP complient namespace