Dealing with < and > characters in XML data

S

seeCoolGuy

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

<TblPartDesriptions_to_translate>
<intpartid>79</intpartid>
<strpartdescription>Part Description Here</strpartdescription>
<strlongdescription>some really long text here
m<sup>3</sup>/min.)</strlongdescription>
</TblPartDesriptions_to_translate>


The data inside the strlongdescription 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?
 
A

Andy Dingley

seeCoolGuy said:
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

<TblPartDesriptions_to_translate>
<intpartid>79</intpartid>
<strpartdescription>Part Description Here</strpartdescription>
<strlongdescription>some really long text here
m<sup>3</sup>/min.)</strlongdescription>
</TblPartDesriptions_to_translate>

_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:
<strlongdescription>some really long text here
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top