Ignorable whitespace

G

Guest

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/apiDocs/org/apache/xerces/dom/TextImpl.html#isIgnorableWhitespace()).

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/apiDocs/org/apache/xerces/dom/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.
 
B

Bruce Wood

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