473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

XML leading spaces problem solved

In a previous post I mentioned having a problem getting leading spaces
to be written to SQL Server using OPENXML. They showed up fine in my
XML documents if I printed them, but not in my database.

(Our legacy flat-file data uses fixed-length character expressions for
data like contract numbers, I guess because in a 16-bit environment
you'd run out of available numbers REALLY fast... right now our
contract numbers are in the 700,000's, so if I want the new and old
systems to talk to each other I need to preserve the four leading
spaces.)

Blabla, the answer turns out to be:
1. In your XML document, make the column values entities, not
attributes.
2. In your XML document, make the values with leading spaces CDATA.
3. In your stored procedure, set the OPENXML flag to 2.

It probably also doesn't hurt to use
xml:space="preserve"
although by itself that didn't fix the problem.

Hope this helps someone else. :)
Jul 20 '05 #1
0 2224

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: yanir | last post by:
Hi I use reponse.contenttype = "application/vnd.ms-excel" So the browser will show the data in excel format, but for some fields I use leading zero's, which truncated by the browser, at this...
6
by: jalkadir | last post by:
I am trying to find a way to remove the leading and tailing blanks from a string. What I have come up with is not doing the work as I expected; because if the value I pass to the function is "...
0
by: Les Caudle | last post by:
I'd been using +(\+*)?@(+\.)++ as the validator for an email address. If the user enters a leading or trailing space, the email is invalid. 1. How exactly does one trim leading/trailing...
3
by: SKG | last post by:
i have leading spaces in my database fields. When they appear in the datagrid in browser, they seem to be truncated. I did view source in browser and found that there are indeed spaces but when...
4
by: Steve Richter | last post by:
when I run the following code the leading spaces of the "data" node are removed. How do I retain whitespace? private void CreateBasicXmlDocument() { XmlWriterSettings writeSettings = new...
5
by: MrAsm | last post by:
Hi, what is (if exist) the format string to print an integer in C# with leading spaces (to do right justification) e.g. value = 77 |<----->| <--- width = 5 characters + 12345 + | ...
4
by: bobm2005 | last post by:
Whatever format I try in Printf, an 'E' format number nearly always has a leading non-zero:- 1.2345E7 -9.3456E8 etc. Is it possible to force it (printf) always to have leading zero? ...
4
by: John Nagle | last post by:
One can argue over tab vs. space indentation, but mixing the two is just wrong. Why not have CPython report an error if a file has both leading tabs and leading spaces? I know that was proposed...
0
by: markpringle | last post by:
I am using a very simple multiline textbox (below) to capture text (poems). Many poems require formatting of the first line by including leading spaces. However, on submit, the leading spaces are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.