Package org.w3c.dom

Examples of org.w3c.dom.Node


  protected Element createMessageElement(Object value) throws Exception {
   
    String requestPartName=_config.getAttribute(REQUEST_PART_NAME);
   
    org.w3c.dom.Element mesgElem=null;
    Node node=null;
     
    if (value instanceof String) {

      // Convert to element
      node = getNode((String)value);

    } else if (value instanceof Node) {
      node = (Node)value;
    }

    if (node == null) {
      throw new RuntimeException("Failed to obtain DOM representation of message value");
    }
   
    logger.debug("Node type is: "+node.getNodeType()+" requestPartName="+requestPartName);
   
    // If value is an element, and no request part name has been provided,
    // then pass the DOM element through as is.
    if (node.getNodeType() == Node.ELEMENT_NODE &&
              requestPartName == null) {
      mesgElem = (org.w3c.dom.Element)node;
     
    } else if (requestPartName == null) {
      // Not possible to pass anything other than an Element
      // if the request partname is not defined
      throw new RuntimeException("Non-element value can only be used in request if part name specified");
     
    } else {
     
      // Need to construct DOM element for message
      mesgElem = createMessage();
     
      // Transfer value into this message element
      node = (Node)node.cloneNode(true);
     
      Element partElem=mesgElem.getOwnerDocument().createElement(requestPartName);
      mesgElem.appendChild(partElem);
     
      node = (Node)mesgElem.getOwnerDocument().adoptNode(node);
View Full Code Here


   * @param text The text
   * @return The node
   * @throws Exception Failed to convert the text
   */
  protected static Node getNode(String text) throws Exception {
    Node ret=null;
   
    try {
      // Transform the text representation to DOM
      DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
      fact.setNamespaceAware(true);
View Full Code Here

    }

    public void writeItemToResult(Result result) throws XQException {
        if(result instanceof DOMResult) {
            final DOMResult domResult = (DOMResult) result;
            final Node rootNode = domResult.getNode();
            final Node newNode = getNode();
            if(rootNode != null) {
                rootNode.appendChild(newNode); // REVIEWME
            } else {
                domResult.setNode(newNode);
            }
View Full Code Here

            DocumentBuilder bldr = fact.newDocumentBuilder();
            doc = bldr.parse(m_wsdlProvider.getWSDL(req));
            Element schema = doc.getDocumentElement();
            NodeList services = schema.getElementsByTagNameNS(WSDLSOAP_NAMESPACE, "address");
            for (int i = 0; i < services.getLength(); i++) {
                Node node = services.item(i).getAttributes().getNamedItem("location");
                if (node != null) {
                    String location = node.getTextContent();
                    node.setTextContent(adaptLocation(location, locationBase));
                }
            }
        } catch (ParserConfigurationException e) {
            throw new WsException("Unable to configure parser for WSDL adapter: " + e.getMessage());
        } catch (SAXException e) {
View Full Code Here

      String idXML = getQBXMLName(qbXML);
      String nameQBXML = idXML.substring(0, idXML.length() - 5);

      NodeList list = qbXML.getElementsByTagName(nameQBXML + "AddRs");
      Node tmp = null;

      int requestID = 0;
      int length = list.getLength();

      for (int i = 0; i < length; i++)
      {

        tmp = list.item(i);
        requestID = Integer.parseInt(tmp.getAttributes().getNamedItem(ATTR_REQUEST_ID).getNodeValue());

        if (!tmp.getAttributes().getNamedItem(ATTR_STATUS_CODE).getNodeValue().equals("0"))
        {
          System.out.print("******RequestID = " + requestID);
          System.out.println(" * Message from QB :  " + tmp.getAttributes().getNamedItem(ATTR_STATUS_MESSAGE).getNodeValue());
          arl.add(requestID, null);
        } else
        {
          arl.add(requestID, getValueOfNodeByTagName(tmp, TAG_LISTID));
        }
View Full Code Here

    HashMap hm = new HashMap();

    try
    {
      NodeList list = getDocumentFromString(qbxml).getElementsByTagName(qbxmlName.substring(0, qbxmlName.length() - 7) + "Ret");
      Node node = null;

      String externalID;
      String editSequence;

      int length = list.getLength();
View Full Code Here

    {
      filePath = path;
      ArrayList objectsCV = new ArrayList();
      Document qbXML = getDocumentFromString(xml);
      String nameQBXML = getQBXMLName(qbXML);
      Node node = qbXML.getElementsByTagName(nameQBXML).item(0);

      Document configForQBXML = getDocumentFromString(getDocumentFromString(FILE_CONFIG).getElementsByTagName(nameQBXML).item(0).toString());

      listVOAndModuleName = new HashMap();
      NodeList listQB = qbXML.getElementsByTagName(getValueOfNodeByTagName(configForQBXML, TAG_SEPARATOR) + "Ret");
      Node config = configForQBXML.getFirstChild();

      String moduleName = getValueOfNodeByTagName(config, TAG_MODULE_NAME);
      String className = getValueOfNodeByTagName(config, TAG_VONAME);

      Object cvObj = null;
View Full Code Here

      Object thisObj = thisClass.newInstance();
      Object argList[] = new Object[2];
      Object oneArg[] = new Object[1];
      Object ret = null;

      Node xml = null;
      oneInput[0] = Class.forName("java.lang.String");
      twoInputs[0] = Class.forName("java.lang.String");
      twoInputs[1] = Class.forName("java.lang.String");

      Method method = null;

      if (attr.getNamedItem("aatocv").getNodeValue().equals("getIDFromEXID"))
      {
        xml = list.item(0);
        argList[0] = attr.getNamedItem("table").getNodeValue();
        argList[1] = getRecord(xml.toString(), TAG_LISTID);
        method = thisClass.getMethod("getIDFromEXID", twoInputs);
        ret = method.invoke(thisObj, argList);

        if (ret != null)
        {
          Object arg[] = new Object[1];

          arg[0] = getObjectByName(attr.getNamedItem("type").getNodeValue(), ret.toString());
          oneInput[0] = getArgType(attr.getNamedItem("type").getNodeValue());

          method = classCV[0].getMethod(attr.getNamedItem("set").getNodeValue(), oneInput);
          method.invoke(objectCV, arg);
        }
      } else if (attr.getNamedItem("aatocv").getNodeValue().equals("getValueFromTags"))
      {
        Object arg[] = new Object[1];
        xml = list.item(0);
        arg[0] = getRecord(xml.toString(), tagName);
        oneInput[0] = getArgType("java.lang.String");
        method = thisClass.getMethod(attr.getNamedItem("aatocv").getNodeValue(), oneInput);

        ret = method.invoke(thisObj, arg);
        arg[0] = (String)ret;

        method = classCV[0].getMethod(attr.getNamedItem("set").getNodeValue(), oneInput);
        method.invoke(objectCV, arg);
      } else if (attr.getNamedItem("aatocv").getNodeValue().equals("getItemLinesFromTags"))
      {
        oneArg[0] = getItemLinesFromTags(list);
        oneInput[0] = Class.forName(attr.getNamedItem("type").getNodeValue());
        method = classCV[0].getMethod(attr.getNamedItem("set").getNodeValue(), oneInput);
        method.invoke(objectCV, oneArg);

      } else
      {
        xml = list.item(0);
        oneInput[0] = getArgType(attr.getNamedItem("type").getNodeValue());
        oneArg[0] = getRecord(xml.toString(), TAG_LISTID);
        method = classCV[0].getMethod(attr.getNamedItem("aatocv").getNodeValue(), oneInput);
        method.invoke(objectCV, oneArg);
      }

    } catch (Exception e)
View Full Code Here

      Method method = null;
      Object obj = null;
      String classNameField = "";
      Class argumentType[] = null;

      Node get = attr.getNamedItem("get");

      if (get == null)
      {
        next(objectCV, config.getFirstChild(), xml, className, attr);
      } else
      {
        classNameField = attr.getNamedItem("type").getNodeValue();
        method = classCV[0].getMethod(get.getNodeValue(), argumentType);
        obj = method.invoke(objectCV, argumentType);

        next(obj, config.getFirstChild(), xml, classNameField, attr);
      }
    } catch (Exception e)
View Full Code Here

    String typeArg = "";
    String value = "";
    String tagName = "";

    Node node = att.getNamedItem("isprimary");
    try
    {
      classCV[0] = Class.forName(className);
      if (node != null)
      {
        argumentType[0] = Class.forName("java.lang.String");
        Method setPrim = classCV[0].getMethod("setIsPrimary", argumentType);
        arguments[0] = node.getNodeValue();
        setPrim.invoke(objectCV, arguments);
      }

      for (int i = 0; i < length; i++)
      {
View Full Code Here

TOP

Related Classes of org.w3c.dom.Node

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.