Bug 153604 - XML Source skips field from the root element of the group
Summary: XML Source skips field from the root element of the group
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Kohei Yoshida
URL:
Whiteboard: target:7.6.0 target:7.5.2
Keywords:
Depends on:
Blocks: Data-XMLsource
  Show dependency treegraph
 
Reported: 2023-02-14 03:04 UTC by Kohei Yoshida
Modified: 2023-09-29 06:56 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Record selected, impossible to select cell to copy to (749.05 KB, image/png)
2023-09-28 09:18 UTC, Hurri39
Details
Field selected, you can choose cell to copy to (765.00 KB, image/png)
2023-09-28 09:19 UTC, Hurri39
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kohei Yoshida 2023-02-14 03:04:09 UTC
Description:
Calc's XML Source skips the field from the root element of the group.

Steps to Reproduce:
In Calc's XML Source dialog, open the following XML document

<?xml encoding="utf-8"?>
<root>
    <data>v1</data>
    <data>v2</data>
    <data>v3</data>
</root>

Select the "data" element and map it to any cell, and click Import.

Actual Results:
Nothing gets imported.

Expected Results:
Calc should import:

+------+
| data |
+------+
| v1   |
+------+
| v2   |
+------+
| v3   |
+------+


Reproducible: Always


User Profile Reset: No

Additional Info:
None
Comment 1 Kohei Yoshida 2023-02-14 03:11:58 UTC
A slightly more complex example.  Open the following XML document:

<?xml version="1.0"?>
<data version="1.1">
    <header label="TOP SECRET">Simple Data File</header>
    <entries>
        <entry id="1" first-name="Bill" last-name="Clinton" score="456">in</entry>
        <entry id="2" first-name="David" last-name="Cameron" score="323">out</entry>
        <entry id="3" first-name="Barak" last-name="Obama" score="234">unknown</entry>
        <entry id="4" first-name="Yoshihiko" last-name="Noda" score="192">in</entry>
        <entry id="5" first-name="Angela" last-name="Merkel" score="210">ask later</entry>
    </entries>
    <footer date="2012-08-12">
        <extra>Not for distribution</extra>
    </footer>
</data>

in XML Source, and select "entry" element which should automatically select all its child attributes.  But when you import this, you won't get the data from the root "entry" element even though the element contains values.
Comment 2 Kohei Yoshida 2023-02-14 03:19:47 UTC
This should fix it: https://gerrit.libreoffice.org/c/core/+/146966
Comment 3 Commit Notification 2023-02-14 04:10:37 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4d9a8f07b77917b0756dc2d8d8082c6e63e560a2

tdf#153604: include the root element when traversing the tree

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Kohei Yoshida 2023-02-14 04:11:37 UTC
Fixed on master.
Comment 5 Commit Notification 2023-02-14 14:27:00 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c83516b378a1587fd099b550d046c89841e8add9

tdf#153604: sc: Add UItest

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2023-02-14 20:15:38 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/bad4f41a69fe3fb08191b839f0c9389683685855

tdf#153604: include the root element when traversing the tree

It will be available in 7.5.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Hurri39 2023-09-28 09:17:14 UTC
When trying to import an XML file in Calc, using menu "Data" -> "XML Source", we cannot select the entire record, only individual fields.
In earlier releases (I cannot tell in which one this was broken), we could select the record, then click on the cell where to copy data.

Selecting the record level does not allow to choose the cell where to copy data. 
Selecting a simple field allow to choose the cell, but of course only this field is copied.

See screenshots examples.
I think this bug report should be re-opened.
Comment 8 Hurri39 2023-09-28 09:18:43 UTC
Created attachment 189858 [details]
Record selected, impossible to select cell to copy to
Comment 9 Hurri39 2023-09-28 09:19:46 UTC
Created attachment 189859 [details]
Field selected, you can choose cell to copy to
Comment 10 ady 2023-09-28 23:01:38 UTC
@Hurri39,
Perhaps it would be better to start a new bug report with that info, adding this bug 153604 to the "See also" field in that new report.