Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


XML Simplified


XML Simplified

Author
Message
Vasant Raj
Vasant Raj
SSC Veteran
SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)

Group: General Forum Members
Points: 201 Visits: 137
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/rVasant/xmlsimplified.asp
Kathy Collins
Kathy Collins
Valued Member
Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)

Group: General Forum Members
Points: 73 Visits: 6
Aha!  I always wondered but have been so entrenched in "business as usual" that I just didn't take the time.  All the other articles I tried to read while taking a relax break made assumptions that I already knew something about XML.  Thank you for this simple explanation.
Jonathan Stokes
Jonathan Stokes
SSC Eights!
SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)

Group: General Forum Members
Points: 927 Visits: 1

I thought your article was simplified and made easy reading. Hiowever, you did miss out on some of the limitations of xml.

The main limitation being that xml cannot handle relational data or multiple children.

You cannot stored relational data in a xml format. If you want to query acroess a relational set, you need to bring xml into a table or equivalent to be able to do so.

Secondly, and I think more importantly, the issue of multiple children. If you have more than one child, xml will not allow you store it. Take for example a company organisational hierarchy. At the root you would have CEO for instance. Then if you have 5 people underneath, all the same level you get the problem of having to tag them all together. Then you cannot go down any more paths with the 5 people tagged together.

XML can only handle one single record all with single values, in the manner that you gave in your sample. What would happen if you had 2 authors. You would need another line like <FNAME>Surname2</FNAME> and the xml would not parse without errors.

Oh, almost forgot. Cannot use characters likle ampersand in xml document or it will not parse.




------------------------------
The Users are always right - when I'm not wrong!
Parker Smith
Parker Smith
Valued Member
Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)

Group: General Forum Members
Points: 51 Visits: 125

I have a pedantic point - XML is not a language, per se.

It is a standard for specifying how to put data into a text file.

XML is not any kind of a replacement for HTML - it is, instead, a standard that can be used for creating a specification for (for example) a version of HTML (and is currently being used for that very purpose).

HTML code can then be checked against the XML-based specification in an automated manner, without ambiguity.

The confusion comes from XML's unfortunate name (XMS would have made things clearer, I think), and the fact that it operates at a higher level of abstraction than most people typically work at.





Kenneth Lee
Kenneth Lee
SSC Journeyman
SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)

Group: General Forum Members
Points: 75 Visits: 1

This article has a few typos.  It says:
The next line describes the root element of the document (like it was saying: "this document is a article") i.e., “ARTICLE”.
The next lines describe the child elements of the root (TITLE, DATE, AUTHOR, SUMMARY, and CONTENT).
Each element can also have child’s i.e. AUTHOR has FNAME and LNAME.

But the example XML file has a root of “ARTICLES”.  There is one child “ARTICLE” in the root and then the next lines decribe child elements of the “ARTICLE” element.

In the XPATH example it says:
ARTICLE[DATE = "05/16/2005"]     - All <DATE> elements which has at least one <DATE> child-element child with the value "05/16/2005".

Should say ARTICLE[DATE = "05/16/2005"]     - All <ARTICLE> elements...

Since this article is directed towards SQL people, a big point to make is that elements are case sensitive.
<ARTICLE>This is NOT XML and will not be accepted as well formed.</Article>


Kenneth Lee
Kenneth Lee
SSC Journeyman
SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)

Group: General Forum Members
Points: 75 Visits: 1

Jonathan Stokes says you can't have multiple children and XML is not relational.  Both very wrong statements.  You can have only one root element.  So in the example <ARTICLES> is the only element that can't be repeated.  You can have as many <ARTICLE> children inside of the root as you want.  The XPATH statements in the article include examples of relational selections.

Admittedly the DOM model used by Explorer has a relational setup that sucks, but it does have one.  I sure wouldn't use it to relate table structures, but it can be done.  (Whether you get an answer this year is another question.)  There are other DOM models that work quite well at doing relationships.


Vasant Raj
Vasant Raj
SSC Veteran
SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)

Group: General Forum Members
Points: 201 Visits: 137

Sorry about the sturcture of XML. The <ARTICLES> tag allow you to encompass multiple <ARTICLE> tags. That's why it has been added.

Also the mistake in the XPATH would be rectified soon.

Read "Important Instructions" for case-sensitive part.

thnx.


Jonathan Stokes
Jonathan Stokes
SSC Eights!
SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)SSC Eights! (927 reputation)

Group: General Forum Members
Points: 927 Visits: 1

Not wanting to get into an argument here, Kenneth, but I stand by my point and hope to clarify a little more.

If you have multiple authors with a first name and last as in the scenario I would want to structure as follows:

<author>

<firstname>john1</firstname>

<lastname>smith1</lastname>

</author>

<author>

<firstname>john2</firstname>

<lastname>smith2</lastname>

</author>

I attempted to run this using word 2003 xml editor and it would not generate the xml beacuse of duplicate elements. I could do this:

<author>

<firstname>john1,john2</firstname>

<lastname>smith1,smith2</lastname>

</author>

This does not help at all because I need to put a lot of work in to get the data in and back out. To import into a table I need to loop around within the tag, also. I also need to have a definite character seperator at all times.

 




------------------------------
The Users are always right - when I'm not wrong!
Vasant Raj
Vasant Raj
SSC Veteran
SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)

Group: General Forum Members
Points: 201 Visits: 137

You can have multiple authors of a book by using the following structure.

<book>
       <author>
            <firstname>john1</firstname>
            <lastname>smith1</lastname>
       </author>

       <author>
            <firstname>john2</firstname>
            <lastname>smith2</lastname>
       </author>
</book>


Scott D. Smith
Scott D. Smith
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 18

I used to work at Spyglass, where the Mosaic web browser was invented (and ultimately sold to Microsoft). A few points: 1) HTML is, indeed, a specific instance of XML. 2) You CAN have multiple authors for a book just as described. 3) XML is more of a heirarchical database structure because the data is held in files rather than columnar tables and you must "traverse" the files via nodes to access the data, 4) XML can be slurped into a database (SQL Server, for instance) for faster performance. But by itself, XML sitting in files is not a fast way to access and manipulate data.

scott


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search