|
Why is the value of the tags not being read when the code reads System.xml.XmlTextReader.Text property?
Hence within element <column> column 1 is not being read as text
Note: "sample.xml" is not being rendered well. Tried using HTML escape characters to display a sample but it was unsuccessful. See the code below.
using System;
using System.Xml;
namespace ReadXMLfromFile
{
class Class1
{
static void Main(string[] args)
{
XmlTextReader reader = new XmlTextReader("sample.xml");
while (reader.Read())
{
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
Console.Write("<" + reader.Name);
while (reader.MoveToNextAttribute())
Console.Write(" " + reader.Name + "='" + reader.Value + "'");
Console.WriteLine(">");
break;
case XmlNodeType.Text:
Console.WriteLine (reader.Value);
break;
case XmlNodeType. EndElement:
Console.Write("");
break;
}}}}}}
(source: MSDN)
sample.xml
----------
<database schema-name="products">
<column data-type="text" name="Code" pk="true" fkreferences="Product.Code"> column 1
<column data-type="int" name="Qty"> column 2
<column data-type="currency" name="CostPrice"> column 3
<table name="ProductsInStock"> </table>
<column data-type="text" name="ProductID" pk="true"> column 1
<column data-type="text" name="Description"> column 2
<table name="Product"> </table>
------------------
-- modified at 13:26 Saturday 29th September, 2007
-- modified at 5:24 Sunday 30th September, 2007
-- modified at 5:26 Sunday 30th September, 2007
<div class="ForumSig">Jon</div>
|
|
|
|
|
SqlDataReader read = cmd.ExecuteReader();
read.Read();
photo.Visible = false;
if (read["newsPhoto"] != DBNull.Value)
{
photo.Visible = true;
photo.ImageUrl = "retriveImage.aspx?id=" + read["newId"].ToString();
}
this my code to display image
but all time enter this if statment either i upload the image or not all time he enter if statment ... where the problem ?????
Palestine
|
|
|
|
|
does the path come through from the DB ? Does it exist ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hey
does anyone know where I can find one? its just really for changing the base of and handling large integers... preferably under an MIT/BSD style licence...
thx!
|
|
|
|
|
|
thepersonof wrote: any ideas?
lots of them. It suffices to Google around.
CodeProject has a couple of articles on big integers.
GNU has a multiprecision package.
etc.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
hi all,
I am working in a windows application. i have a text say for eg,
<img src="http://static.ibnlive.com/pix/sitepix/06_2007/kumaraswamy_cm90.jpg"
alt="BACKTRACKING? Kumaraswamy says he never said he would step down on October 3."
title="BACKTRACKING? Kumaraswamy says he never said he would step down on October 3"
border="0" width="90" height="62" align="left" hspace="5&"/>
Kumaraswamy has denied reports that he would step down on October 3
i need to remove the img tag entirely and display only this part.
Kumaraswamy has denied reports that he would step down on October 3
i tried using the following regular expression to extract img tag.but its not working
Regex r=new Regex("<img[^<>]+>")
can anybody help out with this?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
anu81 wrote: Regex r=new Regex("<img[^<>]+>")
OTOH, < and > are themselves regular expression delimiters, you'll have to escape them like
@"\<img[^\<\>]+\>"
|
|
|
|
|
Hi every body,
I want to fetch database tables from SQLSERVER DBMS and display all these tables along with their attributes using c# from which the user can select the reqiured tables and correspoding fields.two points i need to know.
1-how to retrieve "database schema" from SQLSERVER.
2-after fetching,where these tables schemas can be stored from where they can be displayed to user.
Regards,
chanzeb chaudhary.
|
|
|
|
|
What brand of SQL server are you using? Microsoft SQL Server? MySQL? Oracle? Something else?
---
single minded; short sighted; long gone;
|
|
|
|
|
SQL Server is the name of the MS product, I think it's safe to assume that's the one he means.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
I have an icon resource with various large and small sizes / colour depths. Vista and XP both support png compression on icons > 48 x 48 but if I compress these icons within the resource my application won't compile.
Error 18 'CSCA8.tmp' is not a valid Win32 resource file
Is there a workaround for this?
(Using vs 2005 by the way)
Dave
|
|
|
|
|
|
That's not C# code. Pascal?
Why do you think that the code needs to ne optimised?
---
single minded; short sighted; long gone;
|
|
|
|
|
yes, may be Pascal, because that is a test in interview. i cannot finish the test.
|
|
|
|
|
So you want someone else to finish it for you, so that you can get a job doing something that you don't have the sufficent knowledge of?
---
single minded; short sighted; long gone;
|
|
|
|
|
oh no, why do you think that? i fail. but i want to know how to optimize it?
|
|
|
|
|
svincoll4 wrote: oh no, why do you think that? i fail.
Oh, sorry. Because it's not that uncommon that people try things like that, and you didn't speak of the test in the past tense.
svincoll4 wrote: but i want to know how to optimize it?
Well, that depends on the language used, and what the rest of the code looks like.
You could perhaps use a pointer to clear the array faster. Loop unraveling is another optimising method that would simply replace the loop with 101 assignment statements.
However, the most efficient might be if the code that is going to use the array could be altered to not needing the array to be cleared at all, then the loop could simply be removed.
If it's a newly created array, it might not need clearing at all. Some languages automatically clears new arrays on creation, so clearing it again would be completely pointless.
---
single minded; short sighted; long gone;
|
|
|
|
|
svincoll4 wrote: i want to know how to optimize it?
Do you have the foggiest idea what loop unrolling is? That is a general optimization you can use for the loop, but why bother. The compiler will do it for you.
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
svincoll4 wrote: that is a test in interview. i cannot finish the test.
And you expect people here to help you cheat on an interview test, shame on you!
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
Playing Devils advocate here - if he had googled the answer and found it, without explicitly asking the question - would that have been OK?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
|
Malcolm Smart wrote: if he had googled the answer and found it
It would demonstrate a willingness to learn and a capacity to find answers to questions without always turning to ask someone. It's called initiative and is a skill all [good] software developers have.
The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee
|
|
|
|
|
Paul Conrad wrote: svincoll4 wrote:
that is a test in interview. i cannot finish the test.
And you expect people here to help you cheat on an interview test, shame on you!
thanks but please review all my post before you say that.
|
|
|
|