none
DataSet.WriteToXML Method, Same characters are converted into a Code even these are not XML restricted characters.

    Question

  • As per W3c, XML elements must follow these naming rules:

    • Names can contain letters, numbers, and other characters
    • Names cannot start with a number or punctuation character
    • Names cannot start with the letters xml (or XML, or Xml, etc)
    • Names cannot contain spaces, <, >, &

    As per above rules, conversion of chars like (spaces, <, >, &)  to hex code is understandable but why others are being converted?

    After some RnD, I found following are avoidable XML names(as they can have multiple meanings e.g. – also represents Minus and during parsing deduction can be applied), therefore these are converted into a code/hex code

    HTML Entities

    Char

    x0020

    SPACE

    x0021

    !

    x0022

    "

    x0023

    #

    x0024

    $

    x0025

    %

    x0026

    &

    x0027

    '

    x0028

    (

    x0029

    )

    x002A

    *

    x002B

    +

    x002C

    ,

    x002D

    -

    x002E

    .

    x002F

    /

    x003A

    :

    x003B

    ;

    x003C

    < 

    x003D

    =

    x003E

    > 

    x003F

    ?

    x0040

    @

    x005B

    [

    x005C

    \

    x005D

    ]

    x005E

    ^

    x005F

    _

    x0060

    `

    x007B

    {

    x007C

    |

    x007D

    }

    x007E

    ~

    x0082

    x0084

    x0085

    ……

    x0088

    ˆ

    x0091

    x0092

    http://www.calcresult.com/reference/text/unicode-list.html

    I am not able to find out the Guide Lines/Rules on any authenticated Site where list of unavoidable/restricted Chars are clearly mentioned, needed help to find out the same.



    AnilKr

    Wednesday, June 19, 2013 6:41 AM

All replies

  • Can you please post an example of your Dataset and some demo dataset fill. So we'll be able to have data and test xml conversion.

    Thanks.


    Please Mark as Answer and Vote as Helpful if I helped.

    Also please visit my blog http://msguy.net/

    Wednesday, June 19, 2013 7:08 AM
  • Public Class frmMain
    
    	Private Sub btnRule_Click(sender As System.Object, e As System.EventArgs) Handles btnRule.Click
    
    		lblXml.Text = String.Format("Encode Local Name:{0}      |      Encoded Name:{1}", Xml.XmlConvert.EncodeLocalName(txtXML.Text), Xml.XmlConvert.EncodeName(txtXML.Text))
    
    		lblDXML.Text = String.Format("Decoded Local Name:{0}    |       Decoded Name:{1}", Xml.XmlConvert.DecodeName(Xml.XmlConvert.EncodeLocalName(txtXML.Text)), Xml.XmlConvert.DecodeName(Xml.XmlConvert.EncodeName(txtXML.Text)))
    
    	End Sub
    
    	Private Sub btnClose_Click(sender As System.Object, e As System.EventArgs) Handles btnClose.Click
    		Me.Close()
    	End Sub
    
    	
    
    
    End Class

    Its XML Encoding which is used during writeToXML, Create a winform project of above for more.

    If a Column Name of DataTable will have a special char (not alphanumeric ) then XML encoding is performed on this before adding this as a Node into XML.

     

    AnilKr

    Wednesday, June 19, 2013 8:57 AM
  • I've created a project and reproduced and example, but not  completely sure what your question is?
    Can you please clarify, what exactly you want to achieve.

    Thanks


    Please Mark as Answer and Vote as Helpful if I helped.

    Also please visit my blog http://msguy.net/

    Thursday, June 20, 2013 8:46 AM