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

Member Function Documentation

◆ offsetExists()

XMLAsArrayOfDOMNodesSpecifiedByXPath::offsetExists (   $offset )

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

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

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetGet()

XMLAsArrayOfDOMNodesSpecifiedByXPath::offsetGet (   $offset )

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

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

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetSet()

XMLAsArrayOfDOMNodesSpecifiedByXPath::offsetSet (   $offset,
  $value 
)

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

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

References XMLAsArrayOfWhateversSpecifiedByXPath\query().

◆ offsetUnset()

XMLAsArrayOfDOMNodesSpecifiedByXPath::offsetUnset (   $offset )

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

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

References XMLAsArrayOfWhateversSpecifiedByXPath\query().


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