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

Member Function Documentation

◆ offsetExists()

XMLAsArrayOfStringsSpecifiedByXPath::offsetExists (   $offset )

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

163 {
164 return $this->query($offset)->length === 1;
165 }

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetGet()

XMLAsArrayOfStringsSpecifiedByXPath::offsetGet (   $offset )

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

166 {
167 $nodeList = $this->query($offset);
168 if( $nodeList->length === 1 ) {
169 return $nodeList->item(0)->nodeValue;
170 }
171 }

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetSet()

XMLAsArrayOfStringsSpecifiedByXPath::offsetSet (   $offset,
  $value 
)

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

172 {
173 $nodeList = $this->query($offset);
174 if( $nodeList->length === 1 ) {
175 print "Setting!\n";
176 $nodeList->item(0)->nodeValue = $value;
177 } else if( $nodeList->length === 0 ) {
178 $node = $this->xml->createElement(basename($offset));
179 $node->nodeValue = $value;
180 $this->contextNode->appendChild($node);
181 }
182 }

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetUnset()

XMLAsArrayOfStringsSpecifiedByXPath::offsetUnset (   $offset )

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

183 {
184 if( $nodeList->length === 1 ) {
185 $node = $nodeList->item(0);
186 $node->parentNode->removeChild($node);
187 }
188 }

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