Computer programmers frequently run into the necessity to change the procedure they work with their databases, normally, this is the case when say, as a engineer you actually are working on a web software package or perhaps software project so you realize you should improve your data mid flow, as an example, shifting from xml data to a relational database.
I have quite often worked on projects in which the desired goals have changed and perhaps, new technologies are already brought in which has necessitated the need for a new data methodology.
Having effectively mastered this type of changeover in large projects, the position itself is in no way a tricky one; the main issue is in mapping the data layout between your sender and the destination data.
A sensible way to achieve this is using an xml schema (xsd for short), essentially an xml schema is a approach to summarize the structure and content of an xml data source. The schema sets out the foundations of an xml file, similar to a DTD. Meaning that the schema will set out to explain the elements, attributes, child elements, order and number of child elements etc that may appear in the xml data source.
So that you can map your xml database, you can utilize the following options, at this moment there is no such thing as a one recommended system or indeed procedure to adhere to, the below solutions can be viewed as several sensible steps. I would also add that the solution you take is going to be influenced by your own particular circumstances, such as the nature and kind of data you intend to map.
Element To Table Mapping
Changing xml elements into relational database tables can be the most plausible path to take, however it's not absolutely the best, its appropriateness will likely be contingent on your data. By way of example, mapping an element right into a database table will certainly transform the columns to element attributes or the element content into children and so forth.
To map a target element to a relational database table, simply setup the mapping node to collect the relevant rows from the database, then populate the target elements with values out of your database.
Element To Column Mapping
Mapping elements to columns in your relational database is recommended when you've got simple elements that have only text string, if your elements consists of further elements or attributes, your mapping is not as likely to achieve success. By default, an element and also attribute of basic type, maps to the column with the same name in the table.
In the example below, the [Person.Person] element is of complex type and, due to this fact, maps by default to the Person.Person table in the selected database. All of the attributes (BusinessEntityID, FirstName, LastName) of the [Person.Person] element are of simple type and map by default to columns with the same names in the Person.Person table.
Attribute to column mapping will work better when you would like to map the attributes into columns inside your relational database tables, complimenting them to their given elements. The exemption is in which you only have a given quantity of possible attribute values, in this scenario it may be preferable to have different tables for the elements needing each attribute type.
Let’s say you've an element called “brick”, containing an attribute called “colour”, and the attributes can only be “red” or “grey”, you could manage this step by setting two tables, one for red bricks and the other for grey bricks.
Author Resource:-
Michael Dupre is truly an veteran expert in XML programming and XML standards and possesses an abundance of working know-how about Data Mapping as well as strongly proposes anyone to Data Mapper.