small xml question

small xml question

am 11.01.2008 19:57:03 von deepak

Hi
i want to write the follwoing in vb.net in asp.net.How to write it?







Cuurently i m using the following code

Function GetDictionaryValues()

Dim strmread As StreamReader
Dim str_response As String
Dim sxp_getdictionaryvalues As String

Dim objInProc As Object
Dim dictionayID As String = "80"

sxp_getdictionaryvalues = " "
sxp_getdictionaryvalues = sxp_getdictionaryvalues &
""
sxp_getdictionaryvalues = sxp_getdictionaryvalues & " " &
dictionayID & "
"
sxp_getdictionaryvalues = sxp_getdictionaryvalues &
"
"
sxp_getdictionaryvalues = sxp_getdictionaryvalues &
"
"

but its giving me 50 and not "50" i.e.







in sxp_getdictionaryvalues variable

which is wrong.Kindly help me

Thanks,
Deepak
kr_deepak123@hotmail.com

RE: small xml question

am 11.01.2008 21:34:02 von pbromberg

Do you see your double quotes here?: Revision=""7.5.0""> "
You need to do the same thing with the "50" or "80" whatever it is.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com


"deepak" wrote:

> Hi
> i want to write the follwoing in vb.net in asp.net.How to write it?
>
>
>
>
>

>

>
> Cuurently i m using the following code
>
> Function GetDictionaryValues()
>
> Dim strmread As StreamReader
> Dim str_response As String
> Dim sxp_getdictionaryvalues As String
>
> Dim objInProc As Object
> Dim dictionayID As String = "80"
>
> sxp_getdictionaryvalues = " "
> sxp_getdictionaryvalues = sxp_getdictionaryvalues &
> ""
> sxp_getdictionaryvalues = sxp_getdictionaryvalues & " " &
> dictionayID & "
"
> sxp_getdictionaryvalues = sxp_getdictionaryvalues &
> "
"
> sxp_getdictionaryvalues = sxp_getdictionaryvalues &
> "
"
>
> but its giving me 50 and not "50" i.e.
>
>
>
>
>

>

>
> in sxp_getdictionaryvalues variable
>
> which is wrong.Kindly help me
>
> Thanks,
> Deepak
> kr_deepak123@hotmail.com
>

RE: small xml question

am 12.01.2008 01:06:00 von deepak

sorry,i tried but its not workign as u said.May u try on your side and if it
is working then tell me plz with code....

"Peter Bromberg [C# MVP]" wrote:

> Do you see your double quotes here?: Revision=""7.5.0""> "
> You need to do the same thing with the "50" or "80" whatever it is.
> -- Peter
> Site: http://www.eggheadcafe.com
> UnBlog: http://petesbloggerama.blogspot.com
> MetaFinder: http://www.blogmetafinder.com
>
>
> "deepak" wrote:
>
> > Hi
> > i want to write the follwoing in vb.net in asp.net.How to write it?
> >
> >
> >
> >
> >

> >

> >
> > Cuurently i m using the following code
> >
> > Function GetDictionaryValues()
> >
> > Dim strmread As StreamReader
> > Dim str_response As String
> > Dim sxp_getdictionaryvalues As String
> >
> > Dim objInProc As Object
> > Dim dictionayID As String = "80"
> >
> > sxp_getdictionaryvalues = " "
> > sxp_getdictionaryvalues = sxp_getdictionaryvalues &
> > ""
> > sxp_getdictionaryvalues = sxp_getdictionaryvalues & " " &
> > dictionayID & "
"
> > sxp_getdictionaryvalues = sxp_getdictionaryvalues &
> > "
"
> > sxp_getdictionaryvalues = sxp_getdictionaryvalues &
> > "
"
> >
> > but its giving me 50 and not "50" i.e.
> >
> >
> >
> >
> >

> >

> >
> > in sxp_getdictionaryvalues variable
> >
> > which is wrong.Kindly help me
> >
> > Thanks,
> > Deepak
> > kr_deepak123@hotmail.com
> >

Re: small xml question

am 14.01.2008 18:03:46 von Hans Kesting

deepak explained :
> Hi
> Dim dictionayID As String = "80"

> sxp_getdictionaryvalues = sxp_getdictionaryvalues & " " &
> dictionayID & "
"

> but its giving me 80 and not "80" i.e.
>

The value of dictionayID is '80', without the ' s.
If you want to have " in your output, you have to put them in:
sxp_getdictionaryvalues = sxp_getdictionaryvalues & " &
dictionayID & """/> "


An other approach would be to use an XmlTextWriter:
(Note: C# syntax, but the objects are the same)

StringBuilder sb = new StringBuilder();
using(StringWriter sw = new StringWriter(sb))
{
XmlTextWriter xw = new XmlTextWriter(sw);
xw.WriteStartElement("SXPDictionaryItemsGet");
xw.WriteAttributeString("Revision", "7.5.0");
xw.WriteStartElement("DictionaryTypes");
xw.WriteStartElement("Item");
xw.WriteAttributeString("ID", dictionaryID);
xw.WriteEndElement();
xw.WriteEndElement();
xw.WriteEndElement();
}
sxp_getdictionaryvalues = sb.ToString();


Hans Kesting