You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by mi...@objectweb.org on 2004/06/01 18:27:15 UTC

generated output contains xmlns=""

Following transformation, my generated XML contains a node with:
<jonas-resource xmlns=""> 

I've been told that the xmlns="" is legal, but this is not accepted by any 
of the xml validation tools I'm using.  If I run the generated xml through 
ANT <xmlvalidate> I get an error message:
[xmlvalidate] 
/C:/GIROUX/JOnAS/TCK_DD_Porting_Tool/dist/jonas-LocalTxHandlerTest_web.xml:4:28: 
cvc-complex-type.2.4.a: Invalid content was found starting with element 
'jonas-resource'. One of 
'{"http://www.objectweb.org/jonas/ns":jonas-ejb-ref, 
"http://www.objectweb.org/jonas/ns":jonas-service-ref, 
"http://www.objectweb.org/jonas/ns":jonas-resource, 
"http://www.objectweb.org/jonas/ns":jonas-resource-env, 
"http://www.objectweb.org/jonas/ns":jonas-message-destination-ref, 
"http://www.objectweb.org/jonas/ns":jonas-message-destination, 
"http://www.objectweb.org/jonas/ns":host, 
"http://www.objectweb.org/jonas/ns":context-root, 
"http://www.objectweb.org/jonas/ns":port, 
"http://www.objectweb.org/jonas/ns":java2-delegation-model}' is expected.
[xmlvalidate] 
C:\GIROUX\JOnAS\TCK_DD_Porting_Tool\dist\jonas-LocalTxHandlerTest_web.xml 
is not a valid XML document

Manually editing the file to remove the xmlns="" corrects the problem.

I'm not an expert here, but as far as I can tell, xalan and xerces should 
be following the same rules.  Either it is valid to have the xmlns="" in 
the document and xerces has a bug, or this is an error and xalan has a 
bug.

I guess there is one additional option, I could have a bug in my xslt that 
is allowing this to happen, but so far I have been unable to suppress the 
empth namespace attribute.  I have to run the generated xml through a 
separate ANT <copy> task to remove the undesired attribute.

Until this is fixed, I'll continue to use the ANT <copy> task to remove 
the unneeded namespace attributes.

Michael Giroux

Re: generated output contains xmlns=""

Posted by Joseph Kesselman <ke...@us.ibm.com>.



xmlns="" is legal; it clears any default namespace declaration already
present. See the namespaces spec.

>From the error messages you quote, it looks like the problem is that your
schema expects that node to belong to a particular namespace, and that
isn't what you're generating in your output document. Figure out what it
needs and why that isn't what you're producing

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk