Grima  2018-08
Whispering into Alma's ear
Public Member Functions | List of all members
XMLAsArrayOfDOMNodesSpecifiedByXPath Class Reference
Inheritance diagram for XMLAsArrayOfDOMNodesSpecifiedByXPath:
XMLAsArrayOfWhateversSpecifiedByXPath

Public Member Functions

 offsetExists ( $offset)
 
 offsetGet ( $offset)
 
 offsetSet ( $offset, $value)
 
 offsetUnset ( $offset)
 
- Public Member Functions inherited from XMLAsArrayOfWhateversSpecifiedByXPath
 __construct ( $xml, $context_node)
 
 __toString ()
 
 __get (string $name)
 
 __set (string $name, $value)
 
 __isset (string $name)
 
 __unset (string $name)
 

Additional Inherited Members

- Public Attributes inherited from XMLAsArrayOfWhateversSpecifiedByXPath
 $xml
 
 $context_node
 
- Protected Member Functions inherited from XMLAsArrayOfWhateversSpecifiedByXPath
 query (string $offset)
 

Detailed Description

Definition at line 97 of file grima-xmlbag.php.

Member Function Documentation

◆ offsetExists()

XMLAsArrayOfDOMNodesSpecifiedByXPath::offsetExists (   $offset)

Definition at line 98 of file grima-xmlbag.php.

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

98  {
99  return $this->query( $offset )->length === 1;
100  }

◆ offsetGet()

XMLAsArrayOfDOMNodesSpecifiedByXPath::offsetGet (   $offset)

Definition at line 101 of file grima-xmlbag.php.

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

101  {
102  $nodeList = $this->query( $offset );
103  if( $nodeList->length === 1 )
104  return $nodeList->item(0);
105  }

◆ offsetSet()

XMLAsArrayOfDOMNodesSpecifiedByXPath::offsetSet (   $offset,
  $value 
)

Definition at line 106 of file grima-xmlbag.php.

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

106  {
107  $nodeList = $this->query( $offset );
108  if( $nodeList->length === 1 ) {
109  $node = $nodeList->item(0);
110  if($node->parentNode !== NULL) {
111  $node->parentNode->replaceChild( $value, $node );
112  }
113  } elseif( $nodeList->length === 0 ) {
114  $nodeList->context_node->appendChild( $value );
115  }
116  }

◆ offsetUnset()

XMLAsArrayOfDOMNodesSpecifiedByXPath::offsetUnset (   $offset)

Definition at line 117 of file grima-xmlbag.php.

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

117  {
118  $nodeList = $this->query( $offset );
119  if( $nodeList->length === 1 ) {
120  $node = $nodeList->item(0);
121  if($node->parentNode !== NULL) {
122  $node->parentNode->removeChild( $node );
123  }
124  }
125  }

The documentation for this class was generated from the following file: