chromatinpt Posted October 22, 2009 at 10:45 AM Report Share #292855 Posted October 22, 2009 at 10:45 AM Buenas! Tenho uma textbox que recebe um output via socket de outro programa em xml. O que pretendia era agora conseguir extrair valores desse xml contido nessa textbox para outras. O que encontrei de xmlreaders apenas lê a partir de um file .xml, eu neste caso nao tenho permissões de escrita para poder criar esse xml. Alguma ideia? Obrigado! Link to comment Share on other sites More sharing options...
chromatinpt Posted October 22, 2009 at 02:29 PM Author Report Share #292904 Posted October 22, 2009 at 02:29 PM Já encontrei solução! A quem possa interessar aqui fica: String xmlString = textBox.Text; XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlString)); Link to comment Share on other sites More sharing options...
chromatinpt Posted October 23, 2009 at 11:14 AM Author Report Share #292997 Posted October 23, 2009 at 11:14 AM Boa tarde! Preciso de mais uma ajuda! Supondo que tenho um node de xml com os seguintes dados: <out class="cell" size="[1,2]"> <tr> <td class="numeric" size="[0,0]" /> <td class="numeric" size="[17,1]"> 1.46590270801; 1.47197105847; 1.44441393964; 1.45198190444; 1.42069704633; 1.48390857689 </td> </tr> </out> E com este código o valor da textBox5 é vazio, mas se fizer de outro node simples, como p.e.: <settings class="string">media</settings> Consigo obter o valor "media"! String xmlString = textBox4.Text; XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlString)); while (reader.Read()) { XmlNodeType nodeType = reader.NodeType; if (nodeType == XmlNodeType.Element) { switch (reader.Name) { case "out": textBox5.Text = reader.ReadString(); break; } } } Como consigo obter os valores do node "out", e se possível apenas o primeiro valor. Obrigado! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now