"Closing tag matches nothing" with </param>

I have a PHP file used to generate an Ajax response with the following XML:

<root>
<param name="js_onload">A200</param>
</root>

PhpStorm highlights the closing </param> as "Closing tag matches nothing".  Does anyone know why it does this even though there is a <param> tag?

4 comments
Comment actions Permalink

Hi there,

Please check the file type.

<root>
<param name="js_onload">A200</param>
</root>


If I place such code into XML file, everything is fine.
screen03.png

But if I place it in HTML file, I see the same message:
screen01.png
screen02.png

What is .php file (from PhpStorm point of view)? -- HTML file with inclusion of PHP (between <?php and ?> tags).

0
Comment actions Permalink

That explains it.  The file has a php extension and I was looking through the Settings (Inspections, Intentions, and Language Injection) to try and understand why this was happening.  In my example the XML is static, however in the real page some of the XML data is generated using server-side code.

Is there anyway I can let PhpStorm know that a file with PHP extension is really XML and not HTML?

0
Comment actions Permalink

Try this:

  1. Settings | Template Data Languages
  2. Find your file
  3. Assign "XML" to it in the right column


This should treat it as XML (with possible PHP inside) instead of default HTML.

0
Comment actions Permalink

Fantastic!  That is exactly what I needed.  I set the template data language for that directory to be XML. Thank you, Andriy!

0

Please sign in to leave a comment.