E
E
e1s2015-06-19 15:49:09
Programming
e1s, 2015-06-19 15:49:09

Is it possible to write a generic parser for xsd/xml files?

Is it possible to create a program that creates a database based on xsd / xml file, for example in ms sql and writes information from xml there? Those. We do not know in advance what will be at the entrance. Or is this task a utopia? If so, please describe the main points and limitations that make it impossible to create such a program.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oxoron, 2015-06-19
@Oxoron

How do you plan to take information about types? Limits on the length of strings, for example. Nullable fields, default values?
If the xml contains such information in a separate block (let's call it "header"), everything is relatively simple. We parse the header, form a request for the presence of a database / table, if not, we create it, if there is, we compare the structures. Then we parse the records, constructing a banal Insert. You can take into account the presence of files with such keys, then we construct the if exists then insert else update construct.
Perhaps something like EF's CodeFirst will do. At the very least, there must be a perverted way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question