Package railo.runtime.exp

Examples of railo.runtime.exp.XMLException


      Document doc;
      if(oXml instanceof String) {
        doc=XMLUtil.parse(XMLUtil.toInputSource(pc, oXml.toString()), null, false);
      }
      else if(oXml instanceof Node) doc=XMLUtil.getDocument((Node)oXml);
      else throw new XMLException("XML Object is of invalid type, must be a XML String or a XML Object","now it is "+Caster.toClassName(oXml));

      return XMLUtil.transform( doc, XMLUtil.toInputSource( pc, xsl ), parameters );
    }
    catch (Exception e) {
      throw Caster.toPageException(e);
View Full Code Here


       
        return setProperty(parent, name, value, caseSensitive);
      }
    // Name 
      else if(k.equals(XMLNAME)) {
        throw new XMLException("You can't assign a new value for the property [xmlname]");
      }
    // Type 
      else if(k.equals(XMLTYPE)) {
        throw new XMLException("You can't change type of a xml node [xmltype]");
      }
    // value 
      else if(k.equals(XMLVALUE)) {
        node.setNodeValue(Caster.toString(value));
      }
    // Attributes 
      else if(k.equals(XMLATTRIBUTES)) {
        Element parent=XMLCaster.toElement(doc,node);
        Attr[] attres=XMLCaster.toAttrArray(doc,value);
        //print.ln("=>"+value);
        for(int i=0;i<attres.length;i++) {
          if(attres[i]!=null) {
            parent.setAttributeNode(attres[i]);
            //print.ln(attres[i].getName()+"=="+attres[i].getValue());
          }
        }
      }
    // Text 
      else if(k.equals(XMLTEXT)) {
        removeChildCharacterData(XMLCaster.toRawNode(node),false);
        node.appendChild(XMLCaster.toRawNode(XMLCaster.toText(doc,value)));
      }
    // CData 
      else if(k.equals(XMLCDATA)) {
        removeChildCharacterData(XMLCaster.toRawNode(node),false);
        node.appendChild(XMLCaster.toRawNode(XMLCaster.toCDATASection(doc,value)));
      }
    // Children 
      else if(k.equals(XMLCHILDREN) || k.equals(XMLNODES)) {
        Node[] nodes=XMLCaster.toNodeArray(doc,value);
        removeChildren(XMLCaster.toRawNode(node),Node.ELEMENT_NODE,false);
        for(int i=0;i<nodes.length;i++) {
          if(nodes[i]==node) throw new XMLException("can't assign a XML Node to himself");
          if(nodes[i]!=null)node.appendChild(XMLCaster.toRawNode(nodes[i]));
        }
      }
      else {
        boolean isIndex=false;
          Node child = XMLCaster.toNode(doc,value,false);
        if(!k.getString().equalsIgnoreCase(child.getNodeName()) && !(isIndex=Decision.isInteger(k))) {
          throw new XMLException("if you assign a XML Element to a XMLStruct , assignment property must have same name like XML Node Name", "Property Name is "+k.getString()+" and XML Element Name is "+child.getNodeName());
        }
        Node n;
       
        // by index
        if(isIndex) {
          NodeList list = XMLUtil.getChildNodes(node.getParentNode(), Node.ELEMENT_NODE,true,node.getNodeName());
          int len = list.getLength();
         
         
          int index=Caster.toIntValue(k);
          if(index>len || index<1){
            String detail=len>1?
                "your index is "+index+", but there are only "+len+" child elements":
                "your index is "+index+", but there is only "+len+" child element";
           
           
            throw new XMLException("index is out of range", detail);
          }
          n=list.item(index-1);
          XMLUtil.replaceChild(child, n);
          return value;
        }
View Full Code Here

    int len=nodeList.getLength();
    for(int i=0;i<len;i++) {
      Node node=nodeList.item(i);
      if(node!=null) return node.getOwnerDocument();
    }
    throw new XMLException("can't get Document from NodeList, in NoteList are no Nodes");
  }
View Full Code Here

  @Override
  public Object get(Collection.Key key) throws PageException {
    try {       
      return XMLUtil.getProperty(node,key,caseSensitive);
    } catch (SAXException e) {
      throw new XMLException(e);
    }
  }
View Full Code Here

TOP

Related Classes of railo.runtime.exp.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.