473,395 Members | 1,856 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,395 software developers and data experts.

XML: keep spaces between attributes

3
I have problem keeping the formatting of the XML elements when reading a file and writing it back,
When reading the XML document I'm using XML document ( XmlDocument.Load (String) ), with PreserveWhiteSpace = true. When reading the file each XML node is saved and values are later modified, when writing the data back I'm using the XML writer. Since the PreserveWhitespace = true the new lines between elements to work.

The problem is that the formatting within an element is lost.
<myElem myAttr1="1"
myAttr2="2" />

When read and written it gets
<myElem myAttr1="1" myAttr2="2" />

How can I keep the formatting?

I'm using managed C++, .Net 2.0
Nov 29 '07 #1
1 1648
Dököll
2,364 Expert 2GB
I have problem keeping the formatting of the XML elements when reading a file and writing it back,
When reading the XML document I'm using XML document ( XmlDocument.Load (String) ), with PreserveWhiteSpace = true. When reading the file each XML node is saved and values are later modified, when writing the data back I'm using the XML writer. Since the PreserveWhitespace = true the new lines between elements to work.

The problem is that the formatting within an element is lost.
<myElem myAttr1="1"
myAttr2="2" />

When read and written it gets
<myElem myAttr1="1" myAttr2="2" />

How can I keep the formatting?

I'm using managed C++, .Net 2.0
Hello, Cilla!

I am not sure how to do this in C++, nor .NET, but do stay tuned. I think the C forum may be of assistance. Please return here if this was strickly XML related.

In a bit!

Dököll
Nov 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ellen K. | last post by:
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....
1
by: xrow | last post by:
Hello I have a simple webservice / c# application that receives data from server and prints the data in the asp:datagrid control I have problem when sorting data in datagrid I have created...
16
by: lgbjr | last post by:
Hi All, I've been given an XML file (12 MB) that I need to extract data from. The XML file makes the data easy to view, but the data is impossible to analyze in its current format. I've looked...
3
by: Nick Gilbert | last post by:
Hi, I have to send an array of prices for a list of products over XML. Currently my XML data looks like this: <ArrayOfProd> <Prod Code="productcode001"> <Prices> <P F="2005-01-01"...
4
by: Java Apache | last post by:
Hi All, I am pretty to new to .NET/C# so go easy! I am developing a Web Service call to a Java Web Service and it is all working fine - it is returning me back a String value which in all...
1
by: Paul Kozik | last post by:
I am trying to write a script that reads an XML file (using the minidom module), makes an edit to a few attributes, then saves it back. If I use minidom.Document() to create the xml file, then...
0
by: jeoffh | last post by:
Background: I am trying to "merge" some attributes into an existing XML column in my MS SQL 2005 database. The general idea is that I have an XML column in a table and I would like to update/delete...
1
by: neisan | last post by:
Hi there, I'm trying for a while to obtain the XML content of a file without spaces. I have a XML file with the following content: <script> <command> <createDocument>...
4
by: Alvin SIU | last post by:
Hi all, I have 6 tables inside a MS Access 2003 mdb file. I want to convert them as DB2 version -8 tables in AIX 5.2. I have exported them as 6 XML files. The XML files look fine. Each...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.