May 20, 2005 at 12:47 pm
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/rVasant/xmlsimplified.asp
May 23, 2005 at 5:58 am
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.
May 23, 2005 at 8:03 am
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.
May 23, 2005 at 10:01 am
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.
May 23, 2005 at 4:41 pm
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>
May 23, 2005 at 4:54 pm
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.
May 23, 2005 at 10:59 pm
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.
May 24, 2005 at 2:33 am
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.
May 24, 2005 at 4:28 am
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>
May 24, 2005 at 6:29 am
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
May 24, 2005 at 7:14 am
I know you can put it into the format as shown, but...
If you use the xml template generator in word 2003 you get real problems. Try out this link:
The main point here is that you need to create an xslt template to map the document to generate xml. Because it sees the tag <author> once only in the xslt template, it will error.
if you put the author tag in twice then it works. The problem is you do not know how many author tags you require.
It adds a little more weight to my argument that xml is not really a conventional standard at all. The applications to retrieve xml have to be written specifically for each template. I thought the idea of a standard was someting like a text file that you can dts in, open in excel etc.
May 23, 2006 at 8:19 am
Thank you for taking the time to help the rest of us.
May 23, 2006 at 1:01 pm
Richard Saul Wurman used to say "Clarify, Don't Simplify". This article proves that point. It is simplified to the point of distortion.
1) XML is nothing in and of itself. It is a metalanguage; i.e., if you want to make a markup language, if you do it this way, then it is XML.
2) Everything depends on your instantiation of XML. In other words, the DTD or Schema that is used is much more critical to the success of your efforts than the various tools mentioned in the article. Designing the DTD/Schema (i.e., the data model) is almost never mentioned, yet that is so much harder to do right than anything else.
3) XML is a lousy data store. It biases towards a hierarchical data structure, which went out of style in the 1980's for a reason. It's incredibly bloated (I remember file sizes 43x the size of the same data stored in a flat file), and the pre-built infrastructure pales in comparison to relational databases.
4) What infrastructure is there is very immature, even after all these years. I was working on the FDA's SPL initiative, which was based on an XML Schema. XML Spy compiled the schema as an XML file, while another tool found errors in the schema as a schema. What good is that?
June 23, 2008 at 7:53 am
Hi ....
In this article you have mentioned how to use CDATA..
I am using while CDATA for inserting ..
could you plese tell how to use CDATA for retrieving
ex:INSERT INTO HELLO VALUES( ' ')
but in the table it is stored as &
how to show to user a &
Thanks
June 23, 2008 at 7:54 am
Hi ....
In this article you have mentioned how to use CDATA..
I am using while CDATA for inserting ..
could you plese tell how to use CDATA for retrieving
ex:INSERT INTO HELLO VALUES( ' ')
but in the table it is stored as &
how to show to user a " &"
Thanks
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply