Package com.google.gwt.xml.client

Examples of com.google.gwt.xml.client.Node


        private boolean isLinkBelongToFeed(@Nonnull final Node node) {
            return node.getParentNode() != null && FEED_TAG.equals(node.getParentNode().getNodeName());
        }

        private void setLink(@Nonnull final Node node) {
            Node typeNode = node.getAttributes().getNamedItem(TYPE_ATTRIBUTE);
            Node urlNode = node.getAttributes().getNamedItem(URL_ATTRIBUTE);

            if (typeNode != null && urlNode != null) {
                String typeValue = typeNode.getNodeValue();
                String urlValue = urlNode.getNodeValue();

                if (FIRST_LINK.equals(typeValue)) {
                    first = urlValue;
                } else if (PREVIOUS_LINK.equals(typeValue)) {
                    previous = urlValue;
View Full Code Here


            this.entryNode = entryNode;
        }

        @Nullable
        private String getTagValue(@Nonnull final String tagName) {
            Node node = getUniqueElementByTagName(tagName);

            return node != null ? getTextValue(node) : null;
        }
View Full Code Here

            return nodes.getLength() == 1 ? nodes.item(0) : null;
        }

        @Nullable
        private String getTextValue(@Nonnull final Node node) {
            Node child = node.getFirstChild();

            if (child != null && child.getNodeType() == TEXT_NODE) {
                return child.getNodeValue();
            }

            return null;
        }
View Full Code Here

            this.entryNode = entryNode;
        }

        @Nullable
        private String getTagValue(@Nonnull final String tagName) {
            Node node = getUniqueElementByTagName(tagName);

            return node != null ? getTextValue(node) : null;
        }
View Full Code Here

            return nodes.getLength() == 1 ? nodes.item(0) : null;
        }

        @Nullable
        private String getTextValue(@Nonnull final Node node) {
            Node child = node.getFirstChild();

            if (child != null && child.getNodeType() == TEXT_NODE) {
                return child.getNodeValue();
            }

            return null;
        }
View Full Code Here

    this.modelType = modelType;
  }

  public ListLoadResult read(C loadConfig, Object data) {
    Document doc = XMLParser.parse((String) data);
    Node root = doc.getFirstChild();
    NodeList list = doc.getElementsByTagName(modelType.recordName);
    ArrayList<BaseModel> records = new ArrayList<BaseModel>();
    for (int i = 0; i < list.getLength(); i++) {
      Node node = list.item(i);
      Element elem = (Element) node;
      BaseModel model = new BaseModel();
      for (int j = 0; j < modelType.getFieldCount(); j++) {
        DataField field = modelType.getField(j);
        String map = field.map != null ? field.map : field.name;
        String v = getValue(elem, map);
        model.set(field.name, v);
      }
      records.add(model);
    }

    int totalCount = records.size();

    if (modelType.totalName != null) {
      Node totalNode = root.getAttributes().getNamedItem(modelType.totalName);
      if (totalNode != null) {
        String sTot = totalNode.getNodeValue();
        totalCount = Integer.parseInt(sTot);
      }
    }

    return new BasePagingLoadResult(records, 0, totalCount);
View Full Code Here

  private void parseMessage(Document messageDom) {
    try {
      // parse the XML document into a DOM
      // Document messageDom = XMLParser.parse(messageXml);

      Node dataSetNode = messageDom.getElementsByTagName("dataset").item(
          0);
      List<Node> dataSetNodeChildren = DOMUtil
          .getChildElements(dataSetNode.getChildNodes());
      List<DataEntry> results = new ArrayList<DataEntry>();

      for (Node dataNode : dataSetNodeChildren) {
        DataEntry dataEntry = new DataEntry();
        NamedNodeMap dataNodeAttributes = dataNode.getAttributes();

        Node valueNode = DOMUtil.getChildElements(
            dataNode.getChildNodes()).get(0); // expected to have
                              // just one child‚
        NamedNodeMap valueNodeAttributes = valueNode.getAttributes();

        dataEntry.key = dataNodeAttributes.getNamedItem("key")
            .getNodeValue();
        dataEntry.java = dataNodeAttributes.getNamedItem("javaType")
            .getNodeValue();
        dataEntry.xsd = valueNodeAttributes.getNamedItem("xsi:type")
            .getNodeValue();

        List<Node> valueChildElements = DOMUtil
            .getChildElements(valueNode.getChildNodes());

        if (valueChildElements.isEmpty()
            && valueNode.hasChildNodes()
            && Node.TEXT_NODE == valueNode.getChildNodes().item(0)
                .getNodeType()) {
          dataEntry.value = valueNode.getFirstChild().getNodeValue();
        } else {
          // complex types or empty elements
          dataEntry.value = "n/a";
        }
View Full Code Here

              boolean promptForOptions = false;
              Document children = XMLParser.parse( getChildrenResponse.getText() );
              NodeList childrenNameNodes = children.getElementsByTagName( NAME_NODE_TAG );
              List<String> childNames = new ArrayList<String>();
              for ( int i = 0; i < childrenNameNodes.getLength(); i++ ) {
                Node childNameNode = childrenNameNodes.item( i );
                childNames.add( childNameNode.getFirstChild().getNodeValue() );
              }

              for ( SolutionBrowserFile file : clipboardFileItems ) {
                if ( file.getPath() != null ) {
                  String pasteFileParentPath = file.getPath();
View Full Code Here

    List<String> names = new ArrayList<String>();
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      NodeList recipientTypeList = ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME );
      Node recipientNode = recipientTypeList.item( 0 );
      String nodeValue = recipientNode.getFirstChild().getNodeValue();
      int recipientType = Integer.parseInt( nodeValue );
      if ( recipientType == type ) {
        names.add( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue() );
      }
    }
View Full Code Here

   * @param grant     true = grant the Permission, false = deny the Permission (remove it if present)
   * @param perm      The integer value of the Permission as defined in <code>RepositoryFilePermissions</code>
   */
  private void updatePermissionForUserOrRole( Document fileInfo, String recipient, String recipientType, boolean grant, int perm ) {
    // first let's see if this node exists
    Node foundPermission = null;
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) && ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        NodeList permissions = ace.getElementsByTagName( PERMISSIONS_ELEMENT_NAME );
        for ( int j = 0; j < permissions.getLength(); j++ ) {
          Node testNode = permissions.item( j );
          if ( testNode.getFirstChild() != null && Integer.parseInt( testNode.getFirstChild()
              .getNodeValue() ) == perm ) {
            foundPermission = testNode;
            break;
          }
        }
View Full Code Here

TOP

Related Classes of com.google.gwt.xml.client.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.