Skip to main content
11-Garnet
November 25, 2022
Solved

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

  • November 25, 2022
  • 1 reply
  • 1449 views

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?

Best answer by Michele_Babolin

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"

 

1 reply

16-Pearl
November 26, 2022

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.

11-Garnet
November 28, 2022

@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