We have launched a free Basic Kubernetes Course. Click here to enrol now! Kubernetes is a container orchestration platform used by enterprises worldwide and Kubernetes developers are in high demand!
This article demonstrates how Aalto can be used to bind namespace URI and prefix during XML generation. Create TestBindingPrefix class as shown below.
Prefix is bound using the following API methods:
- XMLStreamWriter2.setDefaultNamespace() to set the default namespace URI (see line 21 below)
- XMLStreamWriter2.setPrefix() method for setting the prefix and URI(e.g. see line 28 below)
For details of other XML generation API method see related article
The output of the program demonstrating binding of namespace prefix and URI is shown below.
In particular, note the namespace prefix ‘s’ and URI ‘http://www.studytrails.com’ in the generated XML.