In the previous session, we saw what an Entity is. Now let us see what an
entity declaration is.
Entity declaration
Entity declarations are used to associate a name with some other fragment of
content. The content can be regular text, or of the document type declaration,
or a reference to an external file containing either text or binary data. There
are three types of entity declarations. They are:
External entity
External entities affiliate a name with the content of another file. External
entities allow an XML document to refer to the contents of another file. They
contain either text or binary data. If they contain text, the content of the
external file is inserted at the point of reference and parsed as part of the
referring document. Binary data is not parsed and may only be referenced in an
attribute as it is used to reference figures and other non-XML content in the
document. For example:
"/movies/subsidy.xml">
Using the term "&entertainment" in the document you can insert
the contents of the file /movies/subsidy.xml at the location of the entity
reference.
Internal entity
Internal entities associate a name with a string of literal text. The
advantage of this entity is that it allows you to define shortcuts for
frequently typed text or text that is expected to change, such as the revision
status of a document. Let us see this with an example:
CBL
"CyberIndia, Ltd.">
You can insert "CyberIndia, Ltd." anywhere in the text using &CBL
There are several entity references built into XML:
- &
An ampersand inside text would confuse the XML processor, so if you have text
such as "Barnes & Noble" you must substitute the "&"
with its entity reference: &
- <
The entity reference for the less than bracket, "<" is the same
as in HTML code. Use this inside attribute values.
- >
This reference entity produces the right angle bracket, >
- '
This is the entity reference for the single quote ( ' ). Use it inside
attribute values quoted with a single quote.
- "
This is the entity reference for the double quote ( " ).
Parameter entity
Parameter entities can only occur in the document type declaration.
Placing % (per cent-space) in front of its name in the declaration identifies a
parameter entity declaration. They are not recognized in the body of the
document. Parameter entities are used when elements have the same literal string
and are semantically same. This allows you to change the content model in only a
single place. For example, consider these two elements:
This content model can be defined using a parameter entity like:
Let us end this XML session with rudiments of a simple XML code where an
element "movies" is created with the element "Indian" under
it. I think you will understand better when you see the code.
In XML, the markup language shown above can have a DTD like this:
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.