Custom XML FileType?

I want to make a FileType of my own for a custom XML language, but I want
XmlLanguage to do the heavy work. I tried creating LanguageFileType and passing
the XmlLanguage instance that the XmlFileType uses, but I get this exception
when opening files of my file type. I hope someone can tell me how to do this.
Thanks

java.lang.ClassCastException: com.intellij.psi.impl.source.tree.Factory$1
at com.intellij.psi.impl.source.PsiFileImpl.createFileElement(PsiFileImpl.java:65)
at com.intellij.psi.impl.source.PsiFileImpl.loadTreeElement(PsiFileImpl.java:109)
at
com.intellij.psi.impl.RepositoryElementsManager.getOrFindTreeElement(RepositoryElementsManager.java:72)
at
com.intellij.psi.impl.source.SrcRepositoryPsiElement.calcTreeElement(SrcRepositoryPsiElement.java:55)
at
com.intellij.psi.impl.source.TreeWrapperPsiElement.getNode(TreeWrapperPsiElement.java:55)
at com.intellij.psi.util.PsiUtil.getRootIndex(PsiUtil.java:780)
at
com.intellij.codeInsight.daemon.impl.analysis.HighlightingSettingsPerFile.getHighlightingSettingForRoot(HighlightingSettingsPerFile.java:88)
at
com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil.isRootHighlighted(HighlightUtil.java:1009)
at
com.intellij.codeInsight.daemon.impl.RefreshStatusRenderer.getDaemonCodeAnalyzerStatus(RefreshStatusRenderer.java:67)
at
com.intellij.codeInsight.daemon.impl.RefreshStatusRenderer.paint(RefreshStatusRenderer.java:91)
at
com.intellij.openapi.editor.impl.EditorMarkupModelImpl$MyErrorPanel.paintComponent(EditorMarkupModelImpl.java:31)
at javax.swing.JComponent.paint(JComponent.java:1003)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at
com.intellij.openapi.fileEditor.impl.EditorTabbedContainer$MyTabbedPane.paint(EditorTabbedContainer.java:78)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at javax.swing.JComponent._paintImmediately(JComponent.java:4848)
at javax.swing.JComponent.paintImmediately(JComponent.java:4634)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:477)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:138)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:17)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:38)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:267)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:196)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:186)
at java.awt.Dialog$1.run(Dialog.java:515)
at java.awt.Dialog.show(Dialog.java:536)
at
com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:40)
at
com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:97)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:722)
at com.intellij.diagnostic.IdeMessagePanel$3.run(IdeMessagePanel.java:1)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:138)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:17)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:38)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:267)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:182)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Please sign in to leave a comment.