Home Forums Programming XML Generating schema and population from XML RE: Generating schema and population from XML

  • Both requests are possible to some degree. The best tool to do so might be more of a factor of how repeatable you intend the process to be. As in - if the structure is going to be fairly consistent and the discovery of the structure is to be done once for many subsequent XML files then I would tend to pursue one path; if on the other hand the XML files are like thte wild west and sturcture changes each and every single time, you're talking a different solution.

    In general your best bet would be to get the XML schema (i.e. the definition of the structures being sent in the XML) from the person sending you the XML files. A good schema can tell you a lot about the content you're getting, and would help with not "guessing" wrong about what the structure SHOULD be. There are also a lot of XML tools that can reverse-engineer a database schema to accomodate the incoming XML content, which would at least give you a reasonable DB structure to start from and adjust as needed. You can then use XSLT tools to transform and extract that content into the DB structure.

    Assuming the process were repeatable, I would actually perform your first task manually (i.e. create the strcuture, then adjust as needed to fit the data, but also to shape the DB to include only what I need and to follow good SQL standards), then create the XSLT transformation process after step 1 is complete to my satisfaction.

    If the files are not consistent and I have to automate everything end to end and still somehow guess what it is I want and throw out the rest, then the process gets to be a lot trickier. I've been asked for a few of those "superman" processes before, and most of them tend to fail dramatically because of the lack of structure.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?