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="http://www.w3.org/1999/xhtml" lang="de"
xmlns:f="https://xsd.helhum.io/ns/typo3/cms-fluid/master/ViewHelpers"
data-namespace-typo3-fluid="true">
<head>
<meta charset="utf-8">
<title>Template: test</title>
</head>
<body>


<f:layout name="Default"/>

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

</div>
</div>
</f:section>

</body>
</html>
6 comments

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?

0

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...

1

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?

0

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).

1

Yes Scope is IDE!

I removed the rule.

Thank you very much!!!

0

Please sign in to leave a comment.