Class NamespaceResolver
- All Implemented Interfaces:
XMLNamespaceResolver
It is common for an XML document to include one or more namespaces. TopLink supports this using its NamespaceResolver. The namespace resolver maintains pairs of namespace prefixes and URIs. TopLink uses these prefixes in conjunction with the XPath statements you specify on EIS mappings to XML records and XML mappings.
Although TopLink captures namespace prefixes in the XPath statements for mappings (if applicable), the input document is not required to use the same namespace prefixes. TopLink will use the namespace prefixes specified in the mapping when creating new documents.
Code Sample
NamespaceResolver resolver = new NamespaceResolver();
resolver.put( "ns", "urn:namespace-example");
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Customer.class);
descriptor.setDefaultRootElement("ns:customer");
descriptor.setNamespaceResolver(resolver);
XMLDirectMapping mapping = new XMLDirectMapping();
mapping.setAttributeName("id");
mapping.setXPath("ns:id/text()");
descriptor.addMapping(mapping);
- See Also:
-
Constructor Summary
ConstructorDescriptionDefault constructorNamespaceResolver
(NamespaceResolver namespaceResolver) Copy constructor -
Method Summary
Methods inherited from class org.eclipse.persistence.internal.oxm.NamespaceResolver
generatePrefix, generatePrefix, getDefaultNamespaceURI, getNamespaces, getPrefixes, getPrefixesToNamespaces, hasPrefix, hasPrefixesToNamespaces, put, removeNamespace, resolveNamespacePrefix, resolveNamespaceURI, setDefaultNamespaceURI, setDOM, setNamespaces
-
Constructor Details
-
NamespaceResolver
public NamespaceResolver()Default constructor -
NamespaceResolver
Copy constructor
-