Skip to content

Commit

Permalink
Merge pull request #14 from bmckay959/v1
Browse files Browse the repository at this point in the history
getAttributes and getContent documentation
  • Loading branch information
Sammyjo20 authored Nov 6, 2023
2 parents 5bb7c87 + fec0e8e commit db57f4d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ $reader->element('food.0')->sole(); // Element::class
// Use XPath to query the XML

$reader->xpathValue('//food[@bestSeller="true"]/name')->get(); // ['Belgian Waffles', 'Berry-Berry Belgian Waffles']

// Use getAttributes() to get the attributes on the elements
$reader->element('food.0')->sole()->getAttributes(); // ['soldOut' => false, 'bestSeller' => true]

// Use getContent() to get the contents of the elements
$reader->element('food.0')->sole()->getContent(); // ['name' => 'Belgian Waffles', 'price' => '$5.95', ...]
```

## Writing XML
Expand Down

0 comments on commit db57f4d

Please sign in to comment.