From 9b518dcdd98d694a4464895fce17a3c7a8caf569 Mon Sep 17 00:00:00 2001 From: Alex Clayton Date: Mon, 21 Mar 2016 16:22:56 +0000 Subject: Tidy XEP-0141 code As per swiften patch of the same name. This change addresses some feedback the previous XEP-0141 commit. Test-information: Unit tests stil pass. Change-Id: I3a9f9ec93b56352418f8288371bbd6874e01310d diff --git a/src/com/isode/stroke/elements/FormPage.java b/src/com/isode/stroke/elements/FormPage.java index b23a6e2..ffb35a9 100644 --- a/src/com/isode/stroke/elements/FormPage.java +++ b/src/com/isode/stroke/elements/FormPage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,6 @@ import java.util.Vector; public class FormPage { private String label_ = ""; - private String xmlns_ = ""; private Vector textElements_ = new Vector(); private Vector reportedRefs_ = new Vector(); private Vector childSections_ = new Vector(); @@ -32,7 +31,7 @@ public class FormPage { * Default Constructor. */ public FormPage() { - this.xmlns_ = "http://jabber.org/protocol/xdata-layout"; + } /** @@ -51,13 +50,6 @@ public class FormPage { } /** - * @return xmlns, Not Null. - */ - public String getXMLNS() { - return xmlns_; - } - - /** * @param textElement, Not Null. */ public void addTextElement(FormText textElement) { diff --git a/src/com/isode/stroke/parser/payloadparsers/FormParser.java b/src/com/isode/stroke/parser/payloadparsers/FormParser.java index ab14a4e..bbb04c0 100644 --- a/src/com/isode/stroke/parser/payloadparsers/FormParser.java +++ b/src/com/isode/stroke/parser/payloadparsers/FormParser.java @@ -38,7 +38,6 @@ public class FormParser extends GenericPayloadParser
{ private String currentText_ = ""; private String currentFieldRef_ = ""; private boolean parsingItem_ = false; - private boolean parseStarted_ = false; private boolean hasReportedRef_ = false; private FormText currentTextElement_; private FormReportedRef currentReportedRef_; @@ -242,15 +241,15 @@ public class FormParser extends GenericPayloadParser { else { if (currentPages_.size() > 0) { for (FormPage page : currentPages_) { - for (String pRef : page.getFieldRefs()) { - if (pRef.equals(currentField_.getName())) { + for (String pageRef : page.getFieldRefs()) { + if (pageRef.equals(currentField_.getName())) { page.addField(currentField_); } } } for (FormSection section : currentSections_) { - for (String sRef : section.getFieldRefs()) { - if (sRef.equals(currentField_.getName())) { + for (String sectionRef : section.getFieldRefs()) { + if (sectionRef.equals(currentField_.getName())) { section.addField(currentField_); } } @@ -270,7 +269,7 @@ public class FormParser extends GenericPayloadParser { sectionStack_.remove(sectionStack_.size()-1); } else if (sectionStack_.size() == 1) { - // Add the remaining section on the stack to it's parent page + // Add the remaining section on the stack to its parent page currentPage_.addChildSection(sectionStack_.get(sectionStack_.size()-1)); sectionStack_.remove(sectionStack_.size()-1); } diff --git a/src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java b/src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java index 262ba3d..4cd80c9 100644 --- a/src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java +++ b/src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java @@ -153,7 +153,7 @@ public class FormSerializer extends GenericPayloadSerializer { private XMLElement pageToXML(FormPage page) { XMLElement pageElement = new XMLElement("page"); - pageElement.setAttribute("xmlns", page.getXMLNS()); + pageElement.setAttribute("xmlns","http://jabber.org/protocol/xdata-layout"); if (!page.getLabel().isEmpty()) { pageElement.setAttribute("label", page.getLabel()); } -- cgit v0.10.2-6-g49f6