< prev index next >

src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailImpl.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  60         return addDetailEntry(name);
  61     }
  62 
  63     protected SOAPElement addElement(QName name) throws SOAPException {
  64         return addDetailEntry(name);
  65     }
  66 
  67     protected SOAPElement convertToSoapElement(Element element) {
  68         if (element instanceof DetailEntry) {
  69             return (SOAPElement) element;
  70         } else {
  71             DetailEntry detailEntry =
  72                 createDetailEntry(NameImpl.copyElementName(element));
  73             return replaceElementWithSOAPElement(
  74                 element,
  75                 (ElementImpl) detailEntry);
  76         }
  77     }
  78 
  79     public Iterator getDetailEntries() {
  80         return new Iterator() {
  81             Iterator eachNode = getChildElementNodes();
  82             SOAPElement next = null;
  83             SOAPElement last = null;
  84 
  85             public boolean hasNext() {
  86                 if (next == null) {
  87                     while (eachNode.hasNext()) {
  88                         next = (SOAPElement) eachNode.next();
  89                         if (next instanceof DetailEntry) {
  90                             break;
  91                         }
  92                         next = null;
  93                     }
  94                 }
  95                 return next != null;
  96             }
  97 
  98             public Object next() {
  99                 if (!hasNext()) {
 100                     throw new NoSuchElementException();
 101                 }
 102                 last = next;
 103                 next = null;
 104                 return last;
 105             }
 106 
 107             public void remove() {
 108                 if (last == null) {
 109                     throw new IllegalStateException();
 110                 }
 111                 SOAPElement target = last;
 112                 removeChild(target);
 113                 last = null;
 114             }
 115         };
 116     }
 117 
 118    protected  boolean isStandardFaultElement() {


   1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  60         return addDetailEntry(name);
  61     }
  62 
  63     protected SOAPElement addElement(QName name) throws SOAPException {
  64         return addDetailEntry(name);
  65     }
  66 
  67     protected SOAPElement convertToSoapElement(Element element) {
  68         if (element instanceof DetailEntry) {
  69             return (SOAPElement) element;
  70         } else {
  71             DetailEntry detailEntry =
  72                 createDetailEntry(NameImpl.copyElementName(element));
  73             return replaceElementWithSOAPElement(
  74                 element,
  75                 (ElementImpl) detailEntry);
  76         }
  77     }
  78 
  79     public Iterator getDetailEntries() {
  80         return new Iterator<SOAPElement>() {
  81             Iterator<org.w3c.dom.Node> eachNode = getChildElementNodes();
  82             SOAPElement next = null;
  83             SOAPElement last = null;
  84 
  85             public boolean hasNext() {
  86                 if (next == null) {
  87                     while (eachNode.hasNext()) {
  88                         next = (SOAPElement) eachNode.next();
  89                         if (next instanceof DetailEntry) {
  90                             break;
  91                         }
  92                         next = null;
  93                     }
  94                 }
  95                 return next != null;
  96             }
  97 
  98             public SOAPElement next() {
  99                 if (!hasNext()) {
 100                     throw new NoSuchElementException();
 101                 }
 102                 last = next;
 103                 next = null;
 104                 return last;
 105             }
 106 
 107             public void remove() {
 108                 if (last == null) {
 109                     throw new IllegalStateException();
 110                 }
 111                 SOAPElement target = last;
 112                 removeChild(target);
 113                 last = null;
 114             }
 115         };
 116     }
 117 
 118    protected  boolean isStandardFaultElement() {


< prev index next >