Hi,
It seems that is a well known and old problem : see http://xsd.stylusstudio.com/2000Nov/post01006.htm
and I would like to have your opinions on it.
I would like to create the simplest XML content : an element "root" with an attribute "rootAttribute", with the same namespace. Here is my code (I want to respect the JAXP specification) :
You are right, it is not a problem with Saxon. Both serializers of Saxon or Xerces would give the same result.
In my opinion, it is a problem with the DOM Level 3 specification itself, and I think that should be modified if the W3C really wants that we use namespaces in our XML. And if we don't, that will create lots of problems in the future, when we will try to combine XML from different sources.
Are you involved in the W3C work ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't quite see the relevance to Saxon? This seems to be a question about DOM processing. I'm no great fan of the DOM, and its handling of namespaces often seems fairly bizarre.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
It seems that is a well known and old problem : see http://xsd.stylusstudio.com/2000Nov/post01006.htm
and I would like to have your opinions on it.
I would like to create the simplest XML content : an element "root" with an attribute "rootAttribute", with the same namespace. Here is my code (I want to respect the JAXP specification) :
And here the Xml I get :
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://test" xmlns:NS1="http://test" NS1:attribute="value"/>
!!??
So why do I have the same namespace declared twice with two different prefixes ??
Please tell me XML is not so complex.
You are right, it is not a problem with Saxon. Both serializers of Saxon or Xerces would give the same result.
In my opinion, it is a problem with the DOM Level 3 specification itself, and I think that should be modified if the W3C really wants that we use namespaces in our XML. And if we don't, that will create lots of problems in the future, when we will try to combine XML from different sources.
Are you involved in the W3C work ?
I haven't been involved with the DOM work, and in fact I don't think W3C is doing any more work on DOM.
In my view DOM has become a monster and it's too late to fix it. My advice is to use one of the alternatives, such as XOM.
I don't quite see the relevance to Saxon? This seems to be a question about DOM processing. I'm no great fan of the DOM, and its handling of namespaces often seems fairly bizarre.