Package org.dbwiki.exception.data

Examples of org.dbwiki.exception.data.WikiDataException


   * Public Methods
   */
 
  public void endDocument() throws org.dbwiki.exception.WikiException {
    if (!_elementStack.isEmpty()) {
      throw new WikiDataException(WikiDataException.UnexcpectedEOD, "Open elements on input stack");
    }
    if (_valueReader != null) {
      throw new WikiDataException(WikiDataException.UnexcpectedEOD, "Open elements on input stack");
    }
  }
View Full Code Here


          if (!attribute.hasValue()) {
            attribute.setValue(_valueReader.value());
            _valueReader = null;
            _elementStack.pop();
          } else {
            throw new WikiDataException(WikiDataException.InvaldInputData, "Duplicate text value for attribute " + attribute.label());
          }
        } else {
          throw new WikiDataException(WikiDataException.InvaldInputData, "Unexpected text value under element " + currentElement.label());
        }
      } else {
        throw new WikiDataException(WikiDataException.InvaldInputData, "Trying to close non-existing element past end of document");
      }
    } else if (!_elementStack.isEmpty()) {
      _elementStack.pop();
    } else {
      throw new WikiDataException(WikiDataException.InvaldInputData, "Trying to close non-existing element past end of document");
    }
  }
View Full Code Here

        } else {
          _root = new DocumentGroupNode((GroupSchemaNode)_rootSchemaNode);
        }
        _elementStack.push(_root);
      } else {
        throw new WikiDataException(WikiDataException.InvaldInputData, "Expected root label " + _rootSchemaNode.label() + " instead of " + label);
      }
    } else if (!_elementStack.isEmpty()) {
      DocumentNode element = _elementStack.peek();
      if (element.isGroup()) {
        DocumentGroupNode group = (DocumentGroupNode)element;
        SchemaNode childSchemaNode = ((GroupSchemaNode)group.schema()).children().get(label);
        if (childSchemaNode != null && childSchemaNode.getTimestamp().isCurrent()) {
          DocumentNode child = null;
          if (childSchemaNode.isAttribute()) {
            child = new DocumentAttributeNode((AttributeSchemaNode)childSchemaNode);
            _valueReader = new NodeValueReader();
          } else {
            child = new DocumentGroupNode((GroupSchemaNode)childSchemaNode);
          }
          group.children().add(child);
          _elementStack.push(child);
        } else {
          _ignoreSubtreeDepth = 1;
        }
      } else {
        throw new WikiFatalException("Missing node value reader for attribute node " + element.label());
      }
    } else {
      throw new WikiDataException(WikiDataException.InvaldInputData, "Multiple root nodes detected");
    }
  }
View Full Code Here

  public void text(String value) throws org.dbwiki.exception.WikiException {
    if (_ignoreSubtreeDepth <= 0) {
      if (_valueReader != null) {
        _valueReader.text(value);
      } else if (!value.trim().equals("")) {
        throw new WikiDataException(WikiDataException.InvaldInputData, "Unexpected text node " + value);
      }
    }
  }
View Full Code Here

   */
  private void checkForConsistency() throws org.dbwiki.exception.WikiException {
   
    for (int iInterval = 1; iInterval < _intervals.size(); iInterval++) {
      if (_intervals.get(iInterval - 1).isOpen()) {
        throw new WikiDataException(WikiDataException.InvalidTimestamp, this.toIntString());
      }
      if (_intervals.get(iInterval).start() <= _intervals.get(iInterval - 1).end()) {
        throw new WikiDataException(WikiDataException.InvalidTimestamp, this.toIntString());
      }
    }
  }
View Full Code Here

      _handler.endElement();
      if (_readPath.equals(_schemaNodeRootPath)) {
        _handler.endDocument();
        DocumentNode inputRoot = _handler.getRootNode();
        if (!inputRoot.isGroup()) {
          throw new WikiDataException(WikiDataException.InvaldInputData, "Group node expected as input root");
        } else {
          _importHandler.importDocument((DocumentGroupNode)inputRoot);
        }
        _handler = null;
      }
View Full Code Here

    }
   
    if (page != null) {
      return page;
    } else {
      throw new WikiDataException(WikiDataException.UnknownResource, identifier.toParameterString());
    }
  }
View Full Code Here

    }
   
    if (versions.size() > 0) {
      return versions;
    } else {
      throw new WikiDataException(WikiDataException.UnknownResource, identifier.toParameterString());
    }
  }
View Full Code Here

 
  public void endElement() throws org.dbwiki.exception.WikiException {
    if (!_labelStack.isEmpty()) {
      _value = _value + "</" + _labelStack.pop() + ">";
    } else {
      throw new WikiDataException(WikiDataException.InvaldInputData, "Unmatched end element event in node value");
    }
  }
View Full Code Here

 
  public String value() throws org.dbwiki.exception.WikiException {
    if (_labelStack.isEmpty()) {
      return _value;
    } else {
      throw new WikiDataException(WikiDataException.InvaldInputData, "Open elements at end of node value");
    }
  }
View Full Code Here

TOP

Related Classes of org.dbwiki.exception.data.WikiDataException

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.