By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,566 Members | 1,783 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,566 IT Pros & Developers. It's quick & easy.

Ignorable whitespace

P: n/a
Hi there,

A class in Xerces J-API (Java) called TextImpl contains a property that
returns whether the text is ignorable whitespace
(http://xml.apache.org/xerces-j/apiDo...eWhitespace()).

I guess when they refer to "ignorable whitespace" in Java we may interpret
that as an "insignificant whitespace" in .NET. Am I correct to say that?

So, I need to manually convert some Java code to C#, and the following
excerpt shows the converted code, except for the line marked with
"//<--****". I have spent a lot of time trying to find out how that
if-statement could be converted to C# with no success, mostly because I am a
beginner in XML.

The excerpt of code is this:

XmlNodeList children = node.ChildNodes;
string svalue;
if ( children != null )
{
//we want to delete ignorable whitespace from
//the dom tree
for ( int z = 0; z < children.Count; z++ )
{
if ( children.Item(z) is XmlText) // instanceof
TextImpl )
{
svalue = children.Item(z).Value.Trim();

if ( (children.Item(z)).isIgnorableWhitespace() ) //
<--****
{
node.RemoveChild( children.Item(z) );
z--;
}
else if ( svalue.Length == 0 )
{
node.RemoveChild( children.Item(z) );
z--;
}
}
}
}

Three questions:
1. Can we say that XmlText is the counterpart of Java Xerces' TextImpl
(reference:
http://xml.apache.org/xerces-j/apiDo.../TextImpl.html) ?

2. Is it correct and safe to say that the term "insignificant whitespace"
referred in MSDN Library is the same as saying "ignorable whitespace" in Java?

3. How would the code line marked with "//<--****" in above's excerpt be
coded in C#?

Many thanks in advance.

--
Carlitos
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Although some of the same people are no doubt reading both newsgroups,
have you tried posting this to microsoft.public.dotnet.xml ?

Nov 16 '05 #2

P: n/a
I'll ask there too then. Thanks.

C

"Bruce Wood" wrote:
Although some of the same people are no doubt reading both newsgroups,
have you tried posting this to microsoft.public.dotnet.xml ?

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.