Package org.w3c.dom

Examples of org.w3c.dom.DOMException


  }

  public static String substringData(CharacterData charData, int offset,
                                     int count) throws DOMException {
    if (count < 0) {
      throw new DOMException(DOMException.INDEX_SIZE_ERR,
          "Illegal value for count: " + count);
    }

    String text = charData.getText();
    int length = (text != null) ? text.length() : 0;

    if ((offset < 0) || (offset >= length)) {
      throw new DOMException(DOMException.INDEX_SIZE_ERR,
          "No text at offset: " + offset);
    }

    if ((offset + count) > length) {
      return text.substring(offset);
View Full Code Here


  }

  public static void appendData(CharacterData charData, String arg)
      throws DOMException {
    if (charData.isReadOnly()) {
      throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
          "CharacterData node is read only: " + charData);
    } else {
      String text = charData.getText();

      if (text == null) {
View Full Code Here

  }

  public static void insertData(CharacterData data, int offset, String arg)
      throws DOMException {
    if (data.isReadOnly()) {
      throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
          "CharacterData node is read only: " + data);
    } else {
      String text = data.getText();

      if (text == null) {
        data.setText(arg);
      } else {
        int length = text.length();

        if ((offset < 0) || (offset > length)) {
          throw new DOMException(DOMException.INDEX_SIZE_ERR,
              "No text at offset: " + offset);
        } else {
          StringBuffer buffer = new StringBuffer(text);
          buffer.insert(offset, arg);
          data.setText(buffer.toString());
View Full Code Here

  }

  public static void deleteData(CharacterData charData, int offset, int count)
      throws DOMException {
    if (charData.isReadOnly()) {
      throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
          "CharacterData node is read only: " + charData);
    } else {
      if (count < 0) {
        throw new DOMException(DOMException.INDEX_SIZE_ERR,
            "Illegal value for count: " + count);
      }

      String text = charData.getText();

      if (text != null) {
        int length = text.length();

        if ((offset < 0) || (offset >= length)) {
          throw new DOMException(DOMException.INDEX_SIZE_ERR,
              "No text at offset: " + offset);
        } else {
          StringBuffer buffer = new StringBuffer(text);
          buffer.delete(offset, offset + count);
          charData.setText(buffer.toString());
View Full Code Here

  }

  public static void replaceData(CharacterData charData, int offset,
                                 int count, String arg) throws DOMException {
    if (charData.isReadOnly()) {
      throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
          "CharacterData node is read only: " + charData);
    } else {
      if (count < 0) {
        throw new DOMException(DOMException.INDEX_SIZE_ERR,
            "Illegal value for count: " + count);
      }

      String text = charData.getText();

      if (text != null) {
        int length = text.length();

        if ((offset < 0) || (offset >= length)) {
          throw new DOMException(DOMException.INDEX_SIZE_ERR,
              "No text at offset: " + offset);
        } else {
          StringBuffer buffer = new StringBuffer(text);
          buffer.replace(offset, offset + count, arg);
          charData.setText(buffer.toString());
View Full Code Here

   * Called when a method has not been implemented yet
   *
   * @throws DOMException DOCUMENT ME!
   */
  public static void notSupported() {
    throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
        "Not supported yet");
  }
View Full Code Here

            String msg =
                DOMMessageFormatter.formatMessage(
                    DOMMessageFormatter.DOM_DOMAIN,
                    "INVALID_CHARACTER_ERR",
                    null);
            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
        }
        return new AttrImpl(this, name);
       
    } // createAttribute(String):Attr
View Full Code Here

    public Element createElement(String tagName)
    throws DOMException {

        if (errorChecking && !isXMLName(tagName,xml11Version)) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
        }
        return new ElementImpl(this, tagName);

    } // createElement(String):Element
View Full Code Here

    public EntityReference createEntityReference(String name)
    throws DOMException {

        if (errorChecking && !isXMLName(name,xml11Version)) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
        }
        return new EntityReferenceImpl(this, name);

    } // createEntityReference(String):EntityReference
View Full Code Here

    String data)
    throws DOMException {

        if (errorChecking && !isXMLName(target,xml11Version)) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
        }
        return new ProcessingInstructionImpl(this, target, data);

    } // createProcessingInstruction(String,String):ProcessingInstruction
View Full Code Here

TOP

Related Classes of org.w3c.dom.DOMException

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.