**This is for silverlight application.
I have a stream with xml data, which after loading massage the data and generate final file. I start by load using XDocument.Load(stream). One of the file was failing to load and after some research I foung out that one of the element has a value of 'First & Second' and load fails on hitting &.
I...
I'm trying to use XDocument and XPathEvaluate to get values from the woot.com feed. I'm handling other namespaces fine, but this example is giving me problems.
<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<category text="Comedy" xmlns="http://www.itunes.com/dtds/podcast-1.0.dtd">
</cate...
I'm trying to do a find and replace in an OpenXML word document which I've openened into a MemoryStream.
using (WordprocessingDocument _document = WordprocessingDocument.Open(_ms, true))
{
var placeHolder = _document.MainDocumentPart.Document
.Descendants<DocumentFormat.OpenXml.Wordprocessing.Text>()
...
I want to search for files with .xml extension within my silverlight project, for example (ApplicationRoot)/Resources/102.xml
I know how to do this using System.IO.Directory:
// create a collection to hold the file enumeration
List<string> directoriesInFolder = new List<string>();
// using the file api to enume...
i have created a xml file using c# but the main problem is that it is not indented
i have used xmldocument.preserverwhitespace=true;
...
I like to create xml using the following formatting:
XDocument xml = new XDocument(
new XElement("Root",
new XElement("A",
new XAttribute("X", xValue),
new XAttribute("Y", yValue)),
new XElement("B",
new XAttribute("Z", zValue)),
new XElement("C")));
It seems easy to read and kinda flows...
I have the following xml:
<DOCUMENT>
<ARTICLE>
<META name="bbb" value="7086" score="0.58" key="6007"/>
<META name="ccc" value="7089" score="0.58" key="6008"/>
<META name="ddd" value="7087" score="0.58" key="6009"/>
</ARTICLE>
</DOCUMENT>
I need to use linq to xml and an xdocument to allow users in an asp.net page to edit ...
I'm trying to check if a user exists from an XML response.
When a user doesn't exist the response is like this:
<ipb></ipb>
What would be the best way for me to (in code) verify that a user doesn't exist? I was thinking of checking if it didn't have any child elements but I'm somewhat confused.
Thanks for the help!
public v...
Given this XML found here.
How can I get each contact item individually?
For example, say I wanted to get only twitter:
I tried this:
return doc.XPathSelectElement("/ipb/profile/contactinformation/contact[type/text() = 'LinkedIn']/value").Value;
But that returns nothing. Any help?
...
Given this XML, how can I retrive the HEX color?
<group>
<span style="color:#DF0000; font-style: italic; font-weight: bold">Webmaster</span>
</group>
I need to retrieve everything inside of the style. Then I can use the String.Substring method with .IndexOf() to retrieve the color for my use.
Thank you for the help.
Incase anyon...
From this XML response: http://www.dreamincode.net/forums/xml.php?showuser=335389
I want to grab all of the users friends. I need to grab all of the information from the friends. Usually with the help I've been given I would use the unique ID to grab each, but since each users doesn't have the same friends it has to be dynamic and I can...
I have the following method that is supposed to parse information from an XML response and return a collection of users.
I've opted into creating a Friend class and returning a List to the calling method.
Here's what I have so far, but I noticed that the ids.ToList().Count method parses every single id element to a List, then does it a...
I am saving my files as xml documents, using XDocument.Save(path), and after saving and loading a document all of the line breaks have changed from "/r/n" to "/n/". Why is this happening and how can I fix it?
...
Hi when I do this:
using (XmlWriter xw = new XmlTextWriter(fcService.SetCIRIFilePath(), Encoding.UTF8))
{
debts.Save(xw);
xw.Flush();
}
My debts object is a XDocument object which I populated using LINQ to XML. However when I save it, it looks fine in notepad, but when opened with a binary/hex e...
The following code produces this output:
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<customers>
<customer>
<firstName>Jim</firstName>
<lastName>Smith</lastName>
</customer>
</customers>
How can I get it to produce encoding="utf-8" instead of encoding="utf-16"?
using System;
using System.Collections.Generic;
...
The following code gives me the error:
The best overloaded method match for
'System.Xml.Linq.XElement.XElement(System.Xml.Linq.XName,
object)' has some invalid arguments.
What do I have to change so I can iterate through my List<Customer> collection with Foreach building the XDocument?
using System;
using System.Collections.Ge...
For an XDocument descendants operation how can only return immediate child nodes?
I have an operation along the lines of:
XDocument xmlDc = XDocument.Load(dependencyFilePath);
IEnumerable<IGrouping<string, XElement>> scriptNodes =
from s in xmlDc.Descendants("script") select s;
The problem is my XML doc is structured as follows
...
I am trying to set XElements with an ArrayList and having a bit of trouble. I basically want to be able to do a foreach loop, but not sure where I need to insert it.
ArrayList cities = new ArrayList();
foreach (ListItem item in lstCities.Items)
{
cities.Add(item.Text);
}
new XElement("Cities", cities //not sure what to do here
...
<?xml version="1.0" encoding="utf-8"?>
<rsp stat="ok">
<image_hash>cxmHM</image_hash>
<delete_hash>NNy6VNpiAA</delete_hash>
<original_image>http://imgur.com/cxmHM.png</original_image>
<large_thumbnail>http://imgur.com/cxmHMl.png</large_thumbnail>
<small_thumbnail>http://imgur.com/cxmHMl...
Hey all
I really didn't want to ask for help as I know I'll eventually figure it out, but I've spent too much time, if the document had parent tags or a better structure, it would be a piece of cake. Sadly I'm downloading the document, and I just can't figure out how to get the data.
I've tried a a few linq queries and a foreach using ...