Skip to content

Define, provide example of namespaces #48

@chris-giblin

Description

@chris-giblin

It would be helpful to clarify how to declare and use namespaces. Are syntax and semantics sames as XML?

For example, in the metadata section of the standard spec, the following is stated:

To avoid collisions, custom metadata SHOULD always be properly namespaced, as illustrated in the examples further below...

However the provided example is actually not namespaced in the XML sense:

<doctag>
  <head> 
       ...
    <!-- examples of custom elements -->
    <my_company_hap_filter_hate/>0.1</my_company_hap_filter_hate>
    <my_company_hap_filter_abuse/>0.1</my_company_hap_filter_abuse>
    <my_company_hap_filter_profanity/>0.1</my_company_hap_filter_profanity>
  </head>
  <!-- document content -->
</doctag>

The following suggestion uses XML-style namespaces to qualify the custom metadata:

<doctag>
  <head xmlns:company_ai_ns="http://www.example.com/company_ai_ns"> 
       ...
    <!-- examples of custom elements -->
    <company_ai_ns:hap_filter_hate>0.1</company_ai_ns:hap_filter_hate>
    <company_ai_ns:hap_filter_abuse>0.1</company_ai_ns:hap_filter_abuse>
    <company_ai_ns:hap_filter_profanity>0.1</company_ai_ns:hap_filter_profanity>
  </head>
  <!-- document content -->
</doctag>

Perhaps at the beginning of the spec, we could summarize key equivalences to and deviations from XML. Definition and usage of namespaces could be placed there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions