Santosh.'s profileDynamics AxPhotosBlogLists Tools Help

Blog


    October 16

    Get File Encoding in Dynamics AX using X++

     

    Hi All,

    Recently there was an interesting query from one of the technical forum.

    Publisher: http://objectmix.com/axapta/789064-get-file-encoding.html

    Question: How to get encoding file format from xml in Dynamics AX?

    Answer: I have created a small class which would retrieve the encoding format of an Xml.

    Approach Followed:

    ·         Class receives input file as string.

    ·         Based on the input file, the XmlReader is initialized.

    ·         Xml is read using read () method from XmlReader

    ·         When xmlReader.name () is equal to the XmlEncodingAttribute then encoding format is returned.

    Path: http://cid-264a0056cbcbb1d3.skydrive.live.com/self.aspx/.Public/Class%5E_RetriveXMLEncodingFormat.xpo

    Second part of question is possible convert it to ANSI before reading?

    Instead of trying to convert a file in ANSI it would be better we use Binary class to read and write data in the binary format even though if there is special character in the file.  Since reading with ASCIIIO will only support NON ASCI character so binary is the better option.

    Here is the sample example using BinData kernel class:

    Happy DaxingggggggggLeft hugRight hug

    Comments (2)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Santosh. Rwrote:
    Thanks Dilip [:)]
    Nov. 6
    dilip nairwrote:
    Hey Santosh, Dilip here from http://daxdilip.blogspot.com/

    Nice one dude :-), A more detailed usage of Bindata. Thanks for the post and keep posting. I will add your blog to my list.
    Nov. 5

    Trackbacks

    The trackback URL for this entry is:
    http://sangi1983.spaces.live.com/blog/cns!264A0056CBCBB1D3!380.trak
    Weblogs that reference this entry
    • None