Buenas,
Tengo un xml que tengo que importar cada x tiempo a una bd sqlserver. Estaba pensando en importar usando un Mapping Schemas, pero me gustaría que la hacer la importación la categoría y subcategoría fuesen a tablas aparte. Se puede hacer? Como se haría? Es mejor hacerlo de otro modo?
Contenido del archivo a importar:
<ROWSET>
<ROW num="1">
<COD>CQPAN086</COD>
<REFPROV>120301-001</REFPROV>
<DESCRIP>CABLE DE ALIMENTACION SCHUCKO PC</DESCRIP>
<CATEGORIA>Cable</CATEGORIA>
<SUBCATEGORIA>Cable de Alimentación</SUBCATEGORIA>
</ROW>
</ROWSET>
Schema actual:
<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >
<ElementType name="num" dt:type="int" />
<ElementType name="COD" dt:type="int" />
<ElementType name="REFPROV" dt:type="string" />
<ElementType name="DESCRIP" dt:type="string" />
<ElementType name="CATEGORIA" dt:type="string" />
<ElementType name="SUBCATEGORIA" dt:type="string" />
<ElementType name="ROOT" sql:is-constant="1">
<element type="ROW" />
</ElementType>
<ElementType name="ROW" sql:relation="TB_PRODUCTOS">
<element type="num" sql:field="num" />
<element type="COD" sql:field="COD" />
<element type="REFPROV" sql:field="REFPROV" />
<element type="CATEGORIA" sql:field="CATEGORIA" />
<element type="SUBCATEGORIA" sql:field="SUBCATEGORIA" />
</ElementType>
</Schema>
Este Schema me importa la categoría y la subcategoría como un string en la tabla productos, pero a mi me gustaría que se importase a tabla categoría y subcategoría y en la tabla productos se añadiese la referencia. Se puede hacer? Tener en cuenta que el xml de datos no lo puedo cambiar por que la fuente es externa.
Gracias