Java Code Examples for org.jivesoftware.smackx.xdata.packet.DataForm#getField()
The following examples show how to use
org.jivesoftware.smackx.xdata.packet.DataForm#getField() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataValidationTest.java From Smack with Apache License 2.0 | 5 votes |
@ParameterizedTest @EnumSource(SmackTestUtil.XmlPullParserKind.class) public void testNamespacePrefix(SmackTestUtil.XmlPullParserKind parserKind) throws Exception { String formFieldUsingNamespacePrefix = "<x xmlns='jabber:x:data'" + " xmlns:xdv='http://jabber.org/protocol/xdata-validate'" + " type='form'>" + " <title>Sample Form</title>" + " <instructions>" + " Please provide information for the following fields..." + " </instructions>" + " <field type='text-single' var='name' label='Event Name'/>" + " <field type='text-single' var='date/start' label='Starting Date'>" + " <xdv:validate datatype='xs:date'>" + " <basic/>" + " </xdv:validate>" + " </field>" + " <field type='text-single' var='date/end' label='Ending Date'>" + " <xdv:validate datatype='xs:date'>" + " <basic/>" + " </xdv:validate>" + " </field>" + "</x>"; DataForm dataForm = SmackTestUtil.parse(formFieldUsingNamespacePrefix, DataFormProvider.class, parserKind); assertEquals("Sample Form", dataForm.getTitle()); FormField nameField = dataForm.getField("name"); assertEquals("Event Name", nameField.getLabel()); FormField dataStartField = dataForm.getField("date/start"); ValidateElement dataStartValidateElement = ValidateElement.from(dataStartField); assertEquals("xs:date", dataStartValidateElement.getDatatype()); assertTrue(dataStartValidateElement instanceof BasicValidateElement); }
Example 2
Source File: FileTransferNegotiator.java From Smack with Apache License 2.0 | 4 votes |
private static ListSingleFormField getStreamMethodField(DataForm form) { return (ListSingleFormField) form.getField(STREAM_DATA_FIELD_NAME); }