export Carriage Return with XML DOM?

jversusjjversusj Member Posts: 489
hello all,
if you have followed my recent threads, I have been working on an XMLDOM output of a customer product catalog. We are bringing up one of our divisions (currently on Oracle) on to NAV, so I am building a solution to fit an existing data structure.

I have 90% of this complete and recently began working on outputting product family description information in my xml product catalogs. This description is historically under 1000 chars long, but greater than 250. I have created a Product family table and a product family description table in a header/lines relationship. I am using Notepad integration with NAV to edit the description to properly maintain carriage returns, etc. in the data. This essentially populates as many lines as are needed to define the description, with a boolean field (carriage return) to capture if the line ends with CR.

In my XMLDOM code, i retrieve/loop my lines and use ADDTEXT to put them into a bigtext variable, including an Addtext of a CR when needed. After completing the loop, i use GETSUBTEXT to copy out the first 1024 characters into a text variable. I then output this variable in my xmldom code. When i view the resulting XML, the carriage returns are gone.

What can i do differently to output my family description as formatted in the XMLDOM? I am using the AddElement function in XML DOM codeunit to create my node text.

thanks in advance!
kind of fell into this...

Comments

  • vaprogvaprog Member Posts: 1,139
    Please have a look at the preserveWhiteSpace property of the xmlDOM automation object and/or use xml:space="preserve" attributes.
  • jversusjjversusj Member Posts: 489
    vaprog wrote:
    Please have a look at the preserveWhiteSpace property of the xmlDOM automation object and/or use xml:space="preserve" attributes.
    Thank you for the suggestion. I have tried adding the xml:space="preserve" attribute but my carriages returns still appear to be lost. when viewing the XML.

    If i take my xml file and change the extension to .txt and view in notepad, my CR are present, but viewing in IE /Chrome they are absent.

    Oh well, I have asked the web team if the CR are really that important. If they are not, I will not worry any more about it. Thanks again!
    kind of fell into this...
  • ta5ta5 Member Posts: 1,164
    Hello
    Just my 2 cents:
    I had this discussion a few times with senders or recipients of xml files. At the end the conclusion was always that crlf is not important for xml and normally the xml's are viewed either with IE or a tool like xmlSpy, both do not need crlf for a proper look.
    Regards
    Thomas
Sign In or Register to comment.