Hi,
I've got a question on namespaces. After reading http://www.w3.org/TR/xml-names11 I still don't understand how namespaces are
applied to attributes - particularly in regard to how processing
applications are supposed to determine the proper validation DTD.
In the following XML:
-------------
<?xml version="1.0" ?>
<root xmlns="http://www.w3.org/TR/REC-html40"
xmlns:html="htt p://www.w3.org/TR/REC-html40">
<a href="page1.htm l" html:href="page 2.html">
<html:a href="page1.htm l" html:href="page 2.html">
</root>
-------------
How is an application supposed to interpret these attributes?
TIA,
Axel Dahmen 13 2527
In article <eg**********@o nline.de>,
Axel Dahmen <NO*****@NoOneK nows.invalidwro te:
><root xmlns="http://www.w3.org/TR/REC-html40"
xmlns:html="htt p://www.w3.org/TR/REC-html40">
<a href="page1.htm l" html:href="page 2.html">
<html:a href="page1.htm l" html:href="page 2.html"> </root>
How is an application supposed to interpret these attributes?
The <aand <html:aelemen ts are both in the http://www.w3.org/TR/REC-html40
namespace. The href attributes are in no namespace, and the html:href
attributes are in the http://www.w3.org/TR/REC-html40 namespace.
The interpretation of attributes in no namespace depends on the element
they're on, so the interpretation of the href attributes is given by
the HTML spec.
>After reading http://www.w3.org/TR/xml-names11 I still don't understand how namespaces are applied to attributes - particularly in regard to how processing applications are supposed to determine the proper validation DTD.
Namespaces have nothing to do with determining the DTD. On the other
hand, namespaces *are* used to choose an XML Schema for validation.
The schema definition of the html:href attribute (if such a thing
exists) should appear in the HTML schema, because it's in the HTML
namespace. The definition of the href attribute should also appear
there, because it's on an element in the HTML namespace.
-- Richard
Richard Tobin schrieb:
The schema definition of the html:href attribute (if such a thing
exists) should appear in the HTML schema, because it's in the HTML
namespace. The definition of the href attribute should also appear
there, because it's on an element in the HTML namespace.
And, of course, the HTML 4 specification does not define or use a
namespace, because HTML is no XML application.
--
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)
In article <45************ ***********@aut hen.yellow.read freenews.net>,
Johannes Koch <ko**@w3develop ment.dewrote:
>And, of course, the HTML 4 specification does not define or use a namespace, because HTML is no XML application.
I was talking theoretically :-)
-- Richard
This looks awfully like a homework problem. If so, shame on you. But
it's a common point of confusion, so it's worth explaining in detail
whether or no.
Attributes are bound to a namespace *only* if their names use a prefix.
Unlike elements, they are not affected by an inherited default
attribute, nor do they pick up the namespace of their element.
<?xml version="1.0" ?>
<root xmlns="http://www.w3.org/TR/REC-html40"
xmlns:html="htt p://www.w3.org/TR/REC-html40">
These two attributes, of course, default the default namespace and the
html: prefix respectively. Since the default is defined, the <root>
element itself is in the namespace http://www.w3.org/TR/REC-html40 ...
which may not be what was intended.
<a href="page1.htm l" html:href="page 2.html">
Since the default namespace is set, the <aelement is in that
namespace. Since html:href has a prefix, it is in the namespace bound to
that prefix (which also happens to be http://www.w3.org/TR/REC-html40).
Since href does not have a prefix, is is *NOT* in that namespace -- it's
in the "no namespace" namespace. The fact that the element is namespaced
has no effect on the attributes.
<html:a href="page1.htm l" html:href="page 2.html">
html: is bound, so html:a is an a element in that namespace.
The attributes are as discussed before; the fact that the element is
namespaced has no effect on the attributes..
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Thanks, Richard, I'm still trying to understand XML, so your information is quite appreciated!
After reading http://www.w3.org/TR/xml-names11 I still don't understand how namespaces are
applied to attributes - particularly in regard to how processing
applications are supposed to determine the proper validation DTD.
Namespaces have nothing to do with determining the DTD. On the other
hand, namespaces *are* used to choose an XML Schema for validation.
I don't understand... Let's keep XML Schema out of focus for a minute.. From the XML Spec., DTDs are used by XML parsers to validate an XML document. So, DTDs are to XML what header files are to C++, aren't they?
For an XML parser being able to validate an XML document it uses DTDs. If I want to create an XML document being compiled from several DTDs (e.g. XHTML1.0), I add a reference to the corresponding DTDs to my XML document. For an XML parser being able to determine the correct DTD from a given set of DTDs at the beginning of an XML document, namespaces are used then. Aren't they?
Thanks a lot, Joe. Like I said in my previous post, I'm currently learning XML and your information is QUITE appreciated!
This looks awfully like a homework problem. If so, shame on you. But
it's a common point of confusion, so it's worth explaining in detail
whether or no.
No no, I'm just learning for myself... Look at me.. would I EVER cheat? ;-)
In my other life I'm a software engineer, but admittedly this XML specification is too hard for me to grasp.
I understand how attributes are saved and stored in a tree considering namespaces. What I don't understand is how an application is supposed to determine a valid attribute to apply to an element:
Imagine there's an application being able to render XML/XSL and XHTML1.0. Let's call it XaPP...
From what I understand, DTDs are to XML what header (.h) files are to C++, so in a document to render both, some proprietary XML and some embedded XHTML, I'd add 2 DTDs:
<?xml version="1.1"?>
<!DOCTYPE greeting SYSTEM "hello.dtd" >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://...dtd">
Next, I'd assign a namespace to the XHTML DTD: (To stress my point, I'll add the default namespace to XHTML as well)
<body xmlns="http://www.w3.org/TR/REC-html40"
xmlns:html="htt p://www.w3.org/TR/REC-html40">
Then I'd add nodes to the tree:
...
<a href="page1.htm l" html:href="page 2.html">
<html:a href="page1.htm l" html:href="page 2.html">
</body>
Three questions arise:
a) Which element declaration do I have to add to "hello.dtd" to allow for foreign (XHTML) elements to appear in the XML tree?
b) When the XaPP application reaches the <a(or <html:a>) element, which href / html:href attribute will it use to render the hyperlink?
c) Shouldn't at least two of the href / html:href attributes be interpreted as invalid by the parser as they are not mentioned in the appropriate DTD?
Thanks a lot for helping me to understand!! (Which I unfortunately don't yet..)
Regards,
Axel Dahmen
These two attributes, of course, default the default namespace and the
html: prefix respectively. Since the default is defined, the <root
element itself is in the namespace http://www.w3.org/TR/REC-html40 ...
which may not be what was intended.
Oops, my fault... ;)
Axel Dahmen schrieb:
For an XML parser being able to validate an XML document it uses DTDs.
Only one DTD per document.
If I want to create an XML document being compiled from several DTDs (e.g. XHTML1.0),
compiled?
I add a reference to the corresponding DTDs to my XML document. For an XML parser being able to determine the correct DTD from a given set of DTDs at the beginning of an XML document,
There is no set of DTDs at the beginning of an XML document. There is
only _one_ document type declaration which references _one_ document
type definition.
namespaces are used then. Aren't they?
No.
DTDs don't know namepaces. They are older than XML namespaces. For a DTD
an element foo:bar is not an element named bar from a namespace with the
prefix foo, but an element named foo:bar.
--
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)
Axel Dahmen wrote:
What I don't understand is how an application is supposed to determine a valid attribute to apply to an element:
Remember, the attributes have specific meanings to applications.
Therefore, they're generally hardcoded into the application.\
So the decision's made by the programmer.
From what I understand, DTDs are to XML what header (.h) files are to C++
so in a document to render both, some proprietary XML and some
embedded XHTML, I'd add 2 DTDs:
No. As others have said, one DTD per document, made up of an External
Subset and an Internal Subset. If you want to intermix other structures,
you either need a DTD which leaves some areas unvalidated (using ANY),
or you need to move to schemas. Note that XHTML *IS* intended to be
primarily schema-based rather than DTD-based.
Next, I'd assign a namespace to the XHTML DTD
No. Again as others have said: DTDs don't do namespaces. In fact, DTDs
are pretty darned nearly INCOMPATABLE with namespaces. If you're working
with namespaced documents, do not waste time studying DTDs; go directly
to schemas, or drop back to well-formed rather than validated.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
compiled?
^= combined
Thanks to all of you for your valuable help.
Regards,
Axel Dahmen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John L. Clark |
last post by:
I am curious as to the rationale, and effect, of having default
namespaces not applying (directly) to attributes (see
http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute
without a namespace prefix, what is its namespace, if default
namespaces do not apply? Are (either of) prefixed or non-prefixed
attributes correct? For example, are the following equivalent:
<html:br class="foo"...
|
by: kj |
last post by:
Consider the following XML document:
<?xml version='1.0' encoding='UTF-8'?>
<bar:foo xmlns:bar='someuri'>
<baz/>
</bar:foo>
What namespace does baz belong to? What is this namespace bound
to/associated with? My understanding was that baz above belongs
to some "default default namespace", but I have not been able to
|
by: Mike Dickens |
last post by:
hi,
i'm sure this has come up before but havn't managed to find an answer.
if i have the following xslt
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet method="xml" version="1.0" xmlns:ns1="abc"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" media-type="text/xml" standalone="yes"
version="1.0"/>
<xsl:template match="/">
|
by: clinton__bill |
last post by:
Hi,
I usually use "using namespace <namespace_name>" to reference a
namespace. Today I run across a code, in its header file it has this,
namespace SP1{
class C1;
}
While SP1::C1 is a namespace::class declared and defined somewhere
else. It seems the above 3 lines is similar to "using namespace SP1;",
|
by: Tony Johansson |
last post by:
Hello!
I'm reading a book about C++ and there is something that I don't understand
so I ask you.
Below I have the text from the book and the code from the file where main is
located and some namespace definition with class definitions.
The book says
"C++ has a global anonymous namespace that is similar to Java's global
anonymous package. All declarations not explicitly placed in named
| |
by: Patrick Guio |
last post by:
Dear all,
I have some problem with insertion operator together with namespace.
I have a header file foo.h containing declaration of classes, typedefs and
insertion operators for the typedefs in a named namespace
namespace foo
{
class Foo
|
by: Programatix |
last post by:
Hi,
Normally, I would use Namespace for all the window forms I created. With VS
2005, the code generated by the designer is hidden using partial keyword.
The question is, is there an efficient way to add any window forms created
into a namespace? Currently, I enclose the class for .vb and
.designer.vb inside a namespace manually.
|
by: toolmaster |
last post by:
Since many of the modern computer languages have built-in namespace
features, I can't understand why not add this feature into standard C.
I've heard many people complain of the lacking of namespace in C. Of
course, namespace doesn't eliminate name polution, but it helps more
than just to put some prefix before a function name. Is it because
adding namespace will make C more complex or some other reasons?
|
by: CrazyJohn |
last post by:
Hi guys,
This is my first time posting question here, if I break any rules,
please kindly point out. And I'm really glad to be a part of this
community.
Here is my question,
Our lecturer told us that Unnamed Namespace is an alternative to
Static Internal Variables, but he also said that Namespace has an
|
by: Peng Yu |
last post by:
Hi,
I'm wondering if there is something in namespace like the 'private'
keyword in class?
I want to define some class or function that can only be used within
that namespace.
Thanks,
Peng
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |