Generate XML File - Code Format

Hi there,

i´m building XML Files via Generator and i haven´t found a way to indent Code yet. Is there a way to make this:

<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" id="tkkbHibernateBeanProxy">
<property name="beanNames">
<list>
<value>testService</value>
<value>serviceXYZ</value>
<value>autoService</value>
</list>
</property>
</bean>
prettyPrint();

looks like this:

<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" id="tkkbHibernateBeanProxy">
  <property name="beanNames">
    <list>
      <value>testService</value>
      <value>serviceXYZ</value>
      <value>autoService</value>
    </list>
  </property>
</bean>
prettyPrint();

Regards,
Simon
3 comments
Hello, Simon.

which language do You use to create a file template?
If you are using gtext language there are some abilities to add an indent directly. But IMHO gtext isn't handy enough for XML text.
In the thread http://forum.jetbrains.com/thread/Meta-Programming-System-435 there was discussed, that it's nice to use jetbrains.mps.xml language, but it does not have the rootable concept for the abstract xml file, just for xml schema. There is an j.m.xmlInternal language that has such concept and produces text without any indents. In the discussion I mentioned above was said, that using *Internal languages isn't good.
Also I've found j.m.xml.deprecated language. It has rootable concept for XML document and it produces text with indents. Quite good, but "deprecated" confuses me a bit=) It's my choice now...

BR, Alexey
0
Hi Alexey,

thanks for the fast reply. Sorry that I haven´t mentioned it. I´m using jetbrains.mps.xml.

Maybe I´ll give j.m.xml.deprecated a chance and see how it works out for me.
0
But the question is still opened: why does the language j.m.xml lack the rootable element for an abstract XML document? Does anybody know the answer?

Thanks,
Alexey
0

Please sign in to leave a comment.