XML file wrong interpreted

I am generating an sitemapindex XML file via PHP. Now I am getting errors that tags in it are no HTML tags. Surely as it isn't an HTML file.

I'm getting errors like:

  • Element sitemapindex must be declared
  • Unknown html tag sitemap

How do I define what filetype the file becomes?

0

Hi there,

Please provide example (or better screenshots) that would illustrate your issue.

But speaking in general: if you are talking about opening the actual final file (e.g. named sitemap.xml) then the file extension tells IDE how to treat it. If PhpStorm for some reason treats .xml file as .html ... then you must have changed the IDE config for that. In such case: "Settings/Preferences | Editor | File Types" -- locate the file type and check filename patterns there.

0

I have the same issue with `sitemapindex` tag in js file

0

@melbon

What language IDE is treated that bit? Is it HTML or XML? What menu do you see when you hit Alt+Enter (or via light bulb icon) while having caret there? What is the context (code before that)?

For HTML it is expected that IDE will complain on unknown <sitemapindex> HTML tag...

0

I use WebStorm 2020.3.1 Build #WS-203.6682.155, built on December 28, 2020. And as I mentioned before I use it as template literal in JS/TS file.

0

I'm not a JavaScript/TypeScript person so do not know much about such code .. but for me it sounds like it's some JSX / React and IDE tries to find a component that is responsible for the sitemapindex tag.

In PHP context it seems to work just fine here in my test project:

If you can share the actual file code that I can open and play around (simplified fragment, just enough to show the issue -- check it in a brand new empty project), maybe I will find something.

Other than that: I suggest posting this as a new thread in WebStorm forum (as it's about JavaScript/TypeScript): https://intellij-support.jetbrains.com/hc/en-us/community/topics/200367229-WebStorm

0

请先登录再写评论。