Parsing an XML file
已回答
Hi,
Please show me how I can read the content of an XML file located in the project's resources folder.
I am just learning to create my first plugin, so whatever details you can provide is much appreciated.
Thanks,
Tuan
请先登录再写评论。
Hi Tuan,
first, you need to locate your file by calling LocalFileSystem.getInstance().findFileByPath().
Then load content like VfsUtil.loadText(VirtualFile).
Hi Dmitry,
Thank you for the suggestion. It works.
I have another problem. The xml file has a tag that has CDATA wrapped content. I would like to removed the "CDATA" part from the actual data. What is best way to do it? Thanks.
You need to obtain PSI for your file, then locate the element you need, then remove it.