Author Topic: How does SE determine the document type for XML files?  (Read 420 times)

rjpontefract

  • Senior Community Member
  • Posts: 250
  • Hero Points: 10
How does SE determine the document type for XML files?
« on: September 14, 2023, 05:32:52 AM »
I have several files with an extension of .XML that, when loaded into SE, cause the document mode to be set to ANT and not XML. 
How do I stop SE from doing this as they aren't ANT build files.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: How does SE determine the document type for XML files?
« Reply #1 on: September 14, 2023, 11:25:08 AM »
There is some code that looks at the beginning of the file and tries to decide if it's Ant or not.  You can disable that by going to the SlickEdit command line, and setting a variable to turn it off: set-var def-antmake-identify 0

It looks like it's looking for a certain structure of project node to decide whether it's an ant file.  Are the files it's mis-identifying for you something with a public DTD?  I'd like to see if it was something we could rule out.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6797
  • Hero Points: 525
Re: How does SE determine the document type for XML files?
« Reply #2 on: September 14, 2023, 04:42:36 PM »
Please post a small sample file which reproduces this problem.

rjpontefract

  • Senior Community Member
  • Posts: 250
  • Hero Points: 10
Re: How does SE determine the document type for XML files?
« Reply #3 on: September 14, 2023, 07:34:00 PM »
Thanks for the replies. 

If I use set-var-def-antmake-identify 0, is that remembered across restarts of SE?

Here's a small example that is identified as an ant file.  Is it the top level <project> tag that is being used to identify the file?

Code: [Select]
<!DOCTYPE ProjectAttributes SYSTEM "XML/platforms.dtd">
<project>

  <projectattributes name="TestAttributes">
  </projectattributes>

</project>

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: How does SE determine the document type for XML files?
« Reply #4 on: September 14, 2023, 07:51:08 PM »
Yes, that gets saved with your configuration, so you should only need to do it once.

I'll take a look at improving that detection later this afternoon.  The top level project tag is one of the things the detection code is looking at.  For this specific case, I think we should rule out Ant just because of the supplied DOCTYPE.