Not sure if this is the right venue to be asking this but here goes.
A little background.
I'm trying to build an ecommerce app that would allow sellers from other venues--like, amazon and newegg--to import their products using their export/import files.
An example would be a user having an XML feed that looks somewhat like this:
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>
<sku>12345</sku>
<name>Dell Computer</name>
<description>This is a very nice Dell computer. Much quality. Very speed. Great wow.</description>
</product>
<product>
<sku>123456</sku>
<name>Dell Laptop</name>
<description>This is a Dell laptop. Much quality as well.</description>
</product>
</products>
I'd like to be able to map the headers to columns in my database.
ie. sku -> product_sku
, name -> product_name
, description -> description
.
What I'm doing right now is since not all feeds have the same structure, I developed a "mapping tool" that basically just parses the file, takes the headers and shows it in a UI that allows the user to "map" these to the list of my database columns.
The problem I'm encountering now is that since the feeds are not the same, I have a hard time getting that list of headers.
My question is what's a good way to approach this problem? Maybe I'm doing this all wrong.
I'm doing this in nodejs/javascript if that's at all relevant.