Package com.google.gwt.xml.client

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


    public Dialog unmarshall(String xml)
    {

        try {
            Document document = XMLParser.parse(xml);
            Element root = document.getDocumentElement();

            // model
            Builder builder = new Builder();
            dfsElement(builder, DOMUtils.getFirstChildElement(root));
View Full Code Here


  public XmlReader(ModelType modelType) {
    this.modelType = modelType;
  }

  public ListLoadResult read(C loadConfig, Object data) {
    Document doc = XMLParser.parse((String) data);

    NodeList list = doc.getElementsByTagName(modelType.recordName);
    ArrayList<ModelData> records = new ArrayList<ModelData>();
    for (int i = 0; i < list.getLength(); i++) {
      Node node = list.item(i);
      Element elem = (Element) node;
      ModelData model = newModelInstance();
      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();

    Node root = doc.getElementsByTagName(modelType.root).item(0);
    if (root != null && modelType.totalName != null) {
      Node totalNode = root.getAttributes().getNamedItem(modelType.totalName);
      if (totalNode != null) {
        String sTot = totalNode.getNodeValue();
        totalCount = Integer.parseInt(sTot);
View Full Code Here

    if (responseTxt == null) {
      return;
    }
   
    String error = null;
    Document doc = null;
    try {
      doc = XMLParser.parse(responseTxt);
      error = Utils.getXmlNodeValue(doc, "error");
    } catch (Exception e) {
      if (responseTxt.toLowerCase().matches("error")) {
View Full Code Here

     *
     * @param responseText The XML response.
     * @return a list of task definition references.
     */
    public List<TaskRef> readTasks(String responseText) {
        Document xml = XMLParser.parse(responseText);
        List<TaskRef> retval = null;
        NodeList list = xml.getElementsByTagName("task");
        if (list != null) {
            retval = new ArrayList<TaskRef>(list.getLength());
            for (int index = 0; index < list.getLength(); index++) {
                Element elem = (Element) list.item(index);
                TaskRef ref = new TaskRef();
View Full Code Here

     *
     * @param responseText The XML response.
     * @return a list of menuOptions.
     */
    public List<MainMenuOption> readMenuOptions(String responseText) {
        Document xml = XMLParser.parse(responseText);
        NodeList menuOptions = xml.getElementsByTagName("menuOptions").item(0).getChildNodes();
        return readMenuOptions(menuOptions);
    }
View Full Code Here

     *
     * @param responseText the XML response.
     * @return a list of FormRepresentation items.
     */
    public List<FormRepresentation> readForms(String responseText) {
        Document xml = XMLParser.parse(responseText);
        NodeList list = xml.getElementsByTagName("json");
        List<FormRepresentation> retval = new ArrayList<FormRepresentation>();
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        if (list != null) {
            for (int index = 0; index < list.getLength(); index++) {
                Node node = list.item(index);
View Full Code Here

     *
     * @param responseText the XML response.
     * @return a map of lists of FBMenuItem instances.
     */
    public Map<String, List<FBMenuItem>> readMenuMap(String responseText) {
        Document xml = XMLParser.parse(responseText);
        Map<String, List<FBMenuItem>> menuItems = new HashMap<String, List<FBMenuItem>>();
        NodeList groups = xml.getElementsByTagName("menuGroup");
        for (int index = 0; index < groups.getLength(); index++) {
            Node groupNode = groups.item(index);
            String groupName = ((Element) groupNode).getAttribute("name");
            NodeList items = ((Element) groupNode).getElementsByTagName("menuItem");
            menuItems.put(groupName, readMenuItems(items, groupName));
View Full Code Here

     * </code>
     * @param responseText XML response to parse
     * @return a map of the string values indexed by property name
     */
    public Map<String, String> readPropertyMap(String responseText) {
        Document xml = XMLParser.parse(responseText);
        Map<String, String> retval = new HashMap<String, String>();
        NodeList list = xml.getElementsByTagName("property");
        for (int index = 0; index < list.getLength(); index++) {
            Element propElement = (Element) list.item(index);
            String key = propElement.getAttribute("key");
            String value = propElement.getAttribute("value");
            retval.put(key, value);
View Full Code Here

     * </code>
     * @param responseText XML response to parse
     * @return a list of validation items
     */
    public List<FBValidationItem> readValidations(String responseText) throws Exception {
        Document xml = XMLParser.parse(responseText);
        NodeList validationList = xml.getElementsByTagName("validation");
        List<FBValidationItem> retval = new ArrayList<FBValidationItem>();
        for (int index = 0; index < validationList.getLength(); index++) {
            Element valElement = (Element) validationList.item(index);
            String klass = valElement.getAttribute("className");
            Object obj = ReflectionHelper.newInstance(klass);
View Full Code Here

        }
        return options;
    }

    private String textOfFirstNode(String responseText, String tagName) {
        Document xml = XMLParser.parse(responseText);
        Node node = xml.getElementsByTagName(tagName).item(0);
        return getText(node);
    }
View Full Code Here

TOP

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

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.