Nav XML Export CDATA

MrWhoMrWho Member Posts: 59
Hello!

I need some help finding out how I could get my xml document exported with a CDATA section with Nav XML Port. This is the result, I'm getting if I'm just adding <!CDATA[ + Text + ]]> in my code on OnBeforePassVariable in the XML Port.
<Description><![CDATA[ Hello, world ]]></Description>

I tried the MS XML Dom Automation - createCDATAsection, but probally I'm using it wrong, cause I'm trying to retrive only the value back, and then Nav crashes.. is this the only soloution? Any example on doing this?

Comments

  • jvanclevejvancleve Member Posts: 20
    I have a similar issue and was wondering if anyone had a solution. I am exporting an XMLport that will be picked up by another app. All the elements and data are coming from the NAV database, but I need to enclose the actual XMLport output in the CDATA term. So it's not just a single variable that needs to be enclosed, but part of the XML tree. Weird, I know, but that's what the destination app requires. We are running NAV 5.0.
    <xml>
       <![CDATA[
    	<Item>
    		<No.>ITEM-000001</No.>
    		<Description>lorem ipsum</Description>
    	</Item>
        ]]>
    </xml>
    
    Thanks!
    Jamison VanCleve
    
    
    
  • ara3nara3n Member Posts: 9,256
    I don't think it's possible with xmlport alone, but you can use xmlport to create the xml file. store the data in temporary blob. pass the blob to MSxmldom and add the <![CDATA[ element .
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • jvanclevejvancleve Member Posts: 20
    That's a good idea - I'll give it a try. Thanks ara3n!
  • jlandeenjlandeen Member Posts: 524
    You may encounter problems with accessing the data in CData sections via the XML Dom as it's not actually parsed by the XML Engine.

    When you use the createCDataSection did you follow that call up with an appendChild(<NewCDATANode>) call to the root XML document object?
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
Sign In or Register to comment.