Package com.robustaweb.library.commons.exception

Examples of com.robustaweb.library.commons.exception.XmlException


        Element root = (Element) n;
        return root;
      }
    }

    throw new XmlException("Can't find any Root Element");
  }
View Full Code Here


   */
  @Override
  public Element getElement(String nodeName) throws XmlException {
    Element elt = getOptionalElement(nodeName);
    if (elt == null) {
      throw new XmlException("Can't find element : " + nodeName);
    } else {
      return elt;
    }
  }
View Full Code Here

  @Override
  public GwtRepresentation add(String nodeName, String nodeValue)
      throws XmlException {
    Element root = this.document.getDocumentElement();
    if (root == null) {
      throw new XmlException("The document has no Root Element");
    }

    Text textValue = this.document.createTextNode(nodeValue);
    Element elt = this.document.createElement(nodeName);
    elt.appendChild(textValue);
View Full Code Here

    }
    List<String> leftValues = getValues(leftNodeName);
    List<String> rightValues = getValues(rightNodeName);

    if (leftValues == null || rightValues == null) {
      throw new XmlException("Error : leftValues or rightValues is null");
    }
    if (leftValues.size() != rightValues.size()) {
      throw new XmlException(
          "Thee is a different ammount of leftValeus compare to rightValues");
    }

    CoupleList<String, String> couples = new CoupleList<String, String>();
    for (int i = 0; i < leftValues.size(); i++) {
View Full Code Here

  @Override
  public String get(String nodeName) throws RepresentationException {

    String val = getOptionalValue(nodeName);
    if (val == null) {
      throw new XmlException("Can't find tag " + nodeName
          + " in document");
    } else {
      return val;
    }
View Full Code Here

  @Override
  public Representation addList(String listName, String nodeName,
      List<Object> values) {
    Element root = this.document.getDocumentElement();
    if (root == null) {
      throw new XmlException("The document has no Root Element");
    }

    Element list = this.document.createElement(listName);
    root.appendChild(list);
View Full Code Here

    if (resources == null){
      throw new IllegalArgumentException("Resources is null");
    }
    Element root = this.document.getDocumentElement();
    if (root == null) {
      throw new XmlException("The document has no Root Element");
    }
   
    if (resources.isEmpty()){
      Element emptyListElement = this.document.createElement(prefixIfListIsEmpty) ;
      root.appendChild(emptyListElement);
View Full Code Here

    private Document createDocument(String xml){
           SAXBuilder sax = new SAXBuilder();
           try {
               this.document = sax.build(new StringReader(xml));
           } catch (JDOMException ex) {
               throw new XmlException(ex);
           } catch (IOException ex) {
               throw new XmlException(ex);
           }
           return document;
       }
View Full Code Here

    @Override
    public Element getElement(final String nodeName) throws XmlException {

        Element elt = getOptionalElement(nodeName);
        if (elt == null){
            throw new XmlException("Can't find element "+nodeName);
        }else{
            return elt;
        }
      
    }
View Full Code Here

    public CoupleList<String, String> getCouples(String leftNodeName, String rightNodeName) {
        List<String> left = getValues(leftNodeName);
        List<String> right = getValues(rightNodeName);

        if (left.size() != right.size()) {
            throw new XmlException(
                    "xml is not well designed for the getCouples method ; "
                    + "leftNodeName size is different from rightNodeName size");
        }

        CoupleList<String, String> couples = new CoupleList<String, String>();
View Full Code Here

TOP

Related Classes of com.robustaweb.library.commons.exception.XmlException

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.