473,473 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

xml SYSTEM vs PUBLIC

Hi !

In an XML DOCTYPE declaration you can use either PUBLIC or
SYSTEM attributes:

<!DOCTYPE RootElement SYSTEM "SomeDTD.dtd">
<!DOCTYPE RootElement PUBLIC "SomeDTD.dtd">

When should I use SYSTEM and when should I use PUBLIC ?


Regards,
Razvan
Jul 20 '05 #1
5 6526
mi*****@mailcity.com (Razvan) writes:
Hi !

In an XML DOCTYPE declaration you can use either PUBLIC or
SYSTEM attributes:

<!DOCTYPE RootElement SYSTEM "SomeDTD.dtd">
<!DOCTYPE RootElement PUBLIC "SomeDTD.dtd">

When should I use SYSTEM and when should I use PUBLIC ?


Regards,
Razvan

No, you could do that in SGML but in XML you _Always_ have to have a
SYSTEM identifier. If you use PUBLIC you gave to give _both_ a public ID
and the SYSTEM.

Although XML doesn't enforce this PUBLIC identifiers usually follow the
Formal Public Identifier syntax which has a bunch of fields separated by
/ that encode the author and identity of the dtd file but not (usually0
its location. eg MathML uses:

<!DOCTYPE math
PUBLIC "-//W3C//DTD MathML 2.0//EN"
"http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"


The PUBLIC Identifier "-//W3C//DTD MathML 2.0//EN shows it's (not from
ISO, the -) is from W3C is called DTD MathML 2.0 and uses English as
its documentaion, (one possible) URI where you might actually find the
thing is given by the SYSTEM ID
"http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"

David
Jul 20 '05 #2
Hi David,


Thanks for your answer.
No, you could do that in SGML but in XML you _Always_ have to have a
SYSTEM identifier.
If that is true then why have a PUBLIC identifier at all ? What is
their purpose ?

Is there some limitation to the type of data that you can put in
SYSTEM vs. PUBLIC identifiers ? For example: SYSTEM only supports URLs
(like http://www.w3c.org/ ) while PUBLIC only supports local paths ?
(this is just an example)

Regards,
Razvan
Jul 20 '05 #3


If that is true then why have a PUBLIC identifier at all ? What is
their purpose

beware that you are skirting on the edge of a very deep "debate":-)
Basically the public identifier gives a unique canonical name for the
dtd that you can recognise; whereas the SYSTEM identifier may well point
at a local path on the original author's system that doesn't make sense
on yours. An XML parser may use either (or both) identifiers to find the
file.

So if you have an xml parser that has an xml catalogue of some sort that
recognises say XHTML or Docbokk PUBLIC identifier, the file will work
even if the system ID points at a file not accessable to you as your
parser can use the catalogue to map the public ID to a local
copy. Conversely if you don't have that public id in your catalogue (or
if there is no public id) then you can perhaps find the file directly by
using the system id.

When the syntax was invented, for sgml, this last step would most
likely fail as it would be a local file name so it would assume that you
had local files in the same position. In XML when the SYSTEM is supposed
to be a URI and so perhaps usable from anywhere in the world there is an
argument (that I don't personally hold, but which is not unreasonable,
and comes up often) that the SYSTEM ID is all you need and PUBLIC IDs no
longer serve a purpose.

David
Jul 20 '05 #4
Hi !

Look what I've found on a web site:
(http://www.adp-gmbh.ch/xml/dtd.html)
SYSTEM
<!DOCTYPE root-element SYSTEM "http://xyz.qq/abc/def.dtd">

SYSTEM means that a validating parser needs the dtd when it validates
an XML document.
PUBLIC
<!DOCTYPE root-element PUBLIC "path/abc/def.dtd">

PUBLIC means that a validating parser might use a 'cached' ????
version of the DTD.
Mixing
<!DOCTYPE root-element PUBLIC "path/abc/def.dtd"
"http://xyz.qq/abc/def.dtd">

This form uses http://xyz.qq.abc.def.dtd only if path/abc/def.dtd is
not available.

Regards,
Razvan
Jul 20 '05 #5
Look what I've found on a web site:


Don't believe everything you read:-)

if in doubt go back to teh definition:

http://www.w3.org/TR/2004/REC-xml11-...#NT-ExternalID

[75] ExternalID ::= 'SYSTEM' S SystemLiteral
| 'PUBLIC' S PubidLiteral S SystemLiteral
which says that an ExternalID is either SYSTEM followed by a literal or
PUBLIC followed by two literals separated by white space. there is not
an option of having PUBLIC followed by just one literal. (except for the
declarations of notations which also include a special PUBLIC-only
production 83).

David
Jul 20 '05 #6

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

Similar topics

3
by: Terrence | last post by:
I am doing some of the C# walkthroughs to transition from VB to C#. When I try to execute static void Main() { Aplication.Run(new Form1()) } I raise a 'System.NullReferenceException" in...
2
by: Scott Reynolds | last post by:
I am having a problem exposing a class inherited from the collection base class as a webservice. If I expose the collection on a web page all works well and I am very happy. However when I try and...
5
by: Lance | last post by:
I want to expose properties of a class to a user via a PropertyGrid class. Some of the properties are of type System.IO.FileInfo. Ideally, an OpenFileDialog window would appear when the user...
1
by: solex | last post by:
Hello All, Hopefully someone has run into this error. I have written a class(source below) that launches a thread to monitor the StandardOutput of a System.Diagnostics.Process, in particular I...
3
by: Stacey Levine | last post by:
I have a webservice that has the below procedure. Basically a procedure to called a stored procedure and return the results. When I try to call the webservice from my program I get the error. Both...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
6
by: Arthur Dent | last post by:
How do you sort a generic collection derived from System.Collections.ObjectModel.Collection? Thanks in advance, - Arthur Dent
2
by: clevrmnkey | last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I finally need to make them work, and I can't for the life of me see what I'm doing wrong. I pared back my mail transaction to...
2
by: =?Utf-8?B?TmF0aGFuIFdpZWdtYW4=?= | last post by:
Hi, I am wondering why the .NET Framework is quite different from Win32 API when it comes to displaying system modal message boxes. Consider the four following types of system modal message...
22
by: schneider | last post by:
I need to hook the system mouse down event. I'm trying to replicate how a context menu hides when the mouse clicks outside of the control. Thanks, Schneider
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.