Class NamespaceHelper

java.lang.Object
com.sun.xml.rpc.processor.modeler.j2ee.NamespaceHelper

public class NamespaceHelper extends Object
Helper class used to convert a QName from a xsd:QName string in an XML schema instance. The xsd:QName string is of the form prefix:localpart, and the mapping of prefix to a real namesapce may be defined at any level in the traversal of the XML instance. There, this class is intended to be used as follows:
When traversing a new child node BaseType, the push() method must be called to allow the NamespaceHelper to fetch any new prefix and namespace declaration in the child node. When done with visiting the child node, the pop() method must be called to revert back to previous settings.
  • Constructor Details

    • NamespaceHelper

      public NamespaceHelper()
  • Method Details

    • push

      public NamespaceHelper push(ComplexType ct)
      Push a BaseType during traversal of BaseType.
      Parameters:
      ct - The ComplexTypebeing visited
      Returns:
      a new instance of NamespaceHelper to be used to resolve QName string to a QName instance
    • pop

      public NamespaceHelper pop()
      Pop the NamespaceHelper to signal that we're done visiting the Basetype
      Returns:
      NamespaceHelper that can be used to resolve Qname string to a QName instance with the context that was set prior to visiting the BaseType
    • getQName

      public QName getQName(String nsString)
      Convert a QName string with namespace prefix to a QName instance containing real namespace.
      Parameters:
      nsString - the QName string in the XML instnace. It can be of the form "name", or "prefix:name".
      Returns:
      QName derived from the QName string, or null if QName can't be determined.