Hello Everyone,
Here is my problem. I have an XML file that has the following structure (it looks a bit long, but bear with me, please):
The result file should look like this:
The trick is to match the manufacturer IDs to the relevant products, based on the product ID. One product can have more than one manufacturer, so I have to read each manufacturer entry and check if the product ID matches with that of the product entry, repeating the entry as much as necessary for each manufacturer that delivers the product. The question is, how?
I appreciate sample code snippets if you can provide me with some.
Thanks in advance.
Cheers
Memo
Here is my problem. I have an XML file that has the following structure (it looks a bit long, but bear with me, please):
Code:
<Root>
<Manufacturer>
<Results>
<Row>
<ProductId>1</ProductId>
<ManufacturerID>ManID1</ManufacturerID>
</Row>
<Row>
<ProductId>2</ProductId>
<ManufacturerID>ManID1</ManufacturerID>
</Row>
<Row>
<ProductId>3</ProductId>
<ManufacturerID>ManID2</ManufacturerID>
</Row>
<Row>
<ProductId>3</ProductId>
<ManufacturerID>ManID3</ManufacturerID>
</Row>
<Row>
<ProductId>4</ProductId>
<ManufacturerID/>
</Row>
</Results>
</Manufacturer>
<Material>
<Results>
<Row>
<ProductId>1</ProductId>
<Attribute1>adf1</Attribute1>
<Attribute2>adf2</Attribute2>
<Attribute3>adf3</Attribute3>
</Row>
<Row>
<ProductId>2</ProductId>
<Attribute1>adf4</Attribute1>
<Attribute2>adf5</Attribute2>
<Attribute3>adf6</Attribute3>
</Row>
<Row>
<ProductId>3</ProductId>
<Attribute1>adf7</Attribute1>
<Attribute2>adf8</Attribute2>
<Attribute3>adf9</Attribute3>
</Row>
<Row>
<ProductId>4</ProductId>
<Attribute1>qwe1</Attribute1>
<Attribute2>qwe2</Attribute2>
<Attribute3>qwe3</Attribute3>
</Row>
</Results>
</Material>
</Root>
Code:
<Root>
<MaterialwithManID>
<Results>
<Row>
<ProductId>1</ProductId>
<Attribute1>adf1</Attribute1>
<Attribute2>adf2</Attribute2>
<Attribute3>adf3</Attribute3>
<ManufacturerID>ManID1</ManufacturerID>
</Row>
<Row>
<ProductId>2</ProductId>
<Attribute1>adf4</Attribute1>
<Attribute2>adf5</Attribute2>
<Attribute3>adf6</Attribute3>
<ManufacturerID>ManID1</ManufacturerID>
</Row>
<Row>
<ProductId>3</ProductId>
<Attribute1>adf7</Attribute1>
<Attribute2>adf8</Attribute2>
<Attribute3>adf9</Attribute3>
<ManufacturerID>ManID2</ManufacturerID>
</Row>
<Row>
<ProductId>3</ProductId>
<Attribute1>qwe1</Attribute1>
<Attribute2>qwe2</Attribute2>
<Attribute3>qwe3</Attribute3>
<ManufacturerID>ManID3</ManufacturerID>
</Row>
<Row>
<ProductId>4</ProductId>
<Attribute1>qwe4</Attribute1>
<Attribute2>qwe5</Attribute2>
<Attribute3>qwe6</Attribute3>
<ManufacturerID/>
</Row>
</Results>
</MaterialwithManID>
</Root>
I appreciate sample code snippets if you can provide me with some.
Thanks in advance.
Cheers
Memo