On recent projects, I have found myself responsible for creating one or more XML schemas to describe the data and message structures for the web services that were being exposed.
One of my early struggles in doing this was developing a consistent approach for naming the elements and types that were used in the schemas.
One good source of naming and design standards is the Naming and Design Rules page on the OASIS Cover Pages that compiles several industry and government standards that have attempted to address this area.
Another helpful resource is the Use of Camel-Case for Naming XML and XML-related Components page. This second source focuses on how elements and attributes should be named for consistency.
For example, the ebXML standard has the following to say about the use of upper camel case for naming elements.
Relevant section: 4.3 Design Conventions for ebXML Specifications
In order to enforce a consistent capitalization and naming convention across all ebXML specifications “Upper Camel Case” (UCC) and “Lower Camel Case” (LCC) Capitalization styles SHALL be used. UCC style capitalizes the first character of each word and compounds the name. LCC style capitalizes the first character of each word except the first word.
ebXML DTD, XML Schema and XML instance documents SHALL have the effect of producing ebXML XML instance documents such that:
Element names SHALL be in UCC convention (example: ).
Attribute names SHALL be in LCC convention (example: )
When UML and Object Constrained Language (OCL) are used to specify ebXML artifacts Capitalization naming SHALL follow the following rules:
Class, Interface, Association, Package, State, Use Case, Actor names SHALL use UCC convention (examples: ClassificationNode, Versionable, Active, InsertOrder, Buyer).
Attribute, Operation, Role, Stereotype, Instance, Event, Action names SHALL use LCC convention (examples: name, notifySender, resident, orderArrived).
General rules for all names are:
Acronyms SHOULD be avoided, but in cases where they are used, the capitalization SHALL remain (example: XMLSignature).
Underscore ( _ ), periods ( . ) and dashes ( - ) MUST NOT be used (don’t use: header.manifest, stock_quote_5, commercial-transaction, use HeaderManifest, stockQuote5, CommercialTransaction instead).
Mark
1 Like