Is all this necessary????

G

George Bina

xmlns="namespace" and xmlns:prefix="namespace" are namespace
declarations, default namespace declaration and declaration of a
namespace associated with a prefix, respectively.

The namespace declarations are necessary to express elements
attributes or values that belong to a namespace. Unused namespace
declarations can be removed without any effect from the point of view
of an XML document - one can imagine though some strange application
that can look at the defined namespaces but these cases are very rare.

Back to your example, one cannot tell if the namespace declarations
that you have are necessary without knowing the rest of the document.

Best Regards,
George
 
J

Joe Kesselman

George said:
xmlns="namespace" and xmlns:prefix="namespace" are namespace
declarations

Namespaces allow defining XML-based languages which can be intermixed
without stepping on each others' keywords. For example, the list that
you've given us includes references to SOAP and to XML Schemas --
independently developed standards, which without namespaces would risk
colliding with each other if they happened to use the same element or
attribute name.

Official spec: http://www.w3.org/TR/REC-xml-names/
More readable description: http://www.xml.com/pub/a/1999/01/namespaces.html

The namespace declarations are necessary to express elements
attributes or values that belong to a namespace. Unused namespace
declarations can be removed without any effect from the point of view
of an XML document - one can imagine though some strange application
that can look at the defined namespaces but these cases are very rare.

Less rare than they should be, in my opinion. The common design pattern
has been for anything that uses XPath to pick up its prefix bindings
from the context in which they appear rather than inventing another
mechanism for declaring them; XSLT is the most widely-used example of
this but there are plenty of others, alas.
Back to your example, one cannot tell if the namespace declarations
that you have are necessary without knowing the rest of the document.

If the document contains any of those prefixes (SOAP:, xsd:, xsi:, ENC:
or si:), presume the corresponding declarations are required. You can
also look at what URIs these prefixes are being bound to; there doesn't
have to be anything actually at that URI but there often is a brief
document explaining what kinds of information that namespace is used to
describe, and if not a websearch for that URI will usually find the
official definition.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top