Loading and saving a xml document in .net creates whitespace in empty nodes!
loading an empty node like:
<node></node>
..net saves as:
<node>
</node>
resulting in a whitespace when processed by xslt like:
<xsl:value-of select="node"/>
Can the whitespace be removed from empty nodes before saving in .net ??
/mik 4 4739
> Loading and saving a xml document in .net creates whitespace in empty
nodes!
Set the "PreserveWhites pace" attribute on your document to true, e.g.
XmlDocument d = new XmlDocument();
d.PreserveWhite space = true;
d.Load("file.xm l");
// do your processing...
d.Save("file2.x ml");
Rgd,
Peter Theill
I have the same issue as Mr Frost.
I tried your solution (using the PreServeWhiteSp ace property of the
XmlDocument) and it made no sence to me?
The XmlParser removes ALL carridge return in the entire document. I just
want to remove the extra carridge return added in empty elements. It seems
Michael Frost wanted the same.
Is it possible to remove that extra carridge return in empty elements?
Regards,
/Clark
"Peter Theill" wrote: Loading and saving a xml document in .net creates whitespace in empty nodes!
Set the "PreserveWhites pace" attribute on your document to true, e.g.
XmlDocument d = new XmlDocument(); d.PreserveWhite space = true; d.Load("file.xm l");
// do your processing...
d.Save("file2.x ml"); Rgd, Peter Theill
Hi,
I have exactly the same problem - do you have a solution already? The
workaround with PreserveWhitesp ace works, but I don't want to loose
all carriage returns.
Best regards,
Bjoern
Hi, I have'nt tried it. I you have more time then me on your hands you might wanna give it a go.
It isn't very time consuming, you should try it.
Look on the posts created 2004-08-30. I have a post there with a subject "Possible to force output format of empty element?".
Although the poster switched WriteFullEndEle ment and WriteEndElement
in a later post, it works for me with the first solution.
Thanks,
Bjoern This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JayC |
last post by:
Hey guys,
I've noticed that if you have an XML snippet structured like this (I'm
using square brackets instead in case it messes up and HTML readers):
Blah
Blah 2
|
by: Celedor |
last post by:
If I understand correctly, canonicalized XML is a simplified, or
rather, "standardized" form of XML. It is in such a form such that
two documents that are written in different ways, but contain the same
information, will normalize towards one form. This standard form can
then be used as the basis for encryption or digital verification (such
as XML Digital Signature).
If this is the case, then why is whitespace outside of any tags still...
|
by: Jyrki Keisala |
last post by:
Hi,
I have an XML file which I want to present as a HTML table, and I'm
looking for a quick way of defaulting all empty elements in my XML file
to a nbsp (using the notation) in my XSL transformation file, so
that if I have for example an XML record of
<record>
<elem1>fii</elem1>
<elem2 />
|
by: Tjerk Wolterink |
last post by:
Hello all,
how does xsl handle white space?
I know you can set domething like this
for nice indentation:
<xsl:output method="xhtml" indent="yes"/>
But know i have xsl code like this:
|
by: josh.asbury |
last post by:
I am having some major issues with whitespace in my XSL stylesheets.
We recently upgraded our servlet-based application to JDK 1.4, and this
has forced the issue of my finally upgrading to Xalan-Java 2. The
earlier version of Xalan was much more forgiving in regards to
whitespace in our .xsl files, and now I am learning all about
<xsl:text> and <xsl:strip-space>.
I've come across something with HTML buttons, though, that I can't find
a...
| |
by: Michael Kragh Pedersen |
last post by:
I have made an XSLT document, looking like this.
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="text"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
|
by: Shan Plourde |
last post by:
Hi everyone,
I have been using various regular expressions with the ASP.NET
RegularExpressionValidator for quite some time. In general it works
very well. One of the common regex's that I use follows:
ValidationExpression = "^\d{0,3}(\.\d{0,4})?$"
The purpose of this one is to validate that numeric values input
follow the syntax 999.9999. This works well. But, one thing that I
have never tested previously (which has now been uncovered...
|
by: amattie |
last post by:
Does anyone have any idea on how I can strip the extra whitespace in
the XML that shows up when I receive a response from an ASP.NET 2.0
webservice? This has been discussed before, but no one has ever come up
with a good answer to what seems like such a common question.
...
|
by: David |
last post by:
Hi All,
I am working on a script that is theoreticaly simple but I can not get it to
work completely. I am dealing with a page spit out by .NET that leaves empty
tags in the markup. I need a javascript solution to go behind and do a clean
up after the page loads.
The .NET will leave behind any combination of nested tags. Here is an
example below. Even though the <spantags are not empty, as they contain
<emtags they also need to be...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |