Bug #10558
READ-XML does not populate the field with a XML prefix on SERIALIZABLE-NAME
100%
History
#2 Updated by Teodor Gorghe 10 months ago
We have the following testcase: TestSimpleReadXml.cls
You can notice in the code above that the tt2.f1 has a namespace prefix into the SERIALIZE-NAME. This is allowed on 4GL and there are no problems on FWD WRITE-XML.
The issue here is that the ctx.schema.columnMap gets populated with the SERIALIZE-NAME and while parsing the XML, it is checked only by the localname (which is the XML node name, but without the prefix) (check XmlImport.readRecord2). When the parser arrives at prefix:tt2, the localname is tt2, and ctx.schema.getColumn("tt2") is called, which returns null because tt2 is not in the hashtable, but prefix:tt2. This leads to partial XML import, leaving the field empty.
I think a check with the prefix should fix the issue.
#3 Updated by Teodor Gorghe 10 months ago
- Status changed from New to WIP
Created task branch 10558a.
#4 Updated by Teodor Gorghe 10 months ago
- Status changed from WIP to Review
- % Done changed from 0 to 100
- reviewer Constantin Asofiei added
Committed revision 16163 on task branch 10558a:
- Allow fields with XML prefix from a temp-table without NS-PREFIX to be deserialized.
#5 Updated by Constantin Asofiei 10 months ago
- Assignee set to Teodor Gorghe
10558a rev 16164 adds another case:
<?xml version="1.0"?>
<tt1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tt1Row>
<f1>0.123</f1>
</tt1Row>
</tt1>
can be read by:
def temp-table tt1 field f1 as dec xml-node-name "bb:f1".
temp-table tt1:read-xml("file", "a.xml", ?, ?, ?).
find first tt1.
message tt1.f1.
#6 Updated by Constantin Asofiei 10 months ago
- % Done changed from 100 to 90
But it can be read also by this:
def temp-table tt1 field f1 as dec xml-node-name "bb:rr".
temp-table tt1:read-xml("file", "a.xml", ?, ?, ?).
find first tt1.
message tt1.f1.
... so the fix is not completely correct.
#7 Updated by Teodor Gorghe 10 months ago
Constantin Asofiei wrote:
But it can be read also by this:
[...]
... so the fix is not completely correct.
I have done some test cases and I have found that the field is also matched by the field name.
I have also noticed that when XML-NODE-NAME has prefix and the local name is the same as the field name from XML, the matching does not occur. The testcase #10558-2 shows this, and a more simple case is showed below:
This returns 0 on 4GL, which confirms that the matching is based on the FIELD legacy name (
f1). When there is <prefix:f1>0.123</prefix:f1> this is matched, but also <ns:f1>0.123</ns:f1> is matched (when XML is valid, has the ns definition somewhere).
I have committed 16165 which addresses this issue.
#8 Updated by Teodor Gorghe 10 months ago
- % Done changed from 90 to 100
#9 Updated by Constantin Asofiei 9 months ago
This can be merged after 10519a.
#10 Updated by Constantin Asofiei 9 months ago
- Status changed from Review to Merge Pending
#11 Updated by Teodor Gorghe 9 months ago
- Status changed from Merge Pending to Test
Branch 10558a was merged to trunk rev. 16234 and archived.