Package com.google.gwt.xml.client

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


    parentElement.appendChild(representationElement);
  }
 
  private void createFaultElement(FaultNode fault, Element parentElement) {
    // faultChildren = {paramNode, docNode}
    Element faultElement = wadl.createElement(faultNode);
   
    // <fault>
    if (fault.getHref() != null) {
      faultElement.setAttribute(fault_href, fault.getHref());
    }
    else {     
      if (!fault.getMediaType().equals("")) faultElement.setAttribute(fault_mediaType, fault.getMediaType());
      if (!fault.getElement().equals("")) faultElement.setAttribute(fault_element, fault.getElement());
      if (!fault.getStatus().equals("")) faultElement.setAttribute(fault_status, fault.getStatus());
      if (!fault.getProfile().equals("")) faultElement.setAttribute(fault_profile, fault.getProfile());
      if (fault.getId() != null) faultElement.setAttribute(fault_id, fault.getId());
    }   
   
    // <doc>
    createDocElements(fault.getAllDocs(), faultElement);
   
View Full Code Here


    public boolean visitCollectionProperty(String propertyName, AutoBean<Collection<?>> value,
        CollectionPropertyContext ctx) {
      assertValidPath(propertyName);
      List<String> subtags = Arrays.asList(propertyName.split("/"));
      List<String> childrenPath = subtags.subList(0, subtags.size() - 1);
      Element elt = getCurrentParent();
      for (String tag : childrenPath) {
        Element next = doc.createElement(tag);
        elt.appendChild(next);
        elt = next;
        currentPath.push(next);
      }
      String tag = subtags.get(subtags.size() - 1);
      for (Object v : value.as()) {
        if (v == null) {
          continue;
        }
        Element next = doc.createElement(tag);
        elt.appendChild(next);
        currentPath.push(next);
        AutoBeanUtils.getAutoBean(v).accept(this);
        currentPath.pop();
      }
View Full Code Here

        //skip null values, don't create new tags or attributes
        return false;
      }
      assertValidPath(propertyName);
      String[] subtags = propertyName.split("/");
      Element elt = getCurrentParent();
      for (String tag : subtags) {
        Element next = doc.createElement(tag);
        elt.appendChild(next);
        elt = next;
        currentPath.push(elt);
      }
View Full Code Here

      if ("".equals(propertyName)) {
        getCurrentParent().appendChild(doc.createTextNode(String.valueOf(value)));
        return true;
      }
      String[] subtags = propertyName.split("/");
      Element elt = getCurrentParent();
      String attr = null;
      for (int i = 0; i < subtags.length; i++) {
        if (subtags[i].startsWith("@")) {
          assert i + 1 == subtags.length;// this should be caught by the regex
          attr = subtags[i].substring(1);
          break;
        }
        Element next = doc.createElement(subtags[i]);
        elt.appendChild(next);
        elt = next;
      }
      if (attr != null) {
        // TODO better encoding?
View Full Code Here

     * @param childName The name of the child to inspect (tag name).
     * @param defaultValue The value that will be returned if the child element was not found.
     * @return The text value of the requested child, or {@code null} if the child doesn't exist or if it doesn't hold any text.
     */
    public static String getSingleChildValue(Element parent, String childName, String defaultValue) {
        Element child = getSingleChild(parent, childName);
        if (child == null) {
            return defaultValue;
        }
        return getTextValue(child, "");
    }
View Full Code Here

        Boolean value = getSingleChildBooleanValue(parent, childName);
        return value == null ? defaultValue : value;
    }

    public static String getSingleChildAttribute(Element parent, String childName, String attributeName) {
        Element child = getSingleChild(parent, childName);
        if (child == null) {
            return null;
        }
        return child.getAttribute(attributeName);
    }
View Full Code Here

        final Payload payload = new Payload();

        Document messageDom = XMLParser.parse(message);
        NodeList statements = messageDom.getElementsByTagName("it.freedomotic.reactions.Statement");
        for (int i = 0; i < statements.getLength(); i++) {
            Element statement = (Element) statements.item(i);
            payload.enqueueStatement(parseStatement(statement));
        }
        return payload;
    }
View Full Code Here

    final Payload payload = new Payload();
   
    Document messageDom = XMLParser.parse(message);   
    NodeList statements = messageDom.getElementsByTagName("it.freedomotic.reactions.Statement");           
    for (int i = 0; i < statements.getLength(); i++) {
      Element statement = (Element)statements.item(i);
       payload.enqueueStatement(parseStatement(statement));    
     }       
        return payload;                          
  }
View Full Code Here

       
        NodeList sprites = infoDom.getElementsByTagName("sprite");
        PU_Resources.this.mSpriteCount = sprites.getLength();
        for(int i = 0; i < sprites.getLength(); i++)
        {
          Element element = (Element) sprites.item(i);
         
          String name = element.getAttribute("n");
         
          PU_Rect texCoords = new PU_Rect();
          texCoords.x = Integer.parseInt(element.getAttribute("x"));
          texCoords.y = Integer.parseInt(element.getAttribute("y"));
          texCoords.width = Integer.parseInt(element.getAttribute("w"));
          texCoords.height = Integer.parseInt(element.getAttribute("h"));
         
          int offsetX = 0;
          if(element.hasAttribute("oX"))
            offsetX = Integer.parseInt(element.getAttribute("oX"));
         
          int offsetY = 0;
          if(element.hasAttribute("oY"))
            offsetY = Integer.parseInt(element.getAttribute("oY"));
         
          int width = texCoords.width;
          if(element.hasAttribute("oW"))
            width = Integer.parseInt(element.getAttribute("oW"));
         
          int height = texCoords.height;
          if(element.hasAttribute("oH"))
            height = Integer.parseInt(element.getAttribute("oH"));
         
          PU_Image spriteImage = new PU_Image(width, height, null);
          spriteImage.setTextureCoords(texCoords, image.getWidth(), image.getHeight());
          spriteImage.setOffsetX(offsetX);
          spriteImage.setOffsetY(offsetY);
View Full Code Here

       
        NodeList sprites = infoDom.getElementsByTagName("sprite");
        PU_Resources.this.mPokemonCount = sprites.getLength();
        for(int i = 0; i < sprites.getLength(); i++)
        {
          Element element = (Element) sprites.item(i);
         
          String name = element.getAttribute("n");
         
          PU_Rect texCoords = new PU_Rect();
          texCoords.x = Integer.parseInt(element.getAttribute("x"));
          texCoords.y = Integer.parseInt(element.getAttribute("y"));
          texCoords.width = Integer.parseInt(element.getAttribute("w"));
          texCoords.height = Integer.parseInt(element.getAttribute("h"));
         
          int offsetX = 0;
          if(element.hasAttribute("oX"))
            offsetX = Integer.parseInt(element.getAttribute("oX"));
         
          int offsetY = 0;
          if(element.hasAttribute("oY"))
            offsetY = Integer.parseInt(element.getAttribute("oY"));
         
          int width = texCoords.width;
          if(element.hasAttribute("oW"))
            width = Integer.parseInt(element.getAttribute("oW"));
         
          int height = texCoords.height;
          if(element.hasAttribute("oH"))
            height = Integer.parseInt(element.getAttribute("oH"));
         
          PU_Image spriteImage = new PU_Image(width, height, null);
          spriteImage.setTextureCoords(texCoords, image.getWidth(), image.getHeight());
          spriteImage.setOffsetX(offsetX);
          spriteImage.setOffsetY(offsetY);
View Full Code Here

TOP

Related Classes of com.google.gwt.xml.client.Element

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.