Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Este conteúdo não está disponível no idioma selecionado.
30.2. XML Namespace Mapping
Overview Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
XML Schema type, group, and element definitions are scoped using namespaces. The namespaces prevent possible naming clashes between entities that use the same name. Java packages serve a similar purpose. Therefore, Apache CXF maps the target namespace of a schema document into a package containing the classes necessary to implement the structures defined in the schema document.
Package naming Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The name of the generated package is derived from a schema's target namespace using the following algorithm:
- The URI scheme, if present, is stripped.NoteApache CXF will only strip the http:, https:, and urn: schemes.For example, the namespace
http:\\www.widgetvendor.com\types\widgetTypes.xsd
becomes\\widgetvendor.com\types\widgetTypes.xsd
. - The trailing file type identifier, if present, is stripped.For example,
\\www.widgetvendor.com\types\widgetTypes.xsd
becomes\\widgetvendor.com\types\widgetTypes
. - The resulting string is broken into a list of strings using
/
and:
as separators.So,\\www.widgetvendor.com\types\widgetTypes
becomes the list{"www.widegetvendor.com", "types", "widgetTypes"}
. - If the first string in the list is an internet domain name, it is decomposed as follows:
- The leading
www.
is stripped. - The remaining string is split into its component parts using the
.
as the separator. - The order of the list is reversed.
So,{"www.widegetvendor.com", "types", "widgetTypes"}
becomes{"com", "widegetvendor", "types", "widgetTypes"}
NoteInternet domain names end in one of the following:.com
,.net
,.edu
,.org
,.gov
, or in one of the two-letter country codes. - The strings are converted into all lower case.So,
{"com", "widegetvendor", "types", "widgetTypes"}
becomes{"com", "widegetvendor", "types", "widgettypes"}
. - The strings are normalized into valid Java package name components as follows:
- If the strings contain any special characters, the special characters are converted to an underscore(
_
). - If any of the strings are a Java keyword, the keyword is prefixed with an underscore(
_
). - If any of the strings begin with a numeral, the string is prefixed with an underscore(
_
).
- The strings are concatenated using
.
as a separator.So,{"com", "widegetvendor", "types", "widgettypes"}
becomes the package name com.widgetvendor.types.widgettypes.
The XML Schema constructs defined in the namespace
http:\\www.widgetvendor.com\types\widgetTypes.xsd
are mapped to the Java package com.widgetvendor.types.widgettypes.
Package contents Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
A JAXB generated package contains the following:
- A class implementing each complex type defined in the schemaFor more information on complex type mapping see Chapter 33, Using Complex Types.
- An enum type for any simple types defined using the
enumeration
facetFor more information on how enumerations are mapped see Section 32.3, “Enumerations”. - A public
ObjectFactory
class that contains methods for instantiating objects from the schemaFor more information on theObjectFactory
class see Section 30.3, “The Object Factory”. - A
package-info.java
file that provides metadata about the classes in the package