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

XmlTextReader and <node> </node>

Hi;

I have a node where it is "<w:t> </w:t>" and what I get from XmlTextReader
is Element, SignificantWhitespace, EndElement instead of Element, Text,
EndElement.

Question 1 is why? The text of that node is a space.

Question 2 is how do I handle this. Do I watch for a SignificantWhitespace
inside an Element/EndElement? Or will that get me other things too?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Apr 30 '06 #1
2 1381
Hi Dave,

Actually, this is by design. If it is an empty element, the XmlTextReader
will recognize all the white spaces between two tags as a whoe and return
it as whitespace. You can only check the nodetype, if it is reported as
whitespace, manually convert it to " ".

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 1 '06 #2
Some of the applications that consume a XmlReader benefit from the
additional
information provided by the classification of parsed character data.
Depending
on the context of the XmlReader, parsed character data can surface as
a Text node, a SignificantWhitespace node or simply a Whitespace node. For
more
details see
http://msdn2.microsoft.com/en-us/lib...lnodetype.aspx
If your application doesn't care about this level of granularity then you
can just
treat the combination of Text + SignificationWhitespace + Whitespace as one
case.

Ion

"David Thielen" <th*****@nospam.nospam> wrote in message
news:83**********************************@microsof t.com...
Hi;

I have a node where it is "<w:t> </w:t>" and what I get from XmlTextReader
is Element, SignificantWhitespace, EndElement instead of Element, Text,
EndElement.

Question 1 is why? The text of that node is a space.

Question 2 is how do I handle this. Do I watch for a SignificantWhitespace
inside an Element/EndElement? Or will that get me other things too?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

May 1 '06 #3

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

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the...
16
by: Bob Rock | last post by:
Hello, when serializing an array of elements of a class Classname using XmlSerializer.Serialize() I get an XML like the following: <?xml version="1.0"> <ArrayOfClassname> ....... ..........
4
by: Victor Hadianto | last post by:
Hi, If I have an XmlDocument DOM how do I insert <?mso-application progid="ProgId.Here"?> programmatically? -- Victor Hadianto http://www.synop.com/Products/SauceReader/
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
4
by: Carlos Albert | last post by:
Hello, Would you tell me if there is a way to extract a single node as a new xmldocument? Thanks.
4
by: mark4asp | last post by:
I have an element, report which contains tags which have been transformed. E.g. <pis &lt;p&gt <myXml> <report>This text has html tags in it.&lt;p&gt which but <has been changed to &lt;&gt</report>...
4
by: rrayfield | last post by:
I have a XML file that contains content for an asp.net website. I need the quickest way to find the node and write the elements out to the page. Also how would I get the links section out of it? ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.