File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Newbie question : What is xml schema ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Newbie question : What is xml schema ?" Watch "Newbie question : What is xml schema ?" New topic
Author

Newbie question : What is xml schema ?

Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

I read that "An XML Schema describes the structure of an XML document".
What does this mean ?

"Basic XML: they identify the schema against which the XML will be validated"
Where is that "thing" against which xml is validated ? (This question came when i was making a jsp)




SCJP 6. Learning more now.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10290
    
168

In simple terms, XML schema defines the structure of a XML document. Here's a bit more detailed version

[My Blog] [JavaRanch Journal]
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
.... "An XML Schema describes the structure of an XML document".


This is not a concise statement and is missing a critical concept. An instance of an XML Schema defines the structure (and other characteristics) of a XML markup language. And XML-based documents (instances) conform to the structure which is defined in the language.

There are hundreds, maybe thousands of XML-based languages. Each one has a unique structure and vocabulary. SOAP is a markup language. HTML is a markup language. WSDL is a markup language. FpML is a markup language. XML is NOT a markup language. XML is a language for "creating" XML-based markup languages. XML is a simplified form of SGML.

An XML-based document is "validated" against the markup language rules which are defined in either an XML Schema instance or a specific XML Document Type Definition (DTD).

Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

Jimmy Clark wrote:
.... "An XML Schema describes the structure of an XML document".

XML is NOT a markup language. XML is a language for "creating" XML-based markup languages.



Thanks ! that makes things easier. So which are the popular "versions" of xml language ?
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
There are only two versions of XML.


and


The name eXtensible Markup Language (XML) is a bit misleading. It inherited this from it's parent -Standard Generalized Markup Language (ISO 8879:1986 SGML). Neither SGML or XML are markup languages themselves. They are tools for "creating" markup languages.
david fields
Greenhorn

Joined: Jun 06, 2011
Posts: 6
Rahul Sudip Bose wrote:I read that "An XML Schema describes the structure of an XML document".
What does this mean ?

"Basic XML: they identify the schema against which the XML will be validated"
Where is that "thing" against which xml is validated ? (This question came when i was making a jsp)





an xml schema will specify the structure and content of an xml file, you can find out more in the wiki here; http://en.wikipedia.org/wiki/XML_schema or here ; http://www.liquid-technologies.com/xml-schema-editor.aspx
Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 217

Hi Jimmy,
Jimmy Clark wrote:
.... "An XML Schema describes the structure of an XML document".

An instance of an XML Schema defines the structure (and other characteristics) of a XML markup language. And XML-based documents (instances) conform to the structure which is defined in the language.


It was a nice explaination.
But I want to ask that what about the XML Documents created directly by the text editor.What about their markup markup language given they do not have even a schema to define a markup language?
This question has been confusing me since quite a time,and I found this similar post of yours,so decided to ask you directly.

Any guidance would really help me.

Thanks....
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
There are two type of XML documents. Those defined by an "explicit" language which is specified in an XML Document Type Definition (DTD) or an XML Schema. These documents must also conform to the rules of an XML document which are specified in the XML specification. There are also documents that simply conform to the rules of an XML document which are specified in the XML specification.

If you create a valid XML document in a text editor there will still be a root element and other elements an attributes. The organization of these elements and attritubues and the names of the elements and attributes is what makes up the markup language, which conforms to the rules of an XML document which are specified in the XML specification.

You should study the XML specification to develop an understanding of these concepts. Below is an example of a TEST markup language for the purpose of describing test results.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18993
    
    8

On the other hand, you shouldn't get too tied up by high-level terminology.

For example, consider XSLT. Any programmer who looks at it will tell you that it's a language. But it isn't described by a DTD or a schema, so is it a "markup language"?

Or consider an XML document which contains one week's payroll transactions for a company. Any programmer who looks at that will tell you that it's data and not a program written in a language. But suppose it's described by a schema. Does that make it a "markup language"? A lot of people would hesitate to call a description of data a "language". However there are those who would accept the term "language" to include something which can describe a set of data as well as something which can describe executable code.

So if you were looking for a precise definition, there isn't one. And you don't need a precise definition to be able to work with XML. So my suggestion would be to leave this point alone for now and to move on.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Markup languages and programming languages are not the same. These are two different types of "languages" and have different definitions. Aside, XSL stands for eXtensible Stylesheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations and it does not stand for a markup language (there shouldn't be an XML DTD or XML Schema for XSLT).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newbie question : What is xml schema ?