Dealing with < and > characters in XML data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • seeCoolGuy

    Dealing with < and > characters in XML data

    I've been using Access to import some data straight into a sql server
    database by simply importing the xml file. However lately some of the
    newer xml files will contain vaild data such as

    "m<sup>3</sup>" within the tags so it reads like the following

    <TblPartDesript ions_to_transla te>
    <intpartid>79 </intpartid>
    <strpartdescrip tion>Part Description Here</strpartdescript ion>
    <strlongdescrip tion>some really long text here
    m<sup>3</sup>/min.)</strlongdescript ion>
    </TblPartDesripti ons_to_translat e>


    The data inside the strlongdescript ion should just parse correctly but
    it could just be a microsoft thing, since it does parse correctly in
    other products such as "XML PAD" and Firefox for viewing the file.

    any help is appreciated, perhaps a modified xsl file?

  • Andy Dingley

    #2
    Re: Dealing with &lt; and &gt; characters in XML data


    seeCoolGuy wrote:
    I've been using Access to import some data straight into a sql server
    database by simply importing the xml file.
    I'm not sure what "simply importing the xml file." means.

    Does Access expect to see XML here, and _treat_it_as_ XML ?
    Or will it expect to see CDATA here, and will thus encode it so as to
    be suitable for inclusion inside XML (as CDATA), i.e. it'll convert to
    &lt;
    it reads like the following
    >
    <TblPartDesript ions_to_transla te>
    <intpartid>79 </intpartid>
    <strpartdescrip tion>Part Description Here</strpartdescript ion>
    <strlongdescrip tion>some really long text here
    m<sup>3</sup>/min.)</strlongdescript ion>
    </TblPartDesripti ons_to_translat e>
    _Does_ it read like this? This is what you'd expect, and I'd expect
    other tools to then process it corrrectly.

    However I suspect that Access may have helpfully(sic) delivered you
    this instead:
    <strlongdescrip tion>some really long text here
    m&lt;sup&gt;3&l t;/sup&gt;/min.)</strlongdescript ion>

    any help is appreciated, perhaps a modified xsl file?
    XSL is rarely any use for this sort of problem. What you need is a very
    clear mental model of what's text (i.e. CDATA), what's XML, and to make
    sure that exactly the right type and number of encodings is applied
    when moving between each.

    Comment

    Working...