Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

XML Simplified Expand / Collapse
Author
Message
Posted Friday, May 20, 2005 12:47 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, May 8, 2013 7:23 AM
Points: 199, Visits: 136
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/rVasant/xmlsimplified.asp
Post #184264
Posted Monday, May 23, 2005 5:58 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, November 21, 2008 7:51 AM
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.
Post #184459
Posted Monday, May 23, 2005 8:03 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, August 3, 2007 2:55 AM
Points: 928, 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!
Post #184502
Posted Monday, May 23, 2005 10:01 AM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, October 13, 2014 11:15 AM
Points: 51, Visits: 94

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.




Post #184542
Posted Monday, May 23, 2005 4:41 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, August 18, 2005 4:21 PM
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>

Post #184673
Posted Monday, May 23, 2005 4:54 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, August 18, 2005 4:21 PM
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.

Post #184674
Posted Monday, May 23, 2005 10:59 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, May 8, 2013 7:23 AM
Points: 199, Visits: 136

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.

Post #184702
Posted Tuesday, May 24, 2005 2:33 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, August 3, 2007 2:55 AM
Points: 928, 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!
Post #184742
Posted Tuesday, May 24, 2005 4:28 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, May 8, 2013 7:23 AM
Points: 199, Visits: 136

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>

Post #184766
Posted Tuesday, May 24, 2005 6:29 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 27, 2010 6:02 AM
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

Post #184791
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse