String TO xml (xml string)

I am trying to take a string and convert it to a data 
source. The string is Xml that I am pulling out of 
sharepoint and looks like this:

<Field FromBaseType="TRUE" Type="Choice" Name="Status" 
ColName="nvarchar1" DisplayName="Status">
<CHOICES>
<CHOICE>Active</CHOICE>
<CHOICE>Resolved</CHOICE>
<CHOICE>Closed</CHOICE>
</CHOICES>
<Default>Active</Default></Field>

This is about all I have come up with but of course it 
doesn't work:


String xmlData1 = oList.Fields.GetField
("Status").SchemaXml.ToString();

DataGrid1.DataSource = xmlData1;
DataGrid1.DataBind();

I have tried a number of things with the different Xml 
components such as the Xmlreader and Xmltextreader. I 
can't seem to find the correct way to convert the string 
into something useful, believe it or not binding to the 
text actually returns each character as an item. All the 
examples I have found use files as the source, and of 
course when I search google for Convert string to xml all 
the results are converting Xml to a string.

0
anonymous (74722)
12/16/2003 10:39:28 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
605 Views

Similar Articles

[PageSpeed] 32

Have you tried:

using System.Data;
using System.IO;

DataSet ds = New DataSet
ds.ReadXml( New StringReader( oList.Fields.GetField
("Status").SchemaXml.ToString() ) );

DataGrid1.DataSource = ds;

-- 
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor


"Braden" <anonymous@discussions.microsoft.com> wrote in message
news:02e701c3c425$7731c3d0$a501280a@phx.gbl...
> I am trying to take a string and convert it to a data
> source. The string is Xml that I am pulling out of
> sharepoint and looks like this:
>
> <Field FromBaseType="TRUE" Type="Choice" Name="Status"
> ColName="nvarchar1" DisplayName="Status">
> <CHOICES>
> <CHOICE>Active</CHOICE>
> <CHOICE>Resolved</CHOICE>
> <CHOICE>Closed</CHOICE>
> </CHOICES>
> <Default>Active</Default></Field>
>
> This is about all I have come up with but of course it
> doesn't work:
>
>
> String xmlData1 = oList.Fields.GetField
> ("Status").SchemaXml.ToString();
>
> DataGrid1.DataSource = xmlData1;
> DataGrid1.DataBind();
>
> I have tried a number of things with the different Xml
> components such as the Xmlreader and Xmltextreader. I
> can't seem to find the correct way to convert the string
> into something useful, believe it or not binding to the
> text actually returns each character as an item. All the
> examples I have found use files as the source, and of
> course when I search google for Convert string to xml all
> the results are converting Xml to a string.
>


0
12/17/2003 2:59:57 AM
Reply:

Similar Artilces:

Wildcard string
Can I use vlookup to find a wildcard text string ie =vlookup(*a2*,data_range,2,false) If not vlookup, is there an alternative? Thanks Robo -- Robo ------------------------------------------------------------------------ Robo's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=12058 View this thread: http://www.excelforum.com/showthread.php?threadid=487236 You ned to concatenate your *s to the cell reference. Your formula would be: =vlookup("*"& A2 & "*", data_range,2,false) -- mdbct --------------------------------------------...

Execute commands in strings?
I have a form that has eleven sets of controls, txtDesc1.... txtDesc2. I need to do the same thing to all of them several times, such as txtDesc1.visible = true, etc. Is there a way to use a string like "txtDesc" & li_i & ".visible = true" in a loop to do this? tia las Dim lngO As Long For lngO = 1 To 10 Me.Controls("txtDesc" & lngO).Visible = True Next lngO -- Ken Snell <MS ACCESS MVP> "Laurel" <FakeMail@Hotmail.com> wrote in message news:%23GVaa6ixHHA.3696@TK2MSFTNGP03.phx.gbl... >I have a form that h...

Reading XML direct from SQL
Hi, I'm not sure if this is possible, I can't see why, but is there a way round a problem I have. I'm returning the results from a stored procedure, of which there could be anything from 5 to 1000 records. The results have simply 3 columns (parent, level, name), although this could increase in time to show more information. I also have a treeview, of which I'd like to bind this data to, and I've read that I can use an XML that is bound to the treeview, and the treeview is geneerated from it. The trouble is, the documentation says that in order to bind the control to th...

How to: Omit Deafulted Elements from XML When Serializing
I have a complex object that I am serializing, and I would like to omit elements that have a default value. For example, if I have a class as follows Public Class Test Private m_Name As String = "George" Private m_Active As Boolean = False Private m_Address As String Public Property Name() As String Get Return m_Name End Get Set(ByVal Value As String) m_Name = Value End Set End Property Public Property Active() As Boolean Get Return m_Active End Get Set(ByVal Valu...

xml as an e-mail attachment job import/export/billing
Can anyone suggest the best and easiest platform for the following job, possible freelancer and approximate budget for this: "It must be a script that has as an input a long code from the "calling scratch card" that customers enters on our website. Script accepts the long code, validates it with a database, than offers a customer to create a login/pass to enter customers personal area. "Long code" consists of an open serial number that is printed on a scratch card and closed portion of a code under the scratch area. 2. In his personal area a customer enters his...

Is it possible to convert any given XML into Class?
Given an XML stream as below, is there any possibility to convert the same into any treditional class style with . (dots) as seperator of the nodes of the xml file... for instance bank.code.tostring() should reslut me "5070" and bank.description.tostring() should result "ICICI - Bangalore" bank.location.destination.code should result "MB" bank.location.zone.code.tostring() should result "12" etc ., And the XML file being ... <?xml version="1.0" encoding="utf-8" ?> <MainBank> <bank> &l...

Gurus for XML TextStream vs Response Stream vs XMLValidatingReader
Hi, I try retrieve an XML stream from a webapp using a post "http://webedu.its.uct.ac.za/webct/public/serve_webctdb?OPERATION=homearea_xml&DB=global&WebCT%20ID=rodgersn_its_main&AUTH=ee09aabc77ef593917a60720f167c733" and result = req.GetResponse() ReceiveStream = result.GetResponseStream() from here ..I try read the XML retrieved, but... I've tried XMLStream and XMLValidatingStream..both return "There is invalid data at the root level" Trying a std StreamReader with say .readtoend or sr.Read(read, 0, 256) in a count lo...

How do you use a XSD to create a XML document?
Is it possible to load a XSD and loop throw the nodes and attributes that you whant filled out, and then generate a XML instance with the trees and data that you have filled data in? And how do you do that? Regards Paw what do you *really* want to do? do you want a generic xsd-to-xml generator? Something that can contrive XML documents from any general XSD? or is there a particular XSD you want to generate for? one approach I have used is to use "xsd.exe /c" to generate classes, then just instantiate the classes. Serialization of an instance of said class produces an XML d...

String to Time
I have some information in Excel that expresses the length of a phone call. It's a text field and when I import it the option for type of field is grayed out. I would like to run an update query and put that information into another field and make it a number. Any help would be appreciated. Thanks After further review - it's a general field and it look like 09:00 "Marshall Barton" wrote: > williamr wrote: > > >I have some information in Excel that expresses the length of a phone call. > >It's a text field and when I import it the option f...

Saving a class as XML in SQL
I have code to convert a class with lots of data in it to XML that I can then put in SQL. Question is, once it's in SQL, can I process it on the SQL end? I know on the client side I can take the XML, load it back into the class and access it there but there are times I'd like to be able to process it at SQL (in a stored proc). TIA - Jeff. Mr. Magic wrote: > I have code to convert a class with lots of data in it to XML that I can > then put in SQL. Question is, once it's in SQL, can I process it on the > SQL end? I know on the client side I can take t...

XSL/XML Select and Option HTML tags
Hi, I'm trying to render tabular data in an HTML document using XSL to transform XML data into an HTML table. Some of the tabular data appears as droplists (implemented by the HTML Select and Option tags). All the droplists have the same option entries that a user can choose from. Is there anyway to reuse a single "master" branch in the XML document that contains all the option entries for all the select droplists in the XSL document? As there can be hundreds of skills, it wouldn't be practical to keep repeating the option data as childnodes for each skill node in the XML...

XML update already installed 4 time, still requesting to install
Vista KB973688 and KB954430 already installed several times but Windows update still requires more installation... in XP Installation is always unfinished, PC wait for the install to finish. Recommendations? Thanks in advance -- Emile Brussels Asus P4s800d-X P4 HT 3Ghz 2 Gb ram,1/ AGP GF 7800 GS with 2 monitors attached res 1152x854x32, 2/ PCI GF FX6200 1 monitor res 1152x854x32, Dual Boot XP Pro SP3 DX 9c , Vista Home sp1 From: http://support.microsoft.com/kb/954430 Either *read* the "Known issues with this security update" section or " How to obtain ...

Match data of two identical strings in two separate spreadhseets
I have two excel spreadsheets, where I want to search from both having same ID, which looks like this, it was originally a text, and I converted all spaces and dashes into zero spaces : "097 0001-006-00". I want to compare both the files having the rows with same ID, that they have same data in other records pertaining to that ID. Something like this: For ID="097 0001-006-00" of cell "A4" search all the records in the other spreadsheet and find the record containing same ID, and then compare other records cell by cell between both files, if they are s...

Reading XML from a Windows service #2
Using the function below, I'm importing configuration parameters, from an xml file, into a Windows service. This code works as expected in a regular Windows application, but when used in a Windows service (written in vb.net), it produces unintended side effects. The most notable being multiple (and simultaneous) firings of timer events. Is there a better way? Thank you. Private Function MyNodeValue(ByVal strPath As String) 'This function reads a value from an XML file. Dim xmlDoc As New System.Xml.XmlDocument xmlDoc.Load(strPathToXMLfile) Try ...

[ANN]VTD-XML 2.10
VTD-XML 2.10 is now released. It can be downloaded at https://sourceforge.net/projects/vtd-xml/files/vtd-xml/ximpleware_2.10/. This release includes a number of new features and enhancement. * The core API of VTD-XML has been expanded. Users can now perform cut/paste/insert on an empty element. * This release also adds the support of deeper location cache support for parsing and indexing. This feature is useful for application performance tuning for processing various XML documents. * The java version also added support for processing zip and gzip files. Direct processing of httpURL based XML...

Auto-scrolling string buffer
I need a control on my form that will automatically scroll as data is added to it. I have tried this with a CEdit control, but unfortunately any attempts to set the text sets the scroll position back to zero. I can then set the scroll position to the end, but this creates a terrible flickering effect since this control is updated several times per second. Is there any way around this with a CEdit control? Is there a better class / control for this? ---Michael Springer Use Setsel / Replace Sel on it via SendMessage or whatever interface (CEdit) you are using. Just select the last (l...

Query String
I am having problems with a query string. I can fill a TableAdapter by: this.TableAdapter1.FillByQS(param1, param2, param3); but if I try string QS = Param1 + "," + Param2 + "," + Param3; this.TableAdapter1.FillByQS(QS); I get an error telling me that I need three arguments for the FillByQS to work. How do I accomplish substituting a string for three arguments. Thanks in advance for your help, Jim Add (or extend) the class of your object TableAdapter1 with FillByQS( String s_param) which will parse the string passed as argument to find its three componen...

Adding strings to CComboBox
Hi I have approximately 150 strings that need to be added to a CComboBox object. Is there a more effective way of adding all the strings without adding each string individually, eg myString.LoadString(IDS_RANDOM_WORD_1); myComboBox.AddString(myString); .. .. .. myString.LoadString(IDS_RANDOM_WORD_150); myComboBox.AddString(myString); TIA Tony See if CComboBox::InitStorage() speeds up the adding. -- Cheers Check Abdoul ----------------- "Tony" <lazyherbert@homeandresting.com> wrote in message news:uNugbVnzFHA.2924@TK2MSFTNGP15.phx.gbl... > Hi > > I hav...

minOccurs in XML Schema for Datset
Hi What effect does the presence of minOccurs attribute with columns defining the tables for a dataset? I understand that, if it is set to minOccurs=0, then the element does not have to appear in XML using the XSD, but how does that effect the dataset? Does it allow a dataset to be filled with a DataAdapter that does not provide that particular column as output? Many thanks, Lee Hi Lee, If your XSD has minOccurs="1" then DBNull values are not allowed in the column in the strongly-typed DataSet. The xsd.exe tool generates code like this: this.MyRequiredColumn.AllowDBNull = false;...

Converting xml to another format of xml using ASP.NET
Hello Everybody, I need to convert xml that we get from sqlserver For xml auto to my own xml format using asp.net classes. Any ideas and suggestions would be appreciated. Thanks in Advance sp "sp" <sp@discussions.microsoft.com> wrote in message news:ADD0FF4E-39BA-46E2-A9EC-D3BAB3E6D530@microsoft.com... > I need to convert xml that we get from sqlserver For xml auto to my own > xml format using asp.net classes. > > Any ideas and suggestions would be appreciated. For Xml will usually return you an XML fragment, instead of an XML document (i.e., there will be m...

CRM 4.0 - Default_Client_Config.xml
Hello, Has anyone had any success when editing the ExtranetServerUrl in the default_client_config.xml? I'm trying to repackage the CRM 4.0 Outlook client for our environment and it seems no matter what I use for the ExtranetServerUrl the configuration wizards does not accept it. When I run the configuration wizard it shows the correct Intranet Address, but then the wizard defaults to "Use the same Web address when the system connects over the Internet" which is not what I'd like. I'd like it to use the ExtranetServerUrl instead. Note: This is On Premise. Has any...

Add to text box String
Im trying to add a total off my report to this string for emailing, problem being the text box is on the report and not the form tbGrandTotalM is on the report that is being emailed rptOwnerPaymentMethod How do I code tbAmount below in between the ******* Private Sub SendMailButton_Click() On Error GoTo ErrorHandler If Me.Dirty = True Then Me.Dirty = False End If Dim lngID As Long, strMail As String, strBodyMsg As String, _ blEditMail As Boolean, sndReport As String, strCompany As String '*****JK: Added 17/10/06 Dim msgPmt As String, msgBtns As Inte...

Count number times text appears in string
A 1 Module: C126, Module: C130, Module: C138, Module: C105 Can any help me write a function that would return the count of a specified text in a cell. For example for the string in cell A1 I would like to know how many times does the text 'Module' appear. Try =(LEN(A1)-LEN(SUBSTITUTE(A1,"Module",)))/LEN("module") OR with the text string in cell B1 =(LEN(A1)-LEN(SUBSTITUTE(A1,B1,)))/LEN(B1) ---------------------------------------------------------------------------- If you want to have an word Match try the below formula. In the ...

Writing the Xml Declaration Using XmlDocument
Is there a better way to include the XML declaration than the following? XmlDeclaration dec =m_XMLDocument.CreateXmlDeclaration("1.0",string.Empty, "yes"); m_XMLDocument.InsertBefore((XmlNode)dec, (XmlNode)m_XMLDocument.DocumentElement); XmlTextWriter writer = new XmlTextWriter(m_FileName,Encoding.Default); writer.WriteRaw(m_XMLDocument.OuterXml); writer.Flush(); writer.Close(); This is a multi-part message in MIME format. ------=_NextPart_000_0146_01C49FB1.1FEC3CA0 Content-Type: text/plain; cha...

A newbie's cry for help editing XML document
HELP! Using VB.NET, VS2003, XML. I apologize for the length of this request. Though I've written before and received advise pointing to several articles (which I've read and re-read), frankly, I'm still confused and need help! My request might be a little different than what XML procedures appear to be directed towards (ie, wholesale transformations or mass updates). What I need to do is to selectively locate specific book titles and edit information in a another field of the book's data. Here is a simplified view of the XML file. It represents data for two specific b...