Click here to Skip to main content
15,900,461 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to set node value in XMLDocument Pin
gauthee12-Feb-07 17:01
gauthee12-Feb-07 17:01 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM13-Feb-07 1:50
AndrusM13-Feb-07 1:50 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz13-Feb-07 6:19
Stefan Troschuetz13-Feb-07 6:19 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM13-Feb-07 8:48
AndrusM13-Feb-07 8:48 
GeneralRe: How to set node value in XMLDocument [modified] Pin
Stefan Troschuetz13-Feb-07 9:19
Stefan Troschuetz13-Feb-07 9:19 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 6:18
AndrusM14-Feb-07 6:18 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 7:36
Stefan Troschuetz14-Feb-07 7:36 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 9:23
AndrusM14-Feb-07 9:23 
Thank you. I tried it but
node.InnerText = "test";
still causes null reference exception.
Complete test case is in bottom of this message.

I think I must buy new notebook for VS development. Maybe this solves the issue. I'll try to find 7400 RPM disk and 1 GB RAM. Currently I have 5400 RPM disk. I have read somewhere that MS and Intel have made a contract. According to this MS releases new software every year which forces people to by new hardware.


using System.Xml;
class Program {
const string s = @"<?xml version='1.0' encoding='utf-8'?>
<Report xmlns='http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition'
xmlns:rd='http://schemas.microsoft.com/SQLServer/reporting/reportdesigner'>

<DataElementStyle>ElementNormal</DataElementStyle>
<RightMargin>0.25in</RightMargin>
<Body>
<ReportItems>
<List Name='list1'>
<DataInstanceName>Row</DataInstanceName>
<NoRows>Selliseid andmeid pole</NoRows>
<Style />
<DataSetName>Data</DataSetName>
<ReportItems>
<Textbox Name='Phone'>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>1</ZIndex>
<CanGrow>false</CanGrow>
<Value>=Fields!Kood.Value</Value>
<Left>1.5in</Left>
<Width>1in</Width>
<Height>14pt</Height>
</Textbox>
<Textbox Name='ContactName'>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<Width>1.5in</Width>
<Height>14pt</Height>
<CanGrow>false</CanGrow>
<Value>=Fields!Nimetus.Value</Value>
</Textbox>
</ReportItems>
</List>
</ReportItems>
<Style />
<Height>0.25in</Height>
<ColumnSpacing>0.25in</ColumnSpacing>
<Columns>1</Columns>
</Body>
<TopMargin>0.5in</TopMargin><DataSources>

<DataSource Name='DS1'>
<ConnectionProperties>
<DataProvider>PostgreSQL</DataProvider>
<ConnectString></ConnectString>
</ConnectionProperties>
</DataSource>
</DataSources>

<DataSets>
<DataSet Name='Data'>
<Query> <DataSourceName>DS1</DataSourceName>
<CommandText>SELECT * FROM nomenkla</CommandText>
</Query>
<Fields>
<Field Name='Nimetus'>
<DataField>nimetus</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name='Kood'>
<DataField>kood</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
</DataSet>
</DataSets>

<LeftMargin>0.25in</LeftMargin>
<BottomMargin>0.5in</BottomMargin>
<Width>2.5in</Width>
<PageHeader>
<Height>0pt</Height>
</PageHeader>
<PageFooter>
<Height>0pt</Height>
</PageFooter>

</Report>";


static void Main() {
GetDefaultReport(s);
}

static string GetDefaultReport(string s) {

XmlDocument xmlDocument = new XmlDocument();
xmlDocument.InnerXml = s;

XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDocument.NameTable);
nsmgr.AddNamespace("def", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition");
XmlNode node = xmlDocument.SelectSingleNode("/def:DataSources/def:DataSource/def:ConnectionProperties/def:ConnectString", nsmgr);
node.InnerText = "test";
return xmlDocument.InnerXml;

}


}


Andrus
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 9:59
Stefan Troschuetz14-Feb-07 9:59 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 10:23
AndrusM14-Feb-07 10:23 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 21:13
Stefan Troschuetz14-Feb-07 21:13 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM15-Feb-07 6:43
AndrusM15-Feb-07 6:43 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz15-Feb-07 7:32
Stefan Troschuetz15-Feb-07 7:32 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM15-Feb-07 8:13
AndrusM15-Feb-07 8:13 
QuestionConvert DataReader to Entity list Pin
AndrusM12-Feb-07 12:49
AndrusM12-Feb-07 12:49 
QuestionCrystal Report WebService Report to DataSet Pin
dbambirck12-Feb-07 12:36
dbambirck12-Feb-07 12:36 
QuestionCopy value from that table adapter to data grid cell, how? Pin
TrooperIronMan12-Feb-07 12:33
TrooperIronMan12-Feb-07 12:33 
AnswerRe: Copy value from that table adapter to data grid cell, how? Pin
TrooperIronMan12-Feb-07 14:19
TrooperIronMan12-Feb-07 14:19 
GeneralRe: Copy value from that table adapter to data grid cell, how? Pin
TrooperIronMan14-Feb-07 1:38
TrooperIronMan14-Feb-07 1:38 
QuestionHow can I have a Panel in my WindowForm? Pin
Khoramdin12-Feb-07 12:05
Khoramdin12-Feb-07 12:05 
AnswerRe: How can I have a Panel in my WindowForm? Pin
Ed.Poore12-Feb-07 12:23
Ed.Poore12-Feb-07 12:23 
QuestionOrphan Processes Pin
convivial.developer12-Feb-07 11:40
convivial.developer12-Feb-07 11:40 
Questionkeyboard handling for short-cuts using "Switch" Pin
Khoramdin12-Feb-07 10:03
Khoramdin12-Feb-07 10:03 
AnswerRe: keyboard handling for short-cuts using &quot;Switch&quot; Pin
Stefan Troschuetz12-Feb-07 10:37
Stefan Troschuetz12-Feb-07 10:37 
Questionhey, how can i retrive a letter from a controll under the cursor?? Pin
NZSmartie12-Feb-07 9:53
NZSmartie12-Feb-07 9:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.