0
我正在构建一个修改android XML(布局)文件的eclipse插件。我在内部使用dom解析器来生成输出XML。然而,XML格式是混乱的。Eclipse插件开发AndroidXmlFormatter
我想使用android xml格式化机制。我试过了 -
//xmlFile is a IFile
IDocumentProvider provider = new TextFileDocumentProvider(); provider.connect(xmlFile);
IDocument document = provider.getDocument(xmlFile);
xmlFile.setContents(inputStream, IFile.ENCODING_UTF_8, new NullProgressMonitor());
AndroidXmlFormatter a=new AndroidXmlFormatter();
IFormattingContext context=new FormattingContext();
context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.TRUE);
a.format(document, context);
但是,文档没有格式化。 :( 可能是什么问题?有没有替代品我的问题?