Hi!
I'm using XML_WRITER to create dynamic metadata from XML_XPATH_READER. The problem occurs when I want to write SPACE as fieldDelimiter; it loses it's content during the data propagation.
XML_XPATH_READER
XML_WRITER:
Result:
I'm using XML_WRITER to create dynamic metadata from XML_XPATH_READER. The problem occurs when I want to write SPACE as fieldDelimiter; it loses it's content during the data propagation.
XML_XPATH_READER
...
<!-- Record delimiter -->
<Context xpath="parameter[@name='Delimiter']" outPort="0">
<Mapping xpath="replace(text(),'SPACE', ' ')" cloverField="fieldDelimiter"/> <!-- the 'SPACE' value comes from external XML -->
</Context>
...
<Context xpath="parameter[@name='InputFields']/inputfield" outPort="1">
<Mapping xpath="@fieldname" cloverField="name"/>
</Context>
....
XML_WRITER:
<Mapping
inPort="0"
element="Record"
key="keyID"
fieldsAs="attributes"
fieldsIgnore="keyID">
<Mapping
inPort="1"
element="Field"
key="name"
keyToParent="keyID"
fieldsAs="attributes"
fieldsIgnore="keyID">
</Mapping>
</Mapping>
Result:
<?xml version="1.0" encoding="UTF-8"?>
<Record fieldDelimiter="" recordDelimiter="\n" name="L1_51_B1" type="delimited"> <!-- yeep, no space in fieldDelimiter :( -->
<Field name="Rows_ident" type="string"/>
<Field name="tToken_1" type="string"/>
<Field name="tToken_2" type="string"/>
<Field name="tToken_3" type="string"/>
<Field name="tToken_4" type="string"/>
<Field name="tToken_5" type="string"/>
<Field name="tToken_6" type="string"/>
</Record>
-
We will investigate this, nonetheless you may try to use Unicode/XML escape/numeric code for "space" - which is 32 decimal.
The escape sequence has form: &#nnnn; where "nnnn" is decimal code of the character. -
Hello,
XML_XPATH_READER trims white spaces from text by default.
Set "trim" attribute in your mapping to switch it off.
Like this:
<Mapping xpath="replace(text(),'SPACE', ' ')" cloverField="fieldDelimiter" trim="false" />
------------------
Martin Varecha
Javlin, a.s.
martin.varecha@javlin.eu -
Hi!
Thank you for an answer. It works as a combination of no trim and escape charakter, plus i had to replece NL char which was given with trim=false option.
<Mapping xpath="replace(replace(text(),'SPACE', '& #32;'), '& #10;', '')" cloverField="fieldDelimiter" trim="false"/>
Best regards
Please sign in to leave a comment.
Comments 3