Forum Moderators: open
<Category ParentID="0">
<Name>RC Flight Sims</Name>
<ID>52</ID>
<Category ParentID="52">
<Name>Subcat1</Name>
<ID>53</ID>
<Category ParentID="53">
<Name>category3</Name>
<ID>54</ID>
<Product ParentID="54">
<Name>Widget 1</Name>
<pID>1234</pID>
</Product>
</Category>
</Category>
<Product ParentID="52">
<Name>red widget</Name>
<pID>246</pID>
</Product>
</Category>
<root>
<categories>
<Category ParentID="0">
<Name>RC Flight Sims</Name>
<ID>52</ID>
</Category>
<Category ParentID="52">
<Name>Subcat1</Name>
<ID>53</ID>
</Category>
<Category ParentID="53">
<Name>category3</Name>
<ID>54</ID>
</Category>
</categories>
<products>
<Product catID="54">
<Name>Widget 1</Name>
<pID>1234</pID>
</Product>
<Product catID="52">
<Name>red widget</Name>
<pID>246</pID>
</Product>
</products>
</root>
Your schema should then be simplified too ....
Your category tree is then related through the ID/parentID element/attribute relationship.
Your product/category relationship is via the pID/catID relationship.
HTH