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 163 of file grima-xmlbag.php.

Member Function Documentation

◆ offsetExists()

XMLAsArrayOfStringsSpecifiedByXPath::offsetExists (   $offset)

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

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

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

◆ offsetGet()

XMLAsArrayOfStringsSpecifiedByXPath::offsetGet (   $offset)

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

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

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

◆ offsetSet()

XMLAsArrayOfStringsSpecifiedByXPath::offsetSet (   $offset,
  $value 
)

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

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

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

◆ offsetUnset()

XMLAsArrayOfStringsSpecifiedByXPath::offsetUnset (   $offset)

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

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

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