You are here

function XMLParser::StartElement in Asset 6

Same name in this branch
  1. 6 asset_youtube/xmlparser.class.php \XMLParser::StartElement()
  2. 6 asset_youtube/inc/xmlparser.class.php \XMLParser::StartElement()
Same name and namespace in other branches
  1. 5 asset_youtube/xmlparser.class.php \XMLParser::StartElement()

Handler function for the start of a tag

Parameters

resource $parser:

string $name:

array $attrs:

File

asset_youtube/inc/xmlparser.class.php, line 138

Class

XMLParser
XML Parser Class (php4)

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 XMLTag($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).\']\';');
  }
}