Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: No spaces in NCName allowed: (re)naming conventions?

  1. #1
    Member
    Join Date
    Dec 2004
    Location
    SCEA, Foster City
    Posts
    36

    No spaces in NCName allowed: (re)naming conventions?

    name and sid attribute in <rigid_body> are of type NCName, which means they are not allowed to contain spaces or colons, even when you put quotes around it. (unless I misunderstood)

    Someone brought up the discussion that 3DS Max names the bones with spaces. The naming becomes a issue when you convert the skeleton into a ragdoll and create rigid bodies for each bone.

    By default 3D Studio max creates a ‘biped skeleton’ which has spaces in it.
    Do we need to convert them in underscores? How do people deal with this naming issue?

    Thanks,
    Erwin

    From COLLADA 1.41 Specification pdf from khronos.org/collada website:



    Quote from XML.COM
    http://www.xml.com/pub/a/2001/06/06/xsltspec.html

    NCName The XSLT specification describes many components of XSLT syntax as "NCNames," a term that comes from the W3C namespace specification. To simplify a little, an NCName is any name that begins with a letter or underscore and has no space or colon in it ("NC" = "No Colon" ). It can't have a colon because it may have a namespace prefix added to its beginning, and namespace prefixes themselves are also defined as NCNames. Because the prefix and the part after it are connected by a colon, a colon within these names would confuse a processor trying to figure out where the prefix ended and the other part began, so they both must be "No Colon" names. See also "QName."

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    Santa Clara
    Posts
    356
    By default 3D Studio max creates a ‘biped skeleton’ which has spaces in it.

    Do you mean the ColladaMax does this? In other words the COLLADA documents do not validate against the schema ? That would be a major bug, please report to feeling software bug system, and post the bug # here.

    Thanks

  3. #3
    Member
    Join Date
    Dec 2004
    Location
    SCEA, Foster City
    Posts
    36
    No,

    This is not about the max exporter. It is about COLLADA not allowing spaces in the name attribute.

    Someone didn't believe the fact that COLLADA names cannot have spaces.
    Then he used Max as an example of typical name generation that creates spaces. It was NOT about the Max COLLADA export.

    So, everyone fixes their names with underscores? Is there some convention there?
    Thanks,
    Erwin

  4. #4
    Junior Member
    Join Date
    Feb 2006
    Posts
    10
    Seems to me that 'name' attributes should allow any string value, and that they should never be used as identifiers. <node> has 'name' and 'id', which allows you to escape the id of a node and make it unique without mangling the human readable name.

  5. #5
    Senior Member
    Join Date
    Apr 2005
    Location
    Feeling Software, Montreal, Quebec
    Posts
    111
    Hi Erwin,

    In ColladaMax, for names, we use the FUDaeWriter::CleanName function that simply takes out all the invalid characters and replaces them with underscores.

    3dsMax can generate some pretty fun names too, for materials: like ' # ', ' ' and ' " ""'.

    This generates this great, and valid, material library in ColladaMax :

    Code :
    <library_materials>
      <material id="_" name="_">
        <instance_effect url="#_-fx"/>
      </material>
      <material id="___" name="___">
        <instance_effect url="#___-fx"/>
      </material>
      <material id="______" name="______">
        <instance_effect url="#______-fx"/>
      </material>
    </library_materials>

    Personally, I have no issue with letting the name attribute contain a pure string, rather than NCName. We do use the name to generate the ids, though, so we'll keep some code to stick in underscores for invalid characters and since Maya doesn't accept spaces either, we'll probably keep 'CleanName' around for quite some time.

    Sincerely,
    Guillaume Laforte
    Feeling Software Inc
    http://www.feelingsoftware.com

  6. #6
    Junior Member
    Join Date
    Jul 2006
    Location
    Lake Saint Louis, Missouri
    Posts
    4
    I realize that you are saying that the 'name' field can not have spaces. However, to be frank, I find this to be absurd.

    It is the *only* name field available in most nodes. It is almost always 'optional'. I can respect that the 'id' or 'sid' might need to have naming restrictions on it since it can be thought of as a 'key'. However, the 'name' field is controlled by the user.

    I can't very well tell artists 'You can't put spaces in your names'. And, as Erwin points out, *by default* a 3DSMAX biped skeleton has spaces in all of the node names.

    I realize I could do a horrific hack to munge the names going both into and out of my exporter, but there is not going to be any standardization on this kind of a hack.

    I would strongly suggest this so called 'restriction' be removed from the spec. There is absolutely no reason for it whatsoever. The 'name' field is a user supplied attribute and XML doesn't care what is in that attribute so long as it is in a quotated string.

    I have been fairly patient putting up with all of the arcane features of COLLADA but to suggest that a name field, inside a quotated string cannot contain spaces is just ridiculous.

    I can think of no rational reason why an *optional* user supplied annotated name field cannot be an ordinary string value.

    I hope this can be corrected, because I currently have no plans of bastardizing all of the name fields in my data files.

    Thanks,

    John

  7. #7
    Senior Member
    Join Date
    Jul 2004
    Location
    Santa Clara
    Posts
    356
    You are right that the restrictions on the name attribute do not need to be as stringent as for the id attribute. This is a very good feedback and need to be raised as a RFE or bug against the specification.

    Here is the place where bugs against the specification are collected:

    http://www.khronos.org/bugzilla.

    Please take the time to post the request there.

  8. #8
    Member
    Join Date
    Dec 2004
    Location
    SCEA, Foster City
    Posts
    36

  9. #9
    Junior Member
    Join Date
    Jul 2006
    Location
    Lake Saint Louis, Missouri
    Posts
    4
    Quote Originally Posted by erwin
    Thanks Erwin.

  10. #10
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771
    Do people really want to have strings as names? In XML Schema, strings can have all manner of characters and whitespace including newlines, carriage returns, vertical tabs, etc. etc..

    Perhaps the best data type for name attributes is xs:token? A token is a normalized string that may contain a single space between words.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •