https://bugs.documentfoundation.org/show_bug.cgi?id=169574

            Bug ID: 169574
           Summary: Data Provider dialog does not work with format XML
           Product: LibreOffice
           Version: 26.2.0.0 alpha0+ master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

This is the XML part of 169077. I have split the problems, because the
underlying code is different. HTML import is handled by an own part but XML
import is forwarded to Orcus library.

Description:
There exist unit tests for the feature "Data Provider". But they do not work,
if you do it manually by the dialog.

The test is
https://opengrok.libreoffice.org/xref/core/sc/qa/unit/dataproviders_test.cxx

The XML test file is
https://opengrok.libreoffice.org/xref/core/sc/qa/unit/data/dataprovider/xml/test1.xml
Download it, the opengrok page has a blue "Download" item.

To reproduce:
1. Open a new spreadsheet.
2. Define a database range "testDB" for the range A1:K11. That is menu Data >
Define Range
3. Start Data Provider dialog. That is menu Data > Data Provider.
4. Select "TestDB" from down-load list `Database Range`
5. Select "XML" form down-load list `Data Format`
6. Click on `Browse` button and find the downloaded file "test1.xml".
7. Click on `Apply` button. Error: No import in Preview.
8. Click on `OK` button. Error: No data imported.

The test uses
158      ScOrcusImportXMLParam aParam;
159  
160      ScOrcusImportXMLParam::RangeLink aRangeLink;
161      aRangeLink.maPos = ScAddress(0, 0, 0);
162      aRangeLink.maFieldPaths.push_back("/bookstore/book/title"_ostr);
163      aRangeLink.maFieldPaths.push_back("/bookstore/book/author"_ostr);
164      aRangeLink.maRowGroups.push_back("/bookstore/book"_ostr);
165      aParam.maRangeLinks.push_back(aRangeLink);
166   sets "maFieldPaths" and generates a ScOrcusImportXMLParam.

But in
https://opengrok.libreoffice.org/xref/core/sc/source/ui/dataprovider/xmldataprovider.cxx
it is only
65          ScOrcusImportXMLParam::RangeLink aRangeLink;
66          aRangeLink.maPos = ScAddress(0, 0, 0);
67          aRangeLink.maFieldPaths.push_back(OUStringToOString(maID,
RTL_TEXTENCODING_UTF8));
68          maParam.maRangeLinks.clear();
69          maParam.maRangeLinks.push_back(std::move(aRangeLink));

That means, that the string from the dialog (in maID) is not converted to
individual fields.

BTW, the import via menu Data > XML Source works. Use the recurring element
//book and link it to cell A1, for example.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to