public function parseString($xmlString, $xmlFile = null)
    {
        // we don't want infinite recursion
        if ($this->isAlreadyParsed($xmlFile)) {
            return;
        }
        // store current schema file path
        $this->schemasTagsStack[$xmlFile] = [];
        $this->currentXmlFile = $xmlFile;

        $parser = xml_parser_create();
        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
        xml_set_object($parser, $this);
        xml_set_element_handler($parser, 'startElement', 'endElement');
        if (!xml_parse($parser, $xmlString)) {
            throw new SchemaException(sprintf('XML error: %s at line %d',
                xml_error_string(xml_get_error_code($parser)),
                xml_get_current_line_number($parser))
            );
        }
        xml_parser_free($parser);

        array_pop($this->schemasTagsStack);

        return $this->schema;
    }
public function parseString($xmlString, $xmlFile = null)
    {
        // we don't want infinite recursion
        if ($this->isAlreadyParsed($xmlFile)) {
            return;
        }
        // store current schema file path
        $this->schemasTagsStack[$xmlFile] = [];
        $this->currentXmlFile = $xmlFile;

        $parser = xml_parser_create();
        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
        xml_set_object($parser, $this);
        xml_set_element_handler($parser, 'startElement', 'endElement');
        if (!xml_parse($parser, $xmlString)) {
            throw new SchemaException(sprintf('XML error: %s at line %d',
                xml_error_string(xml_get_error_code($parser)),
                xml_get_current_line_number($parser))
            );
        }
        xml_parser_free($parser);

        array_pop($this->schemasTagsStack);

        return $this->schema;
    }
public function parseString ( $ xmlString , $ xmlFile = null ) { // we don't want infinite recursion if ( $ this -> isAlreadyParsed ( $ xmlFile ) ) { return ; } // store current schema file path $ this -> schemasTagsStack [ $ xmlFile ] = [ ] ; $ this -> currentXmlFile = $ xmlFile ; $ parser = xml_parser_create ( ) ; xml_parser_set_option ( $ parser , XML_OPTION_CASE_FOLDING , 0 ) ; xml_set_object ( $ parser , $ this ) ; xml_set_element_handler ( $ parser , 'startElement' , 'endElement' ) ; if ( ! xml_parse ( $ parser , $ xmlString ) ) { throw new SchemaException ( sprintf ( 'XML error: %s at line %d' , xml_error_string ( xml_get_error_code ( $ parser ) ) , xml_get_current_line_number ( $ parser ) ) ) ; } xml_parser_free ( $ parser ) ; array_pop ( $ this -> schemasTagsStack ) ; return $ this -> schema ; }
Parses a XML input string and returns a newly created and
populated Schema structure.

@param  string $xmlString The input string to parse.
@param  string $xmlFile   The input file name.
@return Schema
Parses a XML input string and returns a newly created and populated Schema structure .