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

XML #PCDATA Element detection.

Bob
Hi,
Version 2.0 CLR
How can I detect a #PCDATA element in an incoming stream?
I have tried using
XmlReader xr = XmlReader.Create(streamResponse);

while (xr.Read())

basGeneral.WriteInfoLog(xr.Name);

xr.Close();

But this doesn't burrow down into the element that contains the #PCDATA
elements.

Thanks

Bob
Jul 31 '06 #1
3 1505
Hope this can bring you closer:
http://msdn2.microsoft.com/en-us/lib...15(d=ide).aspx

chanmm
"Bob" <bo*@nowhere.comwrote in message
news:OF****************@TK2MSFTNGP03.phx.gbl...
Hi,
Version 2.0 CLR
How can I detect a #PCDATA element in an incoming stream?
I have tried using
XmlReader xr = XmlReader.Create(streamResponse);

while (xr.Read())

basGeneral.WriteInfoLog(xr.Name);

xr.Close();

But this doesn't burrow down into the element that contains the #PCDATA
elements.

Thanks

Bob


Aug 1 '06 #2
Bob
Hi Thanks,
But my problem is not validation of the doc. I implemented the code anyway.
The doc validates against the DTD.

Problem is that the DTD specs an Element say 'Widget'
the Widget contains 70 optional PCData elements.
ie <!ELEMENT widget (p1?,p2?,p3?,...)
The spec for elements p1,p2,...pn is
<!ELEMENT p1 (#PCDATA) etc

The dilemma is that the contents of Widget is read as one large string. I
can pick out parts using regular expressions but this approach is limited
and depends upon static data.

Ideally I wanted to hook the data by Element name so that the contents
varying did not matter.
eg Assume Element p5 is 'widget colour'
The element may contain 'widget colour blue'
unfortunately the user has the ability change the wording to say 'widget
hue'
If I could grab element p5 I would know I had the colour text and could
parse it accordingly.

I guess my question boils down to:
Do element tags have to be present for optional #PCDATA elements or can they
legimately be present inside the parent element without tags?
To put it another way, is it probable that the tags are there and I am just
not looking at the doc the right way or the tags aren't there and I should
concentrate on making the reg ex detection as strong as possible.
Thanks
Bob

"chanmm" <ch*****@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hope this can bring you closer:
http://msdn2.microsoft.com/en-us/lib...15(d=ide).aspx

chanmm
"Bob" <bo*@nowhere.comwrote in message
news:OF****************@TK2MSFTNGP03.phx.gbl...
Hi,
Version 2.0 CLR
How can I detect a #PCDATA element in an incoming stream?
I have tried using
XmlReader xr = XmlReader.Create(streamResponse);

while (xr.Read())

basGeneral.WriteInfoLog(xr.Name);

xr.Close();

But this doesn't burrow down into the element that contains the #PCDATA
elements.

Thanks

Bob


Aug 2 '06 #3
Bob
Hi,
Problem was that I was using server side formatting in my request.
Thanks
Bob
"Bob" <bo*@nowhere.comwrote in message
news:ec**************@TK2MSFTNGP06.phx.gbl...
Hi Thanks,
But my problem is not validation of the doc. I implemented the code
anyway.
The doc validates against the DTD.

Problem is that the DTD specs an Element say 'Widget'
the Widget contains 70 optional PCData elements.
ie <!ELEMENT widget (p1?,p2?,p3?,...)
The spec for elements p1,p2,...pn is
<!ELEMENT p1 (#PCDATA) etc

The dilemma is that the contents of Widget is read as one large string. I
can pick out parts using regular expressions but this approach is limited
and depends upon static data.

Ideally I wanted to hook the data by Element name so that the contents
varying did not matter.
eg Assume Element p5 is 'widget colour'
The element may contain 'widget colour blue'
unfortunately the user has the ability change the wording to say 'widget
hue'
If I could grab element p5 I would know I had the colour text and could
parse it accordingly.

I guess my question boils down to:
Do element tags have to be present for optional #PCDATA elements or can
they
legimately be present inside the parent element without tags?
To put it another way, is it probable that the tags are there and I am
just
not looking at the doc the right way or the tags aren't there and I should
concentrate on making the reg ex detection as strong as possible.
Thanks
Bob

"chanmm" <ch*****@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hope this can bring you closer:
http://msdn2.microsoft.com/en-us/lib...15(d=ide).aspx

chanmm
"Bob" <bo*@nowhere.comwrote in message
news:OF****************@TK2MSFTNGP03.phx.gbl...
Hi,
Version 2.0 CLR
How can I detect a #PCDATA element in an incoming stream?
I have tried using
XmlReader xr = XmlReader.Create(streamResponse);
>
while (xr.Read())
>
basGeneral.WriteInfoLog(xr.Name);
>
xr.Close();
>
But this doesn't burrow down into the element that contains the
#PCDATA
elements.
>
Thanks
>
Bob
>
>


Aug 2 '06 #4

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

Similar topics

0
by: Mani | last post by:
I have been trying to use XmlValidatingReader and parse few XML documents. The problem lies with the DTD which has #PCDATA. At this point in DTD, the DTD Parser shows "invalid content model"...
2
by: indo3 | last post by:
I know one can define CDATA text by <!]> which is the same as PCDATA: &lt;bla&gt; &amp;bla; But if you define an attribute in a DTD
1
by: John-Orr | last post by:
hi guys have a problem....... an XML problem basically my XML looks like this <heritage> <parent>343453 <parent>35634654 <parent>456456 <parent>456456 ..........loads more nested parent...
23
by: Andrew Thompson | last post by:
This is intended to fix a long standing (cough)Java(cough) problem with which I'm sure some of you will be familiar. Sun recommends using the <OBJECT>/<EMBED> elements to cater for Java...
2
by: junk | last post by:
This seems something that should be easy and not uncommon... but hours of searching have yielded nothing! I am using XmlSerializer to map some XML (not defined by me) into some class objects...
0
by: Bob | last post by:
Hi, I am trying to extract nodes from a Webresponse. My XMLReader navigates happily down to the node that contains the nodes of interest. But will not locate anyfurther down. if...
14
by: hgraham | last post by:
Hi, I'm trying to understand how to work the dom, and all I'm trying to do is insert a link right before another link in the html based on it's href value. This isn't a real world example - I'm...
0
by: origami.takarana | last post by:
Intrusion Detection Strategies ----------------------------------- Until now, we’ve primarily discussed monitoring in how it relates to intrusion detection, but there’s more to an overall...
53
by: Aaron Gray | last post by:
Due to M$'s stupidity in not making DOMElements first class citizens the following will not work :- function isElement( o) { return o instanceof Element } It works for FF, Opera and Safari.
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
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
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
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...
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.