KhronosGroup / OpenCOLLADA

652 stars 251 forks source link

collada tag contains unspecified attribute xmlns:xsi for collada 1.4.1 #621

Open gaiaclary opened 4 years ago

gaiaclary commented 4 years ago

When blender exports a collada file the collada tag contains: <COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

The last attribute xmlns:xsi is not defined in the khronos documentation, see page 5-22 in https://www.khronos.org/files/collada_spec_1_4.pdf

I suspect that line 101 in ColladaSWStreamWriter.cpp should be removed.

if ( getCOLLADAVersion() == COLLADA_1_4_1 ) { appendAttribute ( CSWC::CSW_ATTRIBUTE_XMLNS, CSWC::CSW_NAMESPACE_1_4_1 ); appendAttribute ( CSWC::CSW_ATTRIBUTE_VERSION, CSWC::CSW_VERSION_1_4_1 ); // next line maybe needs to be removed here: appendAttribute ( CSWC::CSW_ATTRIBUTE_XMLNS_XSI, CSWC::CSW_XMLNS_XSI_1_5_0 ); }

gaiaclary commented 4 years ago

sorry, line breaks are not preserved when i add a code section so the above code examples are badly formated :(

anyways i guess the line 101 needs to be removed:

appendAttribute ( CSWC::CSW_ATTRIBUTE_XMLNS_XSI, CSWC::CSW_XMLNS_XSI_1_5_0 );

gaiaclary commented 4 years ago

The related issue on the Blender project is here: https://developer.blender.org/T69025 From the last comment on that report it sounds like actually there is no problem in the openCollada implementation but a problem in the schema definition itself ? Please can someone clarify?

m-7761 commented 4 years ago

Gaia asked me to comment.

I think xsi adds a global attribute. Maybe OpenCOLLADA wants to find that attribute in the COLLADA element?

My impression was OpenCOLLADA doesn't know how to handle prefixed xmlns attributes (pseudo-attributes) but if it was that simple, then these constants wouldn't namecheck XSI (e.g. CSW_ATTRIBUTE_XMLNS_XSI).

But it is valid. The xsi prefix might be used anywhere in the document. It's declared in the root element. (The COLLADA schema uses a processing-instruction that is called something like enable-xmlns, but that is nonstandard. It just told COLLADA-DOM to add an xmlns field to the data-structures. It's still valid to add xmlns to any element in the document. Earlier this year I added full xmlns to COLLADA-DOM. Arbitrary xmlns attributes fall into the category of nonschema attributes, that must be accessed with subscripts instead of C++ identifiers.)

m-7761 commented 4 years ago

EDITED: It should be noted that "xsi:xmlns" is meaningless. "http://www.w3.org/2001/XMLSchema-instance" bestows meaning to the prefix. xsi is the conventional prefix, but it could be XSI (caps) or anything, technically. In other words a generalized parser would not look for "xsi:xmlns".

(XML is actually super complicated. I think that's a big contributing factor to COLLADA's downfall, since Khronos doesn't have the muscle to force developers to implement complicated systems. In COLLADA's case either noncommercial developers must pick up the slack, or nobody will. For me it's an easier option to run with COLLADA than to try to invent an alternative for which there is no impetus for adoption. I think we can kind of rub the commercial software's world's face in it. That is better story than trying to reinvent the wheel. EDITED: The problem with 3D formats is everyone is always reinventing the wheel. So it's hopeful to just grab the wheel. That seems like the first place to start, to end the cycle.)