1

For example i have a folder which contain multiple xml files with the same data structure. And i want to combine them in one xml file with the following way:

Xml 1:

<root>
  <child>
    <child1 state="1">
    <Name>name1</Name>
    <Count>1</Count>
    <Title>title1</Title>
    </child1>
  </child>
</root>

Xml2:

<root>
  <child>
    <child1 state="2">
    <Name>name2</Name>
    <Count>2</Count>
    <Title>title2</Title>
    </child1>
  </child>
</root>

Expected result:

<root>
  <child>
    <child1 state="1">
    <Name>name1</Name>
    <Count>1</Count>
    <Title>title1</Title>
    </child1>
    <child1 state="2">
    <Name>name2</Name>
    <Count>2</Count>
    <Title>title2</Title>
    </child1>
  </child>
</root>

I want to use Python. I read this Merge multiple XML files from command line, but it gives not exectly what i want:(

Can anyone help me to solve this?

Community
  • 1
  • 1
fedya.ua
  • 69
  • 1
  • 6
  • not exactly. code from article above extends xml near root tag and i need to add to already existing tag new tag like in expected result. Also it would be great to pass as arg folder path in which can be located multiple xml files. – fedya.ua Apr 04 '13 at 21:02

0 Answers0