Package org.w3c.dom

Examples of org.w3c.dom.DOMException


      iLeft = vNodes[iTok].indexOf("[");
      if (iLeft>0) {
        iRight = vNodes[iTok].indexOf("]");

        if (iRight==-1)
          throw new DOMException(DOMException.INVALID_ACCESS_ERR, "missing right bracket");

        // Sacar el contenido dentro de los corchetes
        vAttrs[iTok] = vNodes[iTok].substring(iLeft+1,iRight);
        // Eliminar las arrobas
        vAttrs[iTok] = vAttrs[iTok].replace('@',' ');
        // Cambiar las comillas simples por dobles
        vAttrs[iTok] = vAttrs[iTok].replace((char)39,(char)34);
        // Eliminar los espacios en blanco
        vAttrs[iTok] = vAttrs[iTok].trim();
        // Asignar al nodo el valor quitando el contenido de los corchetes
        vNodes[iTok] = vNodes[iTok].substring(0, iLeft);
      }
      else
        vAttrs[iTok] = "";

      if (DebugFile.trace) DebugFile.writeln("Token " + String.valueOf(iTok) + " : node=" + vNodes[iTok] + ", attr=" + vAttrs[iTok]);
    } // next (iTok)

    // Buscar el nodo
    iLeft = 0;
    iNode = 0;

    while (iNode<iNodeCount) {
      // Primero recorrer el documento XML para buscar nodos coincidentes

      iLeft = sXMLDoc.indexOf("<" + vNodes[iNode], iLeft);
      if (iLeft<0) {
        if (DebugFile.trace) DebugFile.writeln("Node " + vNodes[iNode] + " not found");
        throw new DOMException(DOMException.NOT_FOUND_ERR, "Node " + vNodes[iNode] + " not found");
      } // fi(iLeft<0)

      iRight = sXMLDoc.indexOf(">", iLeft+1);
      if (iRight<0) {
        if (DebugFile.trace) DebugFile.writeln("Unclosed Node " + vNodes[iNode] + " missing >");
        throw new DOMException(DOMException.SYNTAX_ERR, "Unclosed Node " + vNodes[iNode] + " missing >");
      }

      sCurrent = sXMLDoc.substring(iLeft+1, iLeft+vNodes[iNode].length()+1);

      if (vNodes[iNode].equals(sCurrent)) {

        if (vAttrs[iNode].length()==0) {
          // No hay atributos, dar por coincidente el primer nodo que aparezca
          iNode++;
        }

        // Tratar de forma especial la función position() de XPath
        else if (vAttrs[iNode].startsWith("position()")) {

          String[] aAttrValue = Gadgets.split2(vAttrs[iNode], '=');

          if (aAttrValue.length<2)
            throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "position() function can only be declared equal to last() function");
          else {
            if (aAttrValue[1].equals("last()")) {
              if ( isLastSibling (sXMLDoc, iRight, vNodes[iNode-1], sCurrent) ) {
                bAttrs[iNode] = true;
                iNode++;
              } // fi (isLastSibling)
            } // fi (aAttrValue[1])
            else
              throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "position() function can only be declared equal to last() function");
          }
        }
        else {
          // Mirar si el valor del atributo del nodo actual coincide con el especificado en XPath
          iAttr = sXMLDoc.indexOf(vAttrs[iNode], iLeft+1);
          if (iAttr>iLeft && iAttr<iRight) {
            bAttrs[iNode] = true;
            iNode++;
          }
        }
      } // fi(substring(<...)==vNode[])

      if (iNode<iNodeCount) iLeft = iRight;
    } // wend

    if (0==iLeft) {
      for (int b=0; b<iNodeCount; b++) {
        if (false == bAttrs[b]) {
          if (DebugFile.trace) DebugFile.writeln("Attribute " + vAttrs[b] + " of node " + vNodes[b] + " not found");
          throw new DOMException(DOMException.NOT_FOUND_ERR, "Attribute " + vAttrs[b] + " of node " + vNodes[b] + " not found");
        } // fi(bAttrs[b])
      } // next(b)
    } // fi(iLeft<0)

    if (DebugFile.trace) {
View Full Code Here


    iCloseParent = sXMLDoc.indexOf(sCloseParent, iOpenParent);

    if (DebugFile.trace) DebugFile.writeln("iCloseParent=" + String.valueOf(iCloseParent));

    if (iCloseParent<=0)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "Node " + sCloseParent + " not found");

    iSpace = 0;
    iAngle = iCloseParent - 1;
    b = sXMLDoc.charAt(iAngle);
    while (b==' ' || b=='\t') {
View Full Code Here

    iCloseParent = sXMLDoc.indexOf(sCloseParent, iOpenParent);

    if (DebugFile.trace) DebugFile.writeln("iCloseParent=" + String.valueOf(iCloseParent));

    if (iCloseParent<=0)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "Node " + sCloseParent + " not found");

    iSpace = 0;
    iAngle = iCloseParent - 1;
    b = sXMLDoc.charAt(iAngle);
    while (b==' ' || b=='\t') {
View Full Code Here

      sNodeName = vNodes[vNodes.length-1];

    iEndParent = sXMLDoc.indexOf("</" + sNodeName + ">", iStartParent) + sNodeName.length()+3;

    if (iEndParent==0)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "Node " + "</" + sNodeName + ">" + " not found");

    // Quitar los espacios por delante del nodo
    for (char b = sXMLDoc.charAt(iStartParent);
        (b==' ') && iStartParent>0;
         b = sXMLDoc.charAt(--iStartParent)) ;
View Full Code Here

    if (oContainers==null) {
      if (DebugFile.trace) {
        DebugFile.writeln("ERROR: <containers> node not found.");
        DebugFile.decIdent();
      }
      throw new DOMException(DOMException.NOT_FOUND_ERR, "<containers> node not found");
    }

    Node oContainer = (Node) oMSite.seekChildByAttr(oContainers, "guid", this.container());

    if (oContainer==null) {
      if (DebugFile.trace) {
        DebugFile.writeln("ERROR: guid attribute for container " + this.container() + " not found.");
        DebugFile.decIdent();
      }

      throw new DOMException(DOMException.NOT_FOUND_ERR, "guid attribute for container " + this.container() + " not found");
    } // fi

    Element oTemplate = oMSite.seekChildByName(oContainer, "template");

    if (oTemplate==null) {
      if (DebugFile.trace) {
        DebugFile.writeln("ERROR: <template> node for page " + this.getTitle() + " not found.");
        DebugFile.decIdent();
      }

      throw new DOMException(DOMException.NOT_FOUND_ERR, "<template> node for page " + this.getTitle() + " not found");
    }

  if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End Page.template() : " + oMSite.getTextValue(oTemplate));
View Full Code Here

    if (DebugFile.trace)
      if (null==oBlksNode)
        DebugFile.writeln("ERROR: blocks node not found");

    if (null==oBlksNode)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "<blocks> node not found");

    oNodeList = ((Element) oBlksNode).getElementsByTagName("block");
    iNodeListLen = oNodeList.getLength();

    if (DebugFile.trace)
View Full Code Here

    if (DebugFile.trace)
      if (null==oBlksNode)
        DebugFile.writeln("ERROR: blocks node not found");

    if (null==oBlksNode)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "<blocks> node not found");

    oNodeList = ((Element) oBlksNode).getElementsByTagName("block");
    iNodeListLen = oNodeList.getLength();

    if (DebugFile.trace)
View Full Code Here

        DebugFile.writeln("DOMException <pages> node not found");
        ByteArrayOutputStream baOut = new ByteArrayOutputStream();
        try { print(baOut); } catch (IOException ignore) {}
        DebugFile.write("\n"+baOut.toString()+"\n");
      }
      throw new DOMException(DOMException.NOT_FOUND_ERR, "<pages> node not found");
    }

    oNodeList = ((Element)oPagesNode).getElementsByTagName("page");

    if (oNodeList.getLength()>0) {
View Full Code Here

    // Buscar el nodo <pages>
    oPagesNode = seekChildByName(oPageSetNode, "pages");

    if (oPagesNode==null)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "<pages> node not found");

    oNodeList = ((Element)oPagesNode).getElementsByTagName("page");

    if (oNodeList.getLength()>0) {
      // Create Vector
View Full Code Here

    // Buscar el nodo <pages>
    oPagesNode = seekChildByName(oPageSetNode, "addresses");

    if (oPagesNode==null)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "<addresses> node not found");

    oNodeList = ((Element)oPagesNode).getElementsByTagName("address");

    if (oNodeList.getLength()>0) {
      // Create Vector
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.