period in XML tags

前端 未结 5 1424
难免孤独
难免孤独 2021-01-12 13:20

Studying XAML now, I keep seeing XAML tags in the format Object.Attribute. For example:

 
     OutOfBrowserSettings Sh         


        
5条回答
  •  孤街浪徒
    2021-01-12 14:08

    XML's naming rules are clearly explained e.g. here:

    XML elements must follow these naming rules:

    • Names can contain letters, numbers, and other characters
    • Names cannot start with a number or punctuation character
    • Names cannot start with the letters xml (or XML, or Xml, etc)
    • Names cannot contain spaces

    Any name can be used, no words are reserved.

    The URL I gave continues with "best practices" recommendations which do include

    Avoid "." characters. If you name something "first.name," some software may think that "name" is a property of the object "first."

    But, this is just a recommendation (breaking it may make your XML kind of hard to use with certain software), just like the one agains using -. Out of the recommendations, the only really crucial one is to avoid using : in XML names (since that does conflict with XML namespaces!-).

提交回复
热议问题