cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Bulk loading with carriage return in long text fields in the xml file

Michele_Babolin
11-Garnet

Bulk loading with carriage return in long text fields in the xml file

I am trying to bulk load Operations by using the LoadFromFile. The field LongDescription in most of the cases consists of multiline text. Below is the way the xml is currently being generated:

 

<csvBeginOperation handler="com.ptc.windchill.mpml.processplan.operation.LoadOperation.beginOperation">
<csvuser></csvuser>
<csvname>OP000001</csvname>
<csvnumber>OP000001</csvnumber>
<csvcategory>production</csvcategory>
<csvdescription>COIL LINE</csvdescription>
<csvlongDescription>REVIEW NEST OR CONTACT
NESTER FOR SHEAR LENGTH
INSTRUCTIONS.
UNIT IS SQFT
N-P</csvlongDescription>
<csvdefaultUnit>ea</csvdefaultUnit>
<csvfolder>/Default/Operations</csvfolder>

....

 

Unfortunately, the line break seems not to be recognized/detected.

 

I tried to replace the carriage return with "&#10;" (after reading a PTC document) but I had no luck

 

<csvlongDescription>REVIEW NEST OR CONTACT&#10;NESTER FOR SHEAR LENGTH&#10;INSTRUCTIONS.&#10;UNIT IS SQFT&#10;N-P</csvlongDescription>

 

I have tried also with "&#xA0;" and "&#160;" but they require to be declared in the xml and I am not sure this is the right way.

What am I missing?

ACCEPTED SOLUTION

Accepted Solutions

ok, apparently the real solution to have the carriage returns rendered in the UI is to use CDATA together with <br></br> :

 

<![CDATA[some stuff<br>some other stuff</br>here's other<br>and this is the final stuff</br>]]>

will return:

 

"some stuff
some other stuff
here's other
and this is the final stuff"

 

View solution in original post

3 REPLIES 3

The Character Data tag can be used for this …

<![CDATA[some stuff]]>

add it inside the description, then new lines can be written in the normal ways.

@rhart , thank you for your hint. Unfortunately this does not seem to resolve. Following is what I put in the xml:

 

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE NmLoader SYSTEM "standard12_1.dtd">

<NmLoader>
<csvBeginOperation handler="com.ptc.windchill.mpml.processplan.operation.LoadOperation.beginOperation">

<csvuser></csvuser>

<csvname>LONGTEXT7</csvname>

<csvnumber>LONGTEXT7</csvnumber>

<csvcategory>production</csvcategory>

<csvdescription>COIL LINE</csvdescription>

<csvlongDescription><![CDATA[REVIEW NEST OR CONTACT
NESTER FOR SHEAR LENGTH
INSTRUCTIONS.
UNIT IS SQFT
N-P]]></csvlongDescription>
<csvdefaultUnit>ea</csvdefaultUnit>
<csvfolder>/Default/Operations</csvfolder>

...

 

and this what was created

 

Michele_Babolin_0-1669629473088.png

 

ok, apparently the real solution to have the carriage returns rendered in the UI is to use CDATA together with <br></br> :

 

<![CDATA[some stuff<br>some other stuff</br>here's other<br>and this is the final stuff</br>]]>

will return:

 

"some stuff
some other stuff
here's other
and this is the final stuff"

 

Announcements


Top Tags