This short article will take a look at a few of the more complex approaches to dealing with schema design, thus this post is only suitable for people that have a good understanding of xml and xml schema. If you are a newcomer to xml you need to first acquaint yourself with the fundamentals of xml schema, the w3c school site is a superb place to begin in that respect.
For all those who've been developing for years, you could remember that historically when you wanted to verify your xml data, you had to employ a technique also known as Document Type Definition (DTD).
Practically everyone loathed working with DTD’s because they were so difficult to work with and even more tough to figure out with their alien like syntax and symbols. It’s not really unpredictable that so many folks gave up on using DTD’s to validate xml seeing that it took so much time and was so difficult that many were unable to write correct DTDs.
Thankfully, the W3C realised that DTD was not supporting the cause of xml, as they were very eager for xml to develop into the standard for markup, in particular with regards to digital and the internet.
The W3C solution was to come up with a brand-new way to validate xml, named Xml Schema. It was a much less difficult option for validating your xml and also gave developers the exact same capabilities as DTD but enhanced it substantially making it far more maintainable and extensible.
The schema serves as a blueprint for your xml file, laying down what can and also can't be included in your xml document, for instance what elements and attributes are permitted within your xml document, the values involved with those elements, the order and occurrence and so on. Which means that it’s relatively a lot like a DTD but unlike a DTD, with a schema you can in addition handle data typing, inheritance, database linkage and grouping.
The W3C Working Group at the same time introduced the notion of “document instances” that permits you to connect specific xml documents to a schema and validate your xml document against the rules in the schema.
The specs put forth by the W3C Working Group, most importantly creates a differentiation between “simple” and “complex” elements. This has fundamental considerations for programmers, simple elements can not have other elements or attributes, whereas complex elements can. Complex elements might also function as containers for other elements, that could be either simple or complex elements.
In making your xml schema, a simple type element is expressed by the <xsd:simpleType> and a complex type element is expressed by the <xsd:complexType> statement.
To be able to present simple elements in your schema, the correct way might be to use the <xsd:element> statement.
Regarding complex types, we have an additional step further than declaring the complex type, you ought to declare the type through the element, give it a name and then use this new type in the same <xsd:element> statement as per a simple element.
I really hope this article has given you some insight into xml and xml schemas, you can find out more information at w3c or w3c schools, both of which are excellent resources for grasping xml and comprehending the standard.
Wednesday, 23 May 2012
Sunday, 22 April 2012
Why Should You Utilize XML?
Document creators and editors seem to be driven to work with XML simply because it offers a methods for describing documents, separate from of platform or software program dependancies and / or restrictions.
XML documents are able to be used for print, the world wide web or some other document method. This kind of flexibility supports information system designers to employ XML, as they are able adopt one set of specifications, tools and methods for handling documents, no matter their different syndication targets.
Online and offline print writers work with XML given that it can describe extremely structured organizations of data, as well as produce to paper as well as publish to the Web, without sacrificing document construction.
Companies that take up XML as their main document format, as opposed to an HTML or even a word processor type system, will unquestionably realize a substantial decrease in their document processing fees as well as receive improved control over the generation, sending as well as overall look of their documents. Additionally they receive a massive set of tools that provides document management and processing support which aren't available for HTML or word processor formats.
XML documents can be altered to match the needs of end users. It is extremely easy to use a couple of different style sheets to an XML document to output to several types or to manipulate information many different groups.
To illustrate, a writer will want to offer only the workouts found in a document or possibly only the theoretical components. Providing a document is adequately described, the writer can produce any view of document content that they wish.
This particular element allows for numerous procedures to generate significantly different views of the same content for other uses. When possible, content re-use saves a companies funds and also would make authors more cost-effective. XML supports and also encourages these types of processes by being variable and also modular.
XML doesn't have a set number of tags or elements, as HTML does, yet it is extensible, enabling the document developer to define purposeful tags. By utilizing XML, coders can develop a markup language that is definitely designed for their purpose. XML permits developers to create their own individual set of tags that will clearly match their demands.
Therefore while a great many folks don't need tags that support mathematical equations (MathML), setting up software programs on the internet (OSD), additionally, the swapping of financial data (OFX), mathematicians, software developers and finance companies might need such special tags.
XML lets you distinguish content from format. The layout of the XML document is actually inside a standalone style sheet. This splitting up enables you to quickly sustain and update formatting as demands change.
To illustrate the positive aspects of breaking up structure from display, we can look at a commonplace predicament which can easily happen in large and small offices on a typical basis. A document is crafted that will be wanted in several output formats, web browser, PDF and user guides.
Making use of old fashioned strategies, a different document would most likely need to be developed for each document type. By isolating structure from format, no more than one source document is necessary.
This is the actual effect of structured documents. Practicing to detache structure from format is essential to crafting superior implementation of the power of XML.
XML documents are able to be used for print, the world wide web or some other document method. This kind of flexibility supports information system designers to employ XML, as they are able adopt one set of specifications, tools and methods for handling documents, no matter their different syndication targets.
Online and offline print writers work with XML given that it can describe extremely structured organizations of data, as well as produce to paper as well as publish to the Web, without sacrificing document construction.
Companies that take up XML as their main document format, as opposed to an HTML or even a word processor type system, will unquestionably realize a substantial decrease in their document processing fees as well as receive improved control over the generation, sending as well as overall look of their documents. Additionally they receive a massive set of tools that provides document management and processing support which aren't available for HTML or word processor formats.
XML documents can be altered to match the needs of end users. It is extremely easy to use a couple of different style sheets to an XML document to output to several types or to manipulate information many different groups.
To illustrate, a writer will want to offer only the workouts found in a document or possibly only the theoretical components. Providing a document is adequately described, the writer can produce any view of document content that they wish.
This particular element allows for numerous procedures to generate significantly different views of the same content for other uses. When possible, content re-use saves a companies funds and also would make authors more cost-effective. XML supports and also encourages these types of processes by being variable and also modular.
XML doesn't have a set number of tags or elements, as HTML does, yet it is extensible, enabling the document developer to define purposeful tags. By utilizing XML, coders can develop a markup language that is definitely designed for their purpose. XML permits developers to create their own individual set of tags that will clearly match their demands.
Therefore while a great many folks don't need tags that support mathematical equations (MathML), setting up software programs on the internet (OSD), additionally, the swapping of financial data (OFX), mathematicians, software developers and finance companies might need such special tags.
XML lets you distinguish content from format. The layout of the XML document is actually inside a standalone style sheet. This splitting up enables you to quickly sustain and update formatting as demands change.
To illustrate the positive aspects of breaking up structure from display, we can look at a commonplace predicament which can easily happen in large and small offices on a typical basis. A document is crafted that will be wanted in several output formats, web browser, PDF and user guides.
Making use of old fashioned strategies, a different document would most likely need to be developed for each document type. By isolating structure from format, no more than one source document is necessary.
This is the actual effect of structured documents. Practicing to detache structure from format is essential to crafting superior implementation of the power of XML.
Friday, 13 April 2012
A Overview Of XML DOM As Well As Its Uses
In this article I'll try and demonstrate the nature not to mention basis for XML DOM. I shall accomplish this by breaking up XML DOM into two parts, XML and DOM. I will then wrap up by addressing the significance of xml as well as providing a bit of context into its worth.
XML stands for Extensible Markup language and as the name implies, XML can be described as markup language, it lets you split data from the format or structure(design) of a document.
In summary it's a means of moving huge files gathered from one system to another one within a standardised way which allows the collecting system to have the ability to read and comprehend the data as well as present it as it had been supposed to be presented.
In brief, XML gives a vastly adopted standard way of representing text and data inside a format which can be processed with little human or machine intelligence. Data prepared in XML could be exchanged across platforms, languages, and applications, that can be employed with a wide range of computer programming resources and utilities.
Okay, having discussed XML, lets plunge right into DOM. DOM is an acronym and stands for Document Object Model. Similar to XML, DOM is actually independent and certainly not tied to any platform or language, DOM gives a means of accessing and altering XML documents in addition to setting some document objects for XML.
A great way to think about XML DOM is to think about a tree with branches, consider the numerous elements and tags as the branches and also child elements or tags( and their joining attributes) as the twigs. XML DOM helps you view your xml document graphically, as a tree and adjust your elements, and attributes through this DOM tree.
If you wish to change the tree, say by adding or getting rid of some of the branches or twigs, something which is in fact fairly common for web programmers, that can be done possibly by yourself, or you may work with an xml editor which has an xm parser, to accomplish it for you.
Many good xml editors ought to be appropriate for the majority of the more popular languages, such as Asp, Javascript, Visual Basic, among others. Some of the better xml editors can also be used to check the syntax of the XML as needed, referred to as xml validation in most xml editors, so do check that your chosen xml editor has an xml validation function.
Loading your XML document straight into your XML DOM so that you may make your tree is also very painless. To be able to load an entire XML file utilize the load( ) method, to load a text string work with the loadXML( ) method.
Now that we have talked about both XML and DOM, I would like to conclude by exploring just why it is significant and why software engineers might want to employ it.
Throughout the early days of the internet, online browsers and sites had been really easy, using bare html, standardisation was not a obstacle and so websites could be viewable in very much the same way regardless of the browser being utilized.
On the other hand with the beginning of the wireless internet as well as the ensuing explosion in wireless / portable systems from laptops, smartphones, tablets and other such products, the need to make sure compatibility between diverse browsers and devices grew to be increasingly important.
The answer came with the creation of new languages and specs such as XHTML, XSL and XML, the latter becoming the most vital and beneficial advancement of them all.
XML made it possible for web designers to clearly define data without the need of instructing the web browser just how to show the data, contrary to HTML, which both defines the data and also informs the browser the correct way to present it.
XML data can certainly be viewed on just about any platform or browser due to the fact it is a uncomplicated text file with absolutely no predefined tags, letting the coder to delineate data any number of ways.
XML stands for Extensible Markup language and as the name implies, XML can be described as markup language, it lets you split data from the format or structure(design) of a document.
In summary it's a means of moving huge files gathered from one system to another one within a standardised way which allows the collecting system to have the ability to read and comprehend the data as well as present it as it had been supposed to be presented.
In brief, XML gives a vastly adopted standard way of representing text and data inside a format which can be processed with little human or machine intelligence. Data prepared in XML could be exchanged across platforms, languages, and applications, that can be employed with a wide range of computer programming resources and utilities.
Okay, having discussed XML, lets plunge right into DOM. DOM is an acronym and stands for Document Object Model. Similar to XML, DOM is actually independent and certainly not tied to any platform or language, DOM gives a means of accessing and altering XML documents in addition to setting some document objects for XML.
A great way to think about XML DOM is to think about a tree with branches, consider the numerous elements and tags as the branches and also child elements or tags( and their joining attributes) as the twigs. XML DOM helps you view your xml document graphically, as a tree and adjust your elements, and attributes through this DOM tree.
If you wish to change the tree, say by adding or getting rid of some of the branches or twigs, something which is in fact fairly common for web programmers, that can be done possibly by yourself, or you may work with an xml editor which has an xm parser, to accomplish it for you.
Many good xml editors ought to be appropriate for the majority of the more popular languages, such as Asp, Javascript, Visual Basic, among others. Some of the better xml editors can also be used to check the syntax of the XML as needed, referred to as xml validation in most xml editors, so do check that your chosen xml editor has an xml validation function.
Loading your XML document straight into your XML DOM so that you may make your tree is also very painless. To be able to load an entire XML file utilize the load( ) method, to load a text string work with the loadXML( ) method.
Now that we have talked about both XML and DOM, I would like to conclude by exploring just why it is significant and why software engineers might want to employ it.
Throughout the early days of the internet, online browsers and sites had been really easy, using bare html, standardisation was not a obstacle and so websites could be viewable in very much the same way regardless of the browser being utilized.
On the other hand with the beginning of the wireless internet as well as the ensuing explosion in wireless / portable systems from laptops, smartphones, tablets and other such products, the need to make sure compatibility between diverse browsers and devices grew to be increasingly important.
The answer came with the creation of new languages and specs such as XHTML, XSL and XML, the latter becoming the most vital and beneficial advancement of them all.
XML made it possible for web designers to clearly define data without the need of instructing the web browser just how to show the data, contrary to HTML, which both defines the data and also informs the browser the correct way to present it.
XML data can certainly be viewed on just about any platform or browser due to the fact it is a uncomplicated text file with absolutely no predefined tags, letting the coder to delineate data any number of ways.
Wednesday, 21 March 2012
XSLT And Its Uses
In this article I am going to get started with explaining xslt, before talking about a number of the more prevalent uses and also applications for xslt. XSLT symbolizes Extensible Style sheet Language Transformations, XSL is basically a style sheet language for the purpose of xml documents.
So for what reason would you employ XSLT? The basic response is in order to enter xml and to have the ability to output as any format you like, html, pdf or just about any output to meet your requirements.
Normally xslt is commonly employed to style website pages also to stipulate the style and appearance of webpages through altering xml perfectly into a structure which could be translated and after that viewable by an internet browser.
And so just how would xml achieve this?, actually xml in itself is purely plain text, which on its own, is actually certainly not much use, consider xml as the suitcases which carries the data, its advantage is consequently that xml is a carrier of the data and also that it is standard to the extent that it can do the job by using any system or application, it is actually not system dependant.
This wasn’t an over night progression but much more a sluggish development of which started with the creation of xml (a very simple markup language with no semantic demands), coupled with the advent of xsl (a stylesheet created in xml, created to define tags as well as apply styling to websites) which finally lead to the use of xslt as way of making use of xml to direct web browsers on the best way to translate, style and display websites.
Paradoxically it had been the flexibilities of xml that was initially its Achilles heel, because the xml tags could easily represent just about anything you required, there were zero limitations, eg you could have a tag called, <house> or <dog>, it was difficult for your web browser to comprehend the precise intention or even meaning.
Nevertheless, by way of the use of xsl, it had become possible to define the tags exactly so that the internet browser comprehended and was able to implement the appropriate styles.
This worked up to a point, as the web browser industry widened with the entry of Firefox , Apple and others, and xml files started to be more complex and larger sized, troubles of interoperability eventually surfaced, for example it was typical for web pages to be shown differently based on your browser.
The solution arrived in the shape of Xpath, a query language which made it possible for builders to query their xml documents and select nodes from any xml document, this allowed web browsers to make use of syntax queries to discover and interpret particular components or tags in the xml code.
Having said that, in spite of having xsl definitions and xpath navigation abilities, difficulties persisted in the area of translating xml data into a uniform web page irrespective of the browser employed.
The answer? Well the solution was xslt ofcourse, xslt will allow you to transform xml into a processing format, this function was boosted and led to the introduction of xhtml, an augmentation on plain html.
This is actually completed as xslt looks at each component part of xml and commences its transformation to xhtml, xslt breaks down the code, translates and after that rewrites it so that all browsers can easily interpret the results.
So for what reason would you employ XSLT? The basic response is in order to enter xml and to have the ability to output as any format you like, html, pdf or just about any output to meet your requirements.
Normally xslt is commonly employed to style website pages also to stipulate the style and appearance of webpages through altering xml perfectly into a structure which could be translated and after that viewable by an internet browser.
And so just how would xml achieve this?, actually xml in itself is purely plain text, which on its own, is actually certainly not much use, consider xml as the suitcases which carries the data, its advantage is consequently that xml is a carrier of the data and also that it is standard to the extent that it can do the job by using any system or application, it is actually not system dependant.
This wasn’t an over night progression but much more a sluggish development of which started with the creation of xml (a very simple markup language with no semantic demands), coupled with the advent of xsl (a stylesheet created in xml, created to define tags as well as apply styling to websites) which finally lead to the use of xslt as way of making use of xml to direct web browsers on the best way to translate, style and display websites.
Paradoxically it had been the flexibilities of xml that was initially its Achilles heel, because the xml tags could easily represent just about anything you required, there were zero limitations, eg you could have a tag called, <house> or <dog>, it was difficult for your web browser to comprehend the precise intention or even meaning.
Nevertheless, by way of the use of xsl, it had become possible to define the tags exactly so that the internet browser comprehended and was able to implement the appropriate styles.
This worked up to a point, as the web browser industry widened with the entry of Firefox , Apple and others, and xml files started to be more complex and larger sized, troubles of interoperability eventually surfaced, for example it was typical for web pages to be shown differently based on your browser.
The solution arrived in the shape of Xpath, a query language which made it possible for builders to query their xml documents and select nodes from any xml document, this allowed web browsers to make use of syntax queries to discover and interpret particular components or tags in the xml code.
Having said that, in spite of having xsl definitions and xpath navigation abilities, difficulties persisted in the area of translating xml data into a uniform web page irrespective of the browser employed.
The answer? Well the solution was xslt ofcourse, xslt will allow you to transform xml into a processing format, this function was boosted and led to the introduction of xhtml, an augmentation on plain html.
This is actually completed as xslt looks at each component part of xml and commences its transformation to xhtml, xslt breaks down the code, translates and after that rewrites it so that all browsers can easily interpret the results.
Thursday, 8 March 2012
The Industry Benefits To Changing Your Data Into XML Format
XML is an abbreviation and it is short for extensible markup language, which means it's not necessarily in itself a programming language for instance java, php etc. It is really an open standard that allows you to express your markup elements, this really pretty much different to HTML which includes predefined elements eg, a body tag, a h1 and the like. With xml you could explain the tags yourself, there is no semantics involved.
This kind of format is made to carry information in a recognized not to mention definite manner, making it easier to function around platforms and software types. It is actually extremely useful to share out organized data over the World Wide Web.
XML will be helpful in sharing important information as a result of internet to several different types of computer systems, numerous programs, many companies, businesses or organization without passing through any conversion or transcription process. It is additionally employed for encoding documents and serializing your data.
Considering xml documents undoubtedly are a internationally recognized standard format, lots of corporations have transformed their biggest business info into xml. Some organizations have learned to look at this service as an significant piece in online business while others have still to catch on.
Keeping the strength of essential small business information is incredibly important, changing your data into xml are sure to have the following rewards;
Transforming data to xml is surely an extremely less expensive answer for posting your data files onto the net.
It lets your enterprise to establish a set standard for your information, this can eventually, allow your corporation processes to become more cost-efficient.
Crucial computer data can be sent to internet browsers or perhaps business applications .
Organisations are utilising this cross-platform format for world-wide-web publishing.
The course of action of interchanging of internet data might be substantially made easy, which might also help reduce the hard drive requirement making programs and data retrieval speedier plus more useful.
The xml format is rather accommodating as well as customisable, which makes it very helpful for businesses to store and share important information.
It is possible to simplify the complex data structure via this format.
Modest editing is possible just by non-technical persons due to the fact xml conversion is schema driven and there is no programming or development expertise needed.
It's fine to use a number of media such as images, videos.
Business documents often include non printable characters. XML can handle such characters and large flat files by way of a conversion process.
You can even acquire output in web, print or publishing systems.
Firms can simply archive not to mention retrieve the xml documents.
In actual fact, there are various advantages, capabilities provided by xml format. So establishments are thinking about the xml conversion as most prolific task. To boost document management and efficiency, convert your PDF, Word, Text, Excel, HTML, SGML along with other enterprise data format into XML.
It will help to increase up business work-flows as well as maximize productiveness through xml conversion.
To conclude, changing your large amount of critical business information into xml data can certainly significantly enhance your core business operations and also make it easier for you to retrieve and share information internally and externally without the need of platform or software dependant constraints.
This kind of format is made to carry information in a recognized not to mention definite manner, making it easier to function around platforms and software types. It is actually extremely useful to share out organized data over the World Wide Web.
XML will be helpful in sharing important information as a result of internet to several different types of computer systems, numerous programs, many companies, businesses or organization without passing through any conversion or transcription process. It is additionally employed for encoding documents and serializing your data.
Considering xml documents undoubtedly are a internationally recognized standard format, lots of corporations have transformed their biggest business info into xml. Some organizations have learned to look at this service as an significant piece in online business while others have still to catch on.
Keeping the strength of essential small business information is incredibly important, changing your data into xml are sure to have the following rewards;
Transforming data to xml is surely an extremely less expensive answer for posting your data files onto the net.
It lets your enterprise to establish a set standard for your information, this can eventually, allow your corporation processes to become more cost-efficient.
Crucial computer data can be sent to internet browsers or perhaps business applications .
Organisations are utilising this cross-platform format for world-wide-web publishing.
The course of action of interchanging of internet data might be substantially made easy, which might also help reduce the hard drive requirement making programs and data retrieval speedier plus more useful.
The xml format is rather accommodating as well as customisable, which makes it very helpful for businesses to store and share important information.
It is possible to simplify the complex data structure via this format.
Modest editing is possible just by non-technical persons due to the fact xml conversion is schema driven and there is no programming or development expertise needed.
It's fine to use a number of media such as images, videos.
Business documents often include non printable characters. XML can handle such characters and large flat files by way of a conversion process.
You can even acquire output in web, print or publishing systems.
Firms can simply archive not to mention retrieve the xml documents.
In actual fact, there are various advantages, capabilities provided by xml format. So establishments are thinking about the xml conversion as most prolific task. To boost document management and efficiency, convert your PDF, Word, Text, Excel, HTML, SGML along with other enterprise data format into XML.
It will help to increase up business work-flows as well as maximize productiveness through xml conversion.
To conclude, changing your large amount of critical business information into xml data can certainly significantly enhance your core business operations and also make it easier for you to retrieve and share information internally and externally without the need of platform or software dependant constraints.
Friday, 17 February 2012
A Simple XML Structure Explained
The accompanying example exhibits an uncomplicated well fashioned XML file. It could be entered by using a basic text editor and also one of the XML editors that you can buy. Whenever composing the document away, the file-name should certainly end with .xml. For example: “human.xml” or “yourFileName.xml”.
[human]
[gender]
male
[/gender]
[born]
18 July 1990
[/born]
[hairColour]
Blonde
[/hairColour]
[/human]
Inside illustration previously mentioned, the [human] ... [/human] element includes three other elements and each of these consist of textual content. Because the three elements happen to be between your opening and closing human element tags it means that they will be 'child elements' of human.
These child elements give to us particular information on the parent element. In this situation this lets us know that the human is "male", was born "18 July 1990" and has "Blonde" hair. XML permits us to structure our data collections in a very logical, hierarchy that makes sense.
The very content provided by the child elements inside the above illustration can probably be generated available using attributes. I will be talking about these in my next tutorial.
Loads of info is available on XML for those who would want to know more. For the definitive guide, visit www.W3.org.
[human]
[gender]
male
[/gender]
[born]
18 July 1990
[/born]
[hairColour]
Blonde
[/hairColour]
[/human]
Inside illustration previously mentioned, the [human] ... [/human] element includes three other elements and each of these consist of textual content. Because the three elements happen to be between your opening and closing human element tags it means that they will be 'child elements' of human.
These child elements give to us particular information on the parent element. In this situation this lets us know that the human is "male", was born "18 July 1990" and has "Blonde" hair. XML permits us to structure our data collections in a very logical, hierarchy that makes sense.
The very content provided by the child elements inside the above illustration can probably be generated available using attributes. I will be talking about these in my next tutorial.
Loads of info is available on XML for those who would want to know more. For the definitive guide, visit www.W3.org.
Thursday, 9 February 2012
The Way To Map An XML Database Through An XML Schema
Designers commonly come across the necessity to modify the manner in which they work with their databases, it's usually the situation when say, being a programmer you could be creating a web app or possibly a software project and you find you need to alter your data mid flow, as an example, changing from xml data to a relational database. I have often worked on projects when the aims have changed and in some cases, new technologies have been announced which has required the need for some other data methodology.
Having successfully operated such change in large projects, the procedure itself is in no way a horrible one; the chief challenge is in mapping the data layout involving the sender and the destination data.
A sensible way to achieve this is to try using an xml schema (xsd for short), basically an xml schema is a approach to describe the structure and content of an xml data source. The schema sets out the foundations of an xml file, a lot like a DTD. Therefore the schema will set out to define the elements, attributes, child elements, order and quantity of child elements etc that can appear in the xml data source.
To be able to map your xml database, you can employ the following techniques, at the present time there isn't any one desired system or indeed procedure to follow, the below solutions can be viewed as a series of valid steps. I'd also add that the method you take will probably be manipulated through your own particular circumstances, like the nature and kind of data you wish to map.
Element To Table Mapping
Transforming xml elements into relational database tables can be the most rational route to take, however it's not absolutely the best, its suitability will probably be determined by your data. For instance, mapping an element right into a database table will certainly convert the columns to element attributes or the element content into children and so on.
To map a target element to a relational database table, simply just setup the mapping node to get the pertinent rows from your database, then fill the target elements with values out of your database.
Element To Column Mapping
Mapping elements to columns in your relational database is recommended in case you have very simple elements containing only text string, if your elements is made up of further elements or attributes, your mapping is unlikely to be a success. By default, an element or even attribute of uncomplicated type, maps to the column with the exact same name in the table.
In the illustration below, the <Person.Person> element is of complex type and, subsequently, maps by default to the Person.Person table in the selected database. 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.
<xsd:schema xmlns:xsd=".org/2001/XMLSchema"
xmlns:sql="urn:schemas-mysite-com:mapping-schema">
<xsd:element name="Person.Person" >
<xsd:complexType>
<xsd:attribute name="BusinessEntityID" type="xsd:string" />
<xsd:attribute name="FirstName" type="xsd:string" />
<xsd:attribute name="LastName" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:schema>
Attribute To Column Mapping
Attribute to column mapping is more efficient if you would want to map the attributes into columns inside your relational database tables, matching them to their given elements. The exemption is where you have only a given number of possible attribute values, on this case it may be far better to have different tables for the elements needing each attribute type.
Let’s say you've got an element designated “brick”, which has an attribute designated “colour”, plus the attributes can only be “red” or “grey”, you might manage this step by setting two tables, one for red bricks and the other for grey bricks.
Having successfully operated such change in large projects, the procedure itself is in no way a horrible one; the chief challenge is in mapping the data layout involving the sender and the destination data.
A sensible way to achieve this is to try using an xml schema (xsd for short), basically an xml schema is a approach to describe the structure and content of an xml data source. The schema sets out the foundations of an xml file, a lot like a DTD. Therefore the schema will set out to define the elements, attributes, child elements, order and quantity of child elements etc that can appear in the xml data source.
To be able to map your xml database, you can employ the following techniques, at the present time there isn't any one desired system or indeed procedure to follow, the below solutions can be viewed as a series of valid steps. I'd also add that the method you take will probably be manipulated through your own particular circumstances, like the nature and kind of data you wish to map.
Element To Table Mapping
Transforming xml elements into relational database tables can be the most rational route to take, however it's not absolutely the best, its suitability will probably be determined by your data. For instance, mapping an element right into a database table will certainly convert the columns to element attributes or the element content into children and so on.
To map a target element to a relational database table, simply just setup the mapping node to get the pertinent rows from your database, then fill the target elements with values out of your database.
Element To Column Mapping
Mapping elements to columns in your relational database is recommended in case you have very simple elements containing only text string, if your elements is made up of further elements or attributes, your mapping is unlikely to be a success. By default, an element or even attribute of uncomplicated type, maps to the column with the exact same name in the table.
In the illustration below, the <Person.Person> element is of complex type and, subsequently, maps by default to the Person.Person table in the selected database. 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.
<xsd:schema xmlns:xsd=".org/2001/XMLSchema"
xmlns:sql="urn:schemas-mysite-com:mapping-schema">
<xsd:element name="Person.Person" >
<xsd:complexType>
<xsd:attribute name="BusinessEntityID" type="xsd:string" />
<xsd:attribute name="FirstName" type="xsd:string" />
<xsd:attribute name="LastName" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:schema>
Attribute To Column Mapping
Attribute to column mapping is more efficient if you would want to map the attributes into columns inside your relational database tables, matching them to their given elements. The exemption is where you have only a given number of possible attribute values, on this case it may be far better to have different tables for the elements needing each attribute type.
Let’s say you've got an element designated “brick”, which has an attribute designated “colour”, plus the attributes can only be “red” or “grey”, you might manage this step by setting two tables, one for red bricks and the other for grey bricks.
Subscribe to:
Posts (Atom)