Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Match case when finding xml element (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggalmazor authored Aug 21, 2019
1 parent 3feb3b7 commit 7fc941c
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/org/opendatakit/briefcase/export/XmlElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public Optional<XmlElement> findElement(String name) {
public List<XmlElement> findElements(String... namesArray) {

if (namesArray.length == 1)
return childrenOf().stream().filter(e -> e.getName().equalsIgnoreCase(namesArray[0])).collect(Collectors.toList());
return childrenOf().stream().filter(e -> e.getName().equals(namesArray[0])).collect(Collectors.toList());
// Shift the first element on array
List<String> names = Arrays.asList(namesArray);
return findElement(names.get(0))
Expand Down Expand Up @@ -250,7 +250,7 @@ public List<XmlElement> childrenOf() {
}

private boolean hasName(String name) {
return element.getName().equalsIgnoreCase(name);
return element.getName().equals(name);
}

private boolean isFirstLevelGroup() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2018 Nafundi
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package org.opendatakit.briefcase.export;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class ExportToCsvCaseSensitivityTest {
private ExportToCsvScenario scenario;

@Before
public void setUp() {
scenario = ExportToCsvScenario.setUp("simple-form-case-sensitivity");
}

@After
public void tearDown() {
scenario.tearDown();
}

@Test
public void exports_forms_with_all_data_types() {
scenario.runExport();
scenario.assertSameContent();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<data id="simple-form-case-sensitivity" instanceID="uuid:0a1b861f-a5fd-4f49-846a-78dcf06cfc1b" version="2018012404" submissionDate="2018-02-01T11:35:19.178Z" isComplete="true" markedAsCompleteDate="2018-02-01T11:35:19.178Z" xmlns="http://opendatakit.org/submissions">
<field>Some value</field>
<Field>2019-01-01T00:00:00.000Z</Field>
<n0:meta xmlns:n0="http://openrosa.org/xforms">
<n0:instanceID>uuid:0a1b861f-a5fd-4f49-846a-78dcf06cfc1b</n0:instanceID>
</n0:meta>
</data>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SubmissionDate,field,Field,meta-instanceID,KEY
"Feb 1, 2018 11:35:19 AM",Some value,"Jan 1, 2019 12:00:00 AM",uuid:0a1b861f-a5fd-4f49-846a-78dcf06cfc1b,uuid:0a1b861f-a5fd-4f49-846a-78dcf06cfc1b
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml">
<h:head>
<h:title>Simple form</h:title>
<model>
<instance>
<data id="simple-form-case-sensitivity">
<field/>
<Field/>
<meta>
<instanceID/>
</meta>
</data>
</instance>
<itext>
<translation lang="English">
</translation>
</itext>
<bind nodeset="/data/meta/instanceID" type="string" readonly="true()" calculate="concat('uuid:', uuid())"/>
<bind nodeset="/data/field" type="string"/>
<bind nodeset="/data/Field" type="dateTime"/>
</model>
</h:head>
<h:body>
<input ref="/data/field"/>
<input ref="/data/Field"/>
</h:body>
</h:html>

0 comments on commit 7fc941c

Please sign in to comment.