<p>You need to be in the correct namespace try</p>

<pre><code>$reader = new \XMLReader();
</code></pre>

<p>Like <a href="https://craftcms.stackexchange.com/questions/5311/class-craft-stdclass-not-found">here</a> </p>

CC BY-SA 3.0
2018-02-20T19:42:29.833Z
2018-02-20T19:42:29.833Z
Robin Schambach
<p>In my project, I have a reference to XMLReader in a plugin; however, I get this error message:</p>

<pre><code>Class 'Craft\XMLReader' not found
</code></pre>

<p>Here is the code which calls it:</p>

<pre><code>$reader = new XMLReader();
</code></pre>

<p>Can XMLReader be used within Craft, or can there be a customization which would allow it?  Thanks</p>

<plugin-development><php><xml><classes>
Using XMLReader With Plugin
# Using XMLReader With Plugin

(Asked by: username_0 on 2018-02-20)

In my project, I have a reference to XMLReader in a plugin; however, I get this error message:
Class 'Craft\XMLReader' not found

Here is the code which calls it:
$reader = new XMLReader();

Can XMLReader be used within Craft, or can there be a customization which would allow it?  Thanks

**Tags:** plugin-development, php, xml, classes


---

## 1 answers

### Answer by username_1 on 2018-02-20. Score: 1

You need to be in the correct namespace try
$reader = new \XMLReader();

Like here


---

