Code example for NamespaceContext

Methods: getPrefix

0
  	public String printByte(byte arg0) {
  	    return Byte.toString(arg0);
  	} 
 
  	public String printQName(QName arg0, NamespaceContext arg1) {
  	    String prefix = arg1.getPrefix(arg0.getNamespaceURI());
  	    if (prefix == null) {
  	        throw new IllegalArgumentException("The namespace URI " +
  	                						   arg0.getNamespaceURI() +
                                          	   " is not bound."); 
  	    } else if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
  	        return arg0.getLocalPart();
  	    } else { 
  	        return prefix + ":" + arg0.getLocalPart();
  	    } 
  	} 
 
    public String printDateTime(Calendar arg0) {
        return new XsDateTimeFormat().format(arg0);
    } 
Experience pair programming with AI  Get Codota for Java