473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Some very basic xml

Hello!

I know this might not be the appropriate forum for xml question.
But xml is so important for .NET I hope my basic question can be answered in
this forum.

I just wonder does every xml document have a XSD schema or XDR schema ?
Is it possible to say that the purpose for schema is to have a definition
for syntax.

Or can anyone else give a basic explanation what schema is used for in .NET.

//Tony
Aug 12 '08 #1
4 1211
On Aug 12, 1:34*pm, "Tony Johansson" <johansson.anders...@telia.com>
wrote:
I just wonder does every xml document have a XSD schema or XDR schema ?
No. Aside from the fact that there are many other ways to define an
XML schema (e.g. old-fashioned DTDs, or RELAX NG), a document can have
no schema at all.
Is it possible to say that the purpose for schema is to have a definition
for syntax.
XML schema does not define the syntax - it defines the structure of
the document, in terms of XML infoset. In case of W3C XML Schema
(XSD), it can also augment the infoset of the document with things
such as types, and default values for missing attributes and elements.
Or can anyone else give a basic explanation what schema is used for in .NET.
On the most basic level, to validate XML input and output against it.
There's also the aforementioned XML infoset augmentation - for
example, if you read an XML document with an associated schema into an
instance of XmlDocument with validation enabled, and the schema
defines some attributes with default values, those attributes will be
present in XmlDocument even if they were absent in the original XML,
and will have the default values as specified. In addition to that,
every element is associated with the corresponding type in the XSD
schema, and that type information can also be queried via .NET XML
APIs, and used as needed (and, of course, xsi:type attribute can be
used to explicitly specify types of elements in source XML).

Aug 12 '08 #2
Hello!

One more question about xml.
I read in a book about basic xml and it says.
"An XML document could be a physical file on your computer or just a string
in memory."

The first part of the above sentence is normal that an xml document is a
physical file on disk.
But what does it mean when it says that it could be just a string in memory
?

//Tony

"Pavel Minaev" <in****@gmail.comskrev i meddelandet
news:db**********************************@2g2000hs n.googlegroups.com...
On Aug 12, 1:34 pm, "Tony Johansson" <johansson.anders...@telia.com>
wrote:
I just wonder does every xml document have a XSD schema or XDR schema ?
No. Aside from the fact that there are many other ways to define an
XML schema (e.g. old-fashioned DTDs, or RELAX NG), a document can have
no schema at all.
Is it possible to say that the purpose for schema is to have a definition
for syntax.
XML schema does not define the syntax - it defines the structure of
the document, in terms of XML infoset. In case of W3C XML Schema
(XSD), it can also augment the infoset of the document with things
such as types, and default values for missing attributes and elements.
Or can anyone else give a basic explanation what schema is used for in
..NET.

On the most basic level, to validate XML input and output against it.
There's also the aforementioned XML infoset augmentation - for
example, if you read an XML document with an associated schema into an
instance of XmlDocument with validation enabled, and the schema
defines some attributes with default values, those attributes will be
present in XmlDocument even if they were absent in the original XML,
and will have the default values as specified. In addition to that,
every element is associated with the corresponding type in the XSD
schema, and that type information can also be queried via .NET XML
APIs, and used as needed (and, of course, xsi:type attribute can be
used to explicitly specify types of elements in source XML).
Aug 12 '08 #3
On Aug 12, 12:21*pm, "Tony Johansson" <johansson.anders...@telia.com>
wrote:
One more question about xml.
I read in a book about basic xml and it says.
"An XML document could be a physical file on your computer or just a string
in memory."

The first part of the above sentence is normal that an xml document is a
physical file on disk.
But what does it mean when it says that it could be just a string in memory
?
It means that:

string xml = "<?xml version='1.0' encoding='UTF-8' ?><root><element
attr='value' /></root>";

is a perfectly valid XML document. It's just data.

Jon
Aug 12 '08 #4

Tony Johansson wrote:
Hello!

One more question about xml.
I read in a book about basic xml and it says.
"An XML document could be a physical file on your computer or just a string
in memory."

The first part of the above sentence is normal that an xml document is a
physical file on disk.
But what does it mean when it says that it could be just a string in memory
To quote the W3C XML spec (http://www.w3.org/TR/xml/#sec-documents):

Definition: A data object is an XML document if it is well-formed,
as defined in this specification.
Definition: A textual object is a well-formed XML document if:

1. Taken as a whole, it matches the production labeled document.
2. It meets all the well-formedness constraints given in this
specification.
3. Each of the parsed entities which is referenced directly or
indirectly within the document is well-formed.

Note that this specifically refers to some abstract "textual objects",
and not files. A "textual object" can be a string in memory, a field
in the database (SQL Server has XML data type for fields, for
example), an output of a program to stdout, an HTTP Web service
responce, etc. So long as it has textual representation which matches
the XML grammar, it is XML.
Aug 12 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: fdsl ysnh | last post by:
--- python-list-request@python.orgдµÀ: > Send Python-list mailing list submissions to > python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, > visit >...
2
by: Steven O. | last post by:
First, this may not be the correct newsgroup. I have some relatively basic questions on SQL. I tried to find a newsgroup that was specifically just about SQL, and was surprised to find that all...
1
by: Steven O. | last post by:
I am basically a hobbyist programmer, at the moment doing a little work experimenting with some AI stuff. I learned C++, and then tried to teach myself MFC using MS Visual C++ 6.0. I swore off of...
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
3
by: Ben | last post by:
Hi There I am doing some unit testing at the moment, and the majority of the leg work involves taking two objects (expected vs actual) and verifying that their properties are equal. The objects...
1
by: marklinehan | last post by:
Hi, my name is Mark Linehan. About 20 years ago or so I started learning how to program on the Commodore 64 computer (anyone remember those?) heheheh. I taught myself basic on this little machine...
21
by: Jim | last post by:
I am trying to write an HTTP/HTTPS proxy server in VB.Net 2005. But, I don't really even know how the internal workings of a proxy should act. Does anyone have anything on the protocols used in...
2
by: windandwaves | last post by:
Hi Folk When learning PHP, the hardest is always learning the basics. Once you understand the concept, you learn a lot quicker. For a friend, I put together some basic, basic examples. One...
2
by: she_prog | last post by:
I have a class derived from UserControl. I need to serialize an object of this class, but only some properties of it, as not all properties are serializable (some of the properties coming from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.