HTML File Inspection says: "Valid XML document must have a root tag"

In PHPStorm I get the error inspection message: Valid XML document must have a root tag when I code a div inside another div. The code would be fine with me, but inspection warns me. How can I get phpstorm to accept the code as correct? Or is it realy a correct warning? The code is the following:

<!DOCTYPE html>
<html xmlns="" lang="de"
<meta charset="utf-8">
<title>Template: test</title>

<f:layout name="Default"/>

<f:section name="Content">
<div class="test1">
<div class="test2">


Comment actions Permalink

Just tried the aforementioned code on my PhpStorm installation and got no warning like this during the inspection.

Would it be possible to share a screenshot with inspection warning?

Comment actions Permalink

Yes, this is possible:

Comment actions Permalink

Based on screenshot (the error place and light green background) .. you may have some custom Language Injection rule that might be triggering this.

Please show your "Settings/Preferences | Editor | Language Injections..." -- maybe you accidentally have created some rule...

Comment actions Permalink

Cool! That solved the problem. After disabling all and enabling by try and error I identified this on as the problem:

Left it turned off and everything is fine.

Is this one that I created by mistake or is it a system default injection that got messed up?

Comment actions Permalink

Check the "Scope" column. If it's "IDE" or "Project" -- it's user created (unlikely to be provided by a plugin).

Considering that the div tag used -- it has to be created by the user (there is no reason at all to have such rule by default).

Comment actions Permalink

Yes Scope is IDE!

I removed the rule.

Thank you very much!!!


Please sign in to leave a comment.