C
Charles Wel
Hello All,
I have an XML file containing this
<properties>
<property key="ABC">
<value xml:lang="de">Description de</value>
<value xml:lang="en">Description en</value>
</property>
<property key="XYZ">
<value xml:lang="de">Description de</value>
<value xml:lang="en">Description en</value>
</property>
</properties>
I made a code to add a new <value> tag to each <property>.
The part of code is:
require "rexml/document"
include REXML
...
...
pval = Element.new("value")
pval.add_attribute("xml:lang","fr")
pval.add_text("Description fr")
fproperty.elements << pval
fproperty is the node object
My final XML file looks like this:
<properties>
<property key="ABC">
<value xml:lang="de">Description de</value>
<value xml:lang="en">Description en</value>
<value xml:lang="fr">Description fr</value></property>
<property key="XYZ">
<value xml:lang="de">Description de</value>
<value xml:lang="en">Description en</value>
<value xml:lang="fr">Description fr</value></property>
</properties>
One "TAB" is inserted for each 4 spaces which were in the original file.
How to avoid this?
And how to add a CR to the new element?
Thanks for your help, I'm a very newby
I have an XML file containing this
<properties>
<property key="ABC">
<value xml:lang="de">Description de</value>
<value xml:lang="en">Description en</value>
</property>
<property key="XYZ">
<value xml:lang="de">Description de</value>
<value xml:lang="en">Description en</value>
</property>
</properties>
I made a code to add a new <value> tag to each <property>.
The part of code is:
require "rexml/document"
include REXML
...
...
pval = Element.new("value")
pval.add_attribute("xml:lang","fr")
pval.add_text("Description fr")
fproperty.elements << pval
fproperty is the node object
My final XML file looks like this:
<properties>
<property key="ABC">
<value xml:lang="de">Description de</value>
<value xml:lang="en">Description en</value>
<value xml:lang="fr">Description fr</value></property>
<property key="XYZ">
<value xml:lang="de">Description de</value>
<value xml:lang="en">Description en</value>
<value xml:lang="fr">Description fr</value></property>
</properties>
One "TAB" is inserted for each 4 spaces which were in the original file.
How to avoid this?
And how to add a CR to the new element?
Thanks for your help, I'm a very newby