In the previous section we learnt how to create elements and declare their
content scheme. Let's begin this session with attributes.
Attributes
Attributes are modifiers of elements, which have names and values following
the same rules as Element names. That is, they are 'case-sensitive', must start
with a letter or an underscore character, etc. Elements can have one or more
attributes. An attribute is defined in the start tag with the attribute name
separated from the value by an equals ( = ) sign and the value inside single or
double quotes.
For example, in
main="true">314-666-1897; "number" is the
element name, "main" is the attribute name and "true" is the
value of "main".
Attribute list declarations
Attribute list declarations identify which elements may have attributes,
what attributes they may have, what values the attributes may hold, and what
value is the default. A typical attribute list declaration looks like this:
Language
ID
Title
CDATA
Type ( comedy | tragedy ) 'good' >
As we see in the above example, the element called "movies" has
three attributes:
- Language, which is an ID and is required
- Title, which is a string (character data) and is not required and
- Type, which must be either comedy or tragedy and
defaults to good, if no value is specified.
Each attribute in a declaration has three parts: a name, a type and a default
value. You are free to select any name you wish, subject to some slight
restrictions, but names cannot be repeated on the same element.
That’s about attribute list declarations. Now, let us see the different
types of attributes.
- ID: The value of an ID attribute must be a name. All of the ID values used
in a document must be different. IDs uniquely identify individual elements
in a document. Elements can have only a single ID attribute.
- CDATA: The CDATA attributes are strings and any text form is allowed.
- IDREF: An IDREF attribute's value must be the value of a single ID
attribute on some element in the document. The value of an IDREF attribute
may contain multiple IDREF values separated by white spaces.
- ENTITY: An ENTITY attribute's value must be the name of a single entity.
The value of an "entities" attribute may contain multiple entity
names separated by white space. (We will discuss entities in detail in the
next session)
- NMTOKEN: The name token attributes are a restricted form of string
attribute. In general, an "nmtoken" attribute must consist of a
single word. But it does not have any other constraint like it does have to
match another attribute or declaration. The value of an "nmtokens"
attribute may contain multiple "nmtokens" values separated by
white space.
You can specify that the value of an attribute must be taken from a specific
list of names. The different types in this are:
- #REQUIRED: The attribute must have an explicitly specified value on every
occurrence of the element in the document.
- #IMPLIED: The attribute value is not required, and no default value is
provided. If a value is not specified, the XML processor must proceed
without one.
- #FIXED "value": An attribute declaration may specify that an
attribute has a fixed value. In this case, the attribute is not required,
but if it occurs, it must have the specified value.
Comments:
The XML parser ignores comments. Comments, as usual, are used for remarks by the
author for easy understanding of the code. The start tag for a comment is
. Comments must always be set outside the XML
markup, as the following example shows:
Josh
Speed
Continued...
In the .Net world, what happens to Microsoft’s COM and DCOM initiatives?
Is the distributed computing aspect of .Net en extension to COM? What happens to
those who are using competing distributive computing technologies such as CORBA?
COM/DCOM is the building block. They can be integrated in .Net. COM/DCOM will
not go away. We will continue to work on COM. On the Web server, we will
continue to work with components. DCOM, however, will be replaced with XML/SOAP.
There are still many business applications built around COM. SOAP and XML may
not be a good idea in a closed environment, here COM may be the answer.
Why should other companies accept XML and SOAP as standards?
Today, no two Web servers can communicate. This will become possible with XML
and SOAP. While XML has already been accepted as a standard, once people
understand the advantages of working with SOAP as it is platform independent,
this will also be adopted. It has already been accepted by IBM.
What is the status of Java in the .Net framework? C# looks a lot like
Java, have you incorporated anything from Java?
We have not taken anything from Java. One of the key points of .Net is that it
is language independent. Irrespective of the language you write your code in —
be it C, C#, Java Script, Visual Basic or for that matter even COBOL — you get
a pseudo machine code called intermediate language, which is executed on the
.Net framework. The same code can run on multiple devices–PCs, pocket PCs,
phones etc. There is no (specific) runtime (for the codes). You can also have
multiple executables running on a single process.
C# was created from C++ with some extra features, such as automatic garbage
collection.
When do you think the acceptance of .Net will be complete?
It is an evolution and would not be completed. Some of the .Net framework is
being accepted. It is not before 12-18 months that we will see major adoption of
the framework and products coming up.
From the Microsoft side, you will see Office.Net and the .Net version of
Windows 2000 being released during the end of 2001. Visual Studio is expected in
the second half of 2001. Parallel to this, you will see us supporting several
devices such as smartcards, in the .Net framework.
XML: Comments and declarations
Follow Us
In the previous section we learnt how to create elements and declare their
content scheme. Let's begin this session with attributes.
Attributes
Attributes are modifiers of elements, which have names and values following
the same rules as Element names. That is, they are 'case-sensitive', must start
with a letter or an underscore character, etc. Elements can have one or more
attributes. An attribute is defined in the start tag with the attribute name
separated from the value by an equals ( = ) sign and the value inside single or
double quotes.
For example, in
main="true">314-666-1897; "number" is the
element name, "main" is the attribute name and "true" is the
value of "main".
Attribute list declarations
Attribute list declarations identify which elements may have attributes,
what attributes they may have, what values the attributes may hold, and what
value is the default. A typical attribute list declaration looks like this:
Language
ID
Title
CDATA
Type ( comedy | tragedy ) 'good' >
As we see in the above example, the element called "movies" has
three attributes:
defaults to good, if no value is specified.
Each attribute in a declaration has three parts: a name, a type and a default
value. You are free to select any name you wish, subject to some slight
restrictions, but names cannot be repeated on the same element.
That’s about attribute list declarations. Now, let us see the different
types of attributes.
in a document must be different. IDs uniquely identify individual elements
in a document. Elements can have only a single ID attribute.
attribute on some element in the document. The value of an IDREF attribute
may contain multiple IDREF values separated by white spaces.
The value of an "entities" attribute may contain multiple entity
names separated by white space. (We will discuss entities in detail in the
next session)
attribute. In general, an "nmtoken" attribute must consist of a
single word. But it does not have any other constraint like it does have to
match another attribute or declaration. The value of an "nmtokens"
attribute may contain multiple "nmtokens" values separated by
white space.
You can specify that the value of an attribute must be taken from a specific
list of names. The different types in this are:
occurrence of the element in the document.
provided. If a value is not specified, the XML processor must proceed
without one.
attribute has a fixed value. In this case, the attribute is not required,
but if it occurs, it must have the specified value.
Comments:
The XML parser ignores comments. Comments, as usual, are used for remarks by the
author for easy understanding of the code. The start tag for a comment is
. Comments must always be set outside the XML
markup, as the following example shows:
In the .Net world, what happens to Microsoft’s COM and DCOM initiatives?
Is the distributed computing aspect of .Net en extension to COM? What happens to
those who are using competing distributive computing technologies such as CORBA?
COM/DCOM is the building block. They can be integrated in .Net. COM/DCOM will
not go away. We will continue to work on COM. On the Web server, we will
continue to work with components. DCOM, however, will be replaced with XML/SOAP.
There are still many business applications built around COM. SOAP and XML may
not be a good idea in a closed environment, here COM may be the answer.
Why should other companies accept XML and SOAP as standards?
Today, no two Web servers can communicate. This will become possible with XML
and SOAP. While XML has already been accepted as a standard, once people
understand the advantages of working with SOAP as it is platform independent,
this will also be adopted. It has already been accepted by IBM.
What is the status of Java in the .Net framework? C# looks a lot like
Java, have you incorporated anything from Java?
We have not taken anything from Java. One of the key points of .Net is that it
is language independent. Irrespective of the language you write your code in —
be it C, C#, Java Script, Visual Basic or for that matter even COBOL — you get
a pseudo machine code called intermediate language, which is executed on the
.Net framework. The same code can run on multiple devices–PCs, pocket PCs,
phones etc. There is no (specific) runtime (for the codes). You can also have
multiple executables running on a single process.
C# was created from C++ with some extra features, such as automatic garbage
collection.
When do you think the acceptance of .Net will be complete?
It is an evolution and would not be completed. Some of the .Net framework is
being accepted. It is not before 12-18 months that we will see major adoption of
the framework and products coming up.
From the Microsoft side, you will see Office.Net and the .Net version of
Windows 2000 being released during the end of 2001. Visual Studio is expected in
the second half of 2001. Parallel to this, you will see us supporting several
devices such as smartcards, in the .Net framework.