View Single Post
  #1 (permalink)  
Old March 28th, 2012, 10:53 AM
jonnyuk3 jonnyuk3 is offline
Registered User
Points: 24, Level: 1
Points: 24, Level: 1 Points: 24, Level: 1 Points: 24, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Posts: 6
Thanks: 3
Thanked 0 Times in 0 Posts
Thumbs up Combine multiple xml files to create one xml file

Hi all,

I currently have 3 xml files and would like to transform these into one xml file if that is at all possible.

first xml file
HTML Code:
<?xml version="1.0"?>
<Company xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Products>
    <Product>
      <Id>5024</Id>
      <Sku>S2</Sku>
      <Barcode />
      <Name>S2</Name>
      <Description />
      <Status>0</Status>
      <SalePrice>0</SalePrice>
      <QtyInStock>0</QtyInStock>
      <Attributes>
        <Attribute>
          <Name>Current Stock</Name>
          <Value>&lt;NONE&gt;</Value>
        </Attribute>
        <Attribute>
          <Name>Amber Stock</Name>
          <Value>&lt;NONE&gt;</Value>
        </Attribute>
        <Attribute>
          <Name>Warehouse Name</Name>
          <Value>&lt;NONE&gt;</Value>
        </Attribute>
      </Attributes>
    </Product>
  </Products>
</Company>
second xml file
HTML Code:
<?xml version="1.0"?>
<Company xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Products />
  <Styles />
  <Inventories>
    <Inventory>
      <Id xsi:nil="true" />
      <Sku>S2</Sku>
      <Barcode />
      <Locations>
        <Location>
          <Name>01. General W/H</Name>
          <QtyInStock>0</QtyInStock>
          <QtyOnOrder>0</QtyOnOrder>
          <QtyAllocated>0</QtyAllocated>
          <AllowSalesTrading>true</AllowSalesTrading>
        </Location>
      </Locations>
    </Inventory>
  </Inventories>
</Company>
third xml file
HTML Code:
<?xml version="1.0" standalone="yes"?>
<Root>
  <ProductGroup>
    <ID>5024</ID>
    <Sku>S2</Sku>
    <ProductGroupID>4605</ProductGroupID>
    <ProductGroupCode>NONS</ProductGroupCode>
    <Description>Non Stock Item</Description>
  </ProductGroup>
</Root>
and finally, what i would like
HTML Code:
<?xml version="1.0"?>
<Company xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Products>
    <Product>
      <Id>5024</Id>
      <Sku>S2</Sku>
      <Barcode />
      <Name>S2</Name>
      <Description />
      <Status>0</Status>
      <SalePrice>0</SalePrice>
      <QtyInStock>0</QtyInStock>
      <Attributes>
        <Attribute>
          <Name>Current Stock</Name>
          <Value>&lt;NONE&gt;</Value>
        </Attribute>
        <Attribute>
          <Name>Amber Stock</Name>
          <Value>&lt;NONE&gt;</Value>
        </Attribute>
        <Attribute>
          <Name>Warehouse Name</Name>
          <Value>&lt;NONE&gt;</Value>
        </Attribute>
      </Attributes>
      <Locations>
        <Location>
          <Name>01. General W/H</Name>
          <QtyInStock>0</QtyInStock>
          <QtyOnOrder>0</QtyOnOrder>
          <QtyAllocated>0</QtyAllocated>
          <AllowSalesTrading>true</AllowSalesTrading>
        </Location>
      </Locations>
      <ProductGroup>
          <ProductGroupCode>NONS</ProductGroupCode>
          <Description>Non Stock Item</Description>
      </ProductGroup>
    </Product>
  </Products>
</Company>
How would I go about doing this, i've looked around on the internet for some solutions but i'm still stuck!!

Any help would be much appreciated.

Thanks,

jonnyuk3