< prev index next >

src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Detail1_2Impl.java

Print this page




  42 import org.w3c.dom.Element;
  43 
  44 public class Detail1_2Impl extends DetailImpl {
  45 
  46     protected static final Logger log =
  47         Logger.getLogger(Detail1_2Impl.class.getName(),
  48                          "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings");
  49 
  50     public Detail1_2Impl(SOAPDocumentImpl ownerDocument, String prefix) {
  51         super(ownerDocument, NameImpl.createSOAP12Name("Detail", prefix));
  52     }
  53 
  54     public Detail1_2Impl(SOAPDocumentImpl ownerDocument) {
  55         super(ownerDocument, NameImpl.createSOAP12Name("Detail"));
  56     }
  57 
  58     public Detail1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
  59         super(ownerDoc, domElement);
  60     }
  61 

  62     protected DetailEntry createDetailEntry(Name name) {
  63         return new DetailEntry1_2Impl(
  64             ((SOAPDocument) getOwnerDocument()).getDocument(),
  65             name);
  66     }
  67 

  68     protected DetailEntry createDetailEntry(QName name) {
  69         return new DetailEntry1_2Impl(
  70             ((SOAPDocument) getOwnerDocument()).getDocument(),
  71             name);
  72     }
  73 
  74     /*
  75      * Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
  76      * attribute to SOAP Detail (SOAP 1.2 spec, part 1, section 5.1.1)
  77      */

  78     public void setEncodingStyle(String encodingStyle) throws SOAPException {
  79         log.severe("SAAJ0403.ver1_2.no.encodingStyle.in.detail");
  80         throw new SOAPExceptionImpl("EncodingStyle attribute cannot appear in Detail");
  81     }
  82 

  83     public SOAPElement addAttribute(Name name, String value)
  84         throws SOAPException {
  85         if (name.getLocalName().equals("encodingStyle")
  86             && name.getURI().equals(NameImpl.SOAP12_NAMESPACE)) {
  87             setEncodingStyle(value);
  88         }
  89         return super.addAttribute(name, value);
  90     }
  91 

  92     public SOAPElement addAttribute(QName name, String value)
  93         throws SOAPException {
  94         if (name.getLocalPart().equals("encodingStyle")
  95             && name.getNamespaceURI().equals(NameImpl.SOAP12_NAMESPACE)) {
  96             setEncodingStyle(value);
  97         }
  98         return super.addAttribute(name, value);
  99     }
 100 }


  42 import org.w3c.dom.Element;
  43 
  44 public class Detail1_2Impl extends DetailImpl {
  45 
  46     protected static final Logger log =
  47         Logger.getLogger(Detail1_2Impl.class.getName(),
  48                          "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings");
  49 
  50     public Detail1_2Impl(SOAPDocumentImpl ownerDocument, String prefix) {
  51         super(ownerDocument, NameImpl.createSOAP12Name("Detail", prefix));
  52     }
  53 
  54     public Detail1_2Impl(SOAPDocumentImpl ownerDocument) {
  55         super(ownerDocument, NameImpl.createSOAP12Name("Detail"));
  56     }
  57 
  58     public Detail1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
  59         super(ownerDoc, domElement);
  60     }
  61 
  62     @Override
  63     protected DetailEntry createDetailEntry(Name name) {
  64         return new DetailEntry1_2Impl(
  65             ((SOAPDocument) getOwnerDocument()).getDocument(),
  66             name);
  67     }
  68 
  69     @Override
  70     protected DetailEntry createDetailEntry(QName name) {
  71         return new DetailEntry1_2Impl(
  72             ((SOAPDocument) getOwnerDocument()).getDocument(),
  73             name);
  74     }
  75 
  76     /*
  77      * Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
  78      * attribute to SOAP Detail (SOAP 1.2 spec, part 1, section 5.1.1)
  79      */
  80     @Override
  81     public void setEncodingStyle(String encodingStyle) throws SOAPException {
  82         log.severe("SAAJ0403.ver1_2.no.encodingStyle.in.detail");
  83         throw new SOAPExceptionImpl("EncodingStyle attribute cannot appear in Detail");
  84     }
  85 
  86     @Override
  87     public SOAPElement addAttribute(Name name, String value)
  88         throws SOAPException {
  89         if (name.getLocalName().equals("encodingStyle")
  90             && name.getURI().equals(NameImpl.SOAP12_NAMESPACE)) {
  91             setEncodingStyle(value);
  92         }
  93         return super.addAttribute(name, value);
  94     }
  95 
  96     @Override
  97     public SOAPElement addAttribute(QName name, String value)
  98         throws SOAPException {
  99         if (name.getLocalPart().equals("encodingStyle")
 100             && name.getNamespaceURI().equals(NameImpl.SOAP12_NAMESPACE)) {
 101             setEncodingStyle(value);
 102         }
 103         return super.addAttribute(name, value);
 104     }
 105 }
< prev index next >