Package org.jdom

Examples of org.jdom.JDOMException


     */
    private Element getPropElement(Element parent) throws JDOMException {
        List childrenList = parent.getChildren();
        if ( (childrenList.size() != 1) ||
                ( ! E_PROP.equals(((Element)childrenList.get(0)).getName()) ) ) {
            throw new JDOMException("Expected <"+E_PROP+"> element");
        }
        return (Element)childrenList.get(0);
    }
View Full Code Here


        Document document;
        Element root;
       
        document = parseRequestContent();
        if (document == null) {
            throw new JDOMException("Request content missing");
        }
        root = document.getRootElement();
        if( root == null || !root.getName().equals(rootName) ) {
            Domain.warn( "Root element must be "+rootName );
            throw new JDOMException("Root element must be <"+rootName+">");
        }
        return root;
    }
View Full Code Here

        max = children.size();
        for (i = 0; i < max; i++) {
            child = (Element) children.get(i);
            if (child.getName().equals(elementName)) {
                if (found != null) {
                    throw new JDOMException("multiple child elements '" + elementName + "' found.");
                }
                found = child;
            }
        }
        if (found == null) {
            throw new JDOMException("child element '" + elementName + "' not found.");
        }
        return found.getText();
    }
View Full Code Here

                operationElement = current;
            }
            current = root.getChild(DeltavConstants.E_SET, DNSP);
            if ( current != null) {
                if (operationElement != null) {
                    throw new JDOMException(LABEL_MUST_CONTAIN_EITHER_ADD_SET_OR_REMOVE);
                }
                operationElement = current;
            }
            current = root.getChild(DeltavConstants.E_REMOVE, DNSP);
            if ( current != null) {
                if (operationElement != null) {
                    throw new JDOMException(LABEL_MUST_CONTAIN_EITHER_ADD_SET_OR_REMOVE);
                }
                operationElement = current;
            }
            if (operationElement == null) {
                throw new JDOMException(LABEL_MUST_CONTAIN_EITHER_ADD_SET_OR_REMOVE);
            }
            operation = operationElement.getName();
           
            Element labelName = operationElement.getChild(DeltavConstants.E_LABEL_NAME, DNSP);
            if ( (labelName == null) ||
                    (labelName.getText() == null) ||
                    (labelName.getText().length() == 0) ) {
                throw new JDOMException(LABEL_MISSING);
            }
            label = labelName.getText();
        }
        catch (IOException  e){
            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
View Full Code Here

        Iterator i = parseRequestContent(E_UPDATE).getChildren().iterator();
        while( i.hasNext() ) {
            Element e = (Element)i.next();
            if( e.getName().equals(E_VERSION) ) {
                if( updateSourcePath != null ) {
                    throw new JDOMException("At most one &lt;"+E_VERSION+"&gt; element allowed" );
                }
                if (updateLabelName != null) {
                    throw new JDOMException("Either a &lt;"+E_VERSION+"&gt; OR a &lt;"+E_LABEL_NAME+"&gt; element allowed");
                }
                // get the href element
                ve = e;
                try {
                    Element hre = (Element)ve.getChildren().get(0);
                    if( hre == null || !hre.getName().equals(E_HREF) )
                        throw new Exception();
                    updateSourcePath = getSlidePath( hre.getText() );
                }
                catch( Exception x ) {
                    throw new JDOMException("&lt;"+E_VERSION+"&gt; element must contain &lt;"+E_HREF+"&gt; element" );
                }
            }
            if( e.getName().equals(E_PROP) ) {
                if( requestedProps != null ) {
                    throw new JDOMException("At most one "+E_PROP+" element allowed" );
                }
                requestedProps = new RequestedPropertiesImpl( e );
            }
            if( e.getName().equals(E_LABEL_NAME) ) {
                if (updateSourcePath != null) {
                    throw new JDOMException("Either a &lt;"+E_VERSION+"&gt; OR a &lt;"+E_LABEL_NAME+"&gt; element allowed");
                }
                if( updateLabelName != null ) {
                    throw new JDOMException("At most one &lt;"+E_LABEL_NAME+"&gt; element allowed" );
                }
                updateLabelName = e.getText();
            }
        }
    }
View Full Code Here

                                throw new Exception();
                            existingVersionPath = getSlidePath( hre.getText() );
                        }
                        catch( Exception x ) {
                            Domain.warn( E_VERSION+" element must contain "+E_HREF+" element" );
                            throw new JDOMException("<"+E_VERSION+"> element must contain <"+E_HREF+"> element" );
                        }
                        break;
                    }
                }
            }
View Full Code Here

                content.clear();
            }
            catch (Exception e) {
                // should not happen since the StringReader does not
                // perform any "real" I/O
                throw new JDOMException(e.getMessage());
            }
        }
    }
View Full Code Here

     *                           the request is not valid.
     */
    private void parseLockScope(Element lockScopeElement) throws JDOMException {
       
        if (lockScopeElement == null) {
            throw new JDOMException("Expected <"+E_LOCKSCOPE+"> element");
        }
       
        List children = lockScopeElement.getChildren();
        if (children.size() != 1) {
            throw new JDOMException("<"+E_LOCKSCOPE+"> must have exactly one child element");
        }
       
        lockInfo_lockScope = ((Element)children.get(0)).getName();
    }
View Full Code Here

     *                           the request is not valid.
     */
    private void parseLockType(Element lockTypeElement) throws JDOMException {
       
        if (lockTypeElement == null) {
            throw new JDOMException("Expected <"+E_LOCKTYPE+"> element");
        }
       
        List children = lockTypeElement.getChildren();
        if (children.size() != 1) {
            throw new JDOMException("<"+E_LOCKTYPE+"> must have exactly one child element");
        }
       
        lockInfo_lockType = ((Element)children.get(0)).getName();
    }
View Full Code Here

      Document document = builder.build(inputStream);

      try {
        translate(document.getRootElement());
      } catch (Throwable t) {
        throw new JDOMException(
            "Error translating HTML fragment into DRI", t);
      }

      SAXFilter filter = new SAXFilter(contentHandler, lexicalHandler,
          namespaces);
View Full Code Here

TOP

Related Classes of org.jdom.JDOMException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.