You are here

function JSimpleXML::_startElement in Ubercart 5

Handler function for the start of a tag

@access protected

Parameters

resource $parser:

string $name:

array $attrs:

File

uc_store/includes/simplexml.php, line 291

Class

JSimpleXML
SimpleXML implementation.

Code

function _startElement($parser, $name, $attrs = array()) {

  //Make the name of the tag lower case
  $name = strtolower($name);

  //Check to see if tag is root-level
  if (count($this->_stack) == 0) {

    //If so, set the document as the current tag
    $this->document = new JSimpleXMLElement($name, $attrs);

    //And start out the stack with the document tag
    $this->_stack = array(
      'document',
    );
  }
  else {

    //Get the name which points to the current direct parent, relative to $this
    $parent = $this
      ->_getStackLocation();

    //Add the child
    eval('$this->' . $parent . '->addChild($name, $attrs, ' . count($this->_stack) . ');');

    //Update the stack
    eval('$this->_stack[] = $name.\'[\'.(count($this->' . $parent . '->' . $name . ') - 1).\']\';');
  }
}