Grima 2018-08
Whispering into Alma's ear
Public Member Functions | List of all members
XMLAsArrayOfDOMNodeListsSpecifiedByXPath Class Reference
Inheritance diagram for XMLAsArrayOfDOMNodeListsSpecifiedByXPath:
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 127 of file grima-xmlbag.php.

Member Function Documentation

◆ offsetExists()

XMLAsArrayOfDOMNodeListsSpecifiedByXPath::offsetExists (   $offset )

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

128 {
129 return $this->query($offset)->length > 0; // technically it always exists, but...
130 }

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetGet()

XMLAsArrayOfDOMNodeListsSpecifiedByXPath::offsetGet (   $offset )

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

131 {
132 return $this->query($offset);
133 }

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetSet()

XMLAsArrayOfDOMNodeListsSpecifiedByXPath::offsetSet (   $offset,
  $value 
)

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

134 {
135 $nodeList = $this->query($offset);
136 $cur_length = $nodeList->length;
137 $new_length = $value->length;
138 for( $i = 0 ; $i < min($cur_length, $new_length); $i++ ) {
139 $cur_node = $nodeList->item($i);
140 $new_node = $value->item($i);
141 $cur_node->parentNode->replaceChild($new_node, $cur_node);
142 }
143 for( $i = min($cur_length, $new_length); $i < $cur_length ; $i++ ) {
144 $cur_node = $nodeList->item($i);
145 $cur_node->parentNode->removeChild($cur_node);
146 }
147 for( $i = min($cur_length, $new_length); $i < $new_length ; $i++ ) {
148 $new_node = $value->item($i);
149 $this->context_node->appendChild($new_node);
150 }
151 }

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetUnset()

XMLAsArrayOfDOMNodeListsSpecifiedByXPath::offsetUnset (   $offset )

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

152 {
153 $nodeList = $this->query($offset);
154 $cur_length = $nodeList->length;
155 for( $i = 0 ; $i < $cur_length ; $i++ ) {
156 $cur_node = $nodeList->item($i);
157 $cur_node->parentNode->removeChild($cur_node);
158 }
159 }

References XMLAsArrayOfWhateversSpecifiedByXPath\query().


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