Questions tagged [xnamespace]

23 questions
21
votes
1 answer

Creating XDocument with xsi:schemaLocation namespace

I need to create the following XML and I'm trying to do this using XDocument. However, I'm having trouble specifying the name spaces.
Robin Day
  • 100,552
  • 23
  • 116
  • 167
14
votes
5 answers

Parse XDocument without having to keep specifying the default namespace

I have some XML data (similar to the sample below) and I want to read the values in code. Why am I forced to specify the default namespace to access each element? I would have expected the default namespace to be used for all elements. Is there a…
TeamWild
  • 2,460
  • 8
  • 43
  • 53
4
votes
1 answer

Using XNamespace to create nicely formatted XML

I want to create a Xml file that looks something like this:                How can I accomplish this using XAttribute, XElement, XNamespace, and…
Steven
  • 4,826
  • 3
  • 35
  • 44
4
votes
1 answer

Trouble with namespaces using Linq to XML to create response xml

I'm new to L2XML and not altogether an expert at XML so it isn't surprising I'm having a little trouble. In my first step I'm declaring a relatively simple XDocument object to create a XML method result. Here is a sample of the expected XML.
Dar
  • 383
  • 1
  • 5
  • 16
3
votes
1 answer

XDocument.Validate namespace problems

I have modified the MSDN example to reflect my problem. When using a namespace I can't get the document to validate as I would expect and when validating a document that doesnt have a namespace it validates regardless of whether or not it has an…
baileyswalk
  • 1,198
  • 2
  • 17
  • 29
3
votes
3 answers

Setting XML namespaces with the System.Xml.Linq API

I'm having trouble generating XML along the lines of this: 123456 500000000 This code get me most of the way, but I can't get the…
Dan
  • 29,100
  • 43
  • 148
  • 207
2
votes
1 answer

Creating Xml attribute json:Array using XElement and XNamespace C# classes

I'm trying to build up Xml that looks like the following (taken from another question) but using the XElement/XNamespace classes: Alan
mhapps
  • 1,023
  • 8
  • 15
2
votes
1 answer

How to dynamically set local XML namespace?

I have several xml namespaces that expose the same schema. I want to use a function that dynamically accepts a namespace and applies the attributes or the properties according to the specified namespace: Public Sub ProcessElement(element As…
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
1
vote
1 answer

What is happening when you declare an XNamespace and assign a string value?

Here is the example from MSDN for XNamespace: XNamespace aw = "http://www.adventure-works.com"; XElement root = new XElement(aw + "Root", "Content"); Console.WriteLine(root); I am not sure what is happening in the first line. Is there some kind of…
Aaron Anodide
  • 16,906
  • 15
  • 62
  • 121
1
vote
2 answers

XDocument/xNamespace

Dharani
  • 11
  • 2
1
vote
0 answers

How to add XNamespace (Xml.Linq) to XElement?

Hi i need to create some XML Elements like: ExampleData But my code: XElement newElement = new XElement("Example_Property"); …
happycroc
  • 11
  • 3
1
vote
2 answers

Using c# to read XML that has nested namespaces

I am trying to extract the following values from this XML using C#. Messages - the inntertext success="true" - just the "true" bit status="Released" - just the "Released" bit Namespaces are clearly the issue here - but I can't get it right. Can…
1
vote
1 answer

XDocument namespace c#

i write some application on MVC and i need to make that stuff which i write i need to get xml response like this:
NoNameR
  • 85
  • 12
1
vote
1 answer

Linq to XML, parsing with XNameSpace

I am working on parsing this XML from this weather link "http://alerts.weather.gov/cap/us.php?x=0". I found a good sample code and it works great for parsing 'tile' and 'cap:event' except I needed to parse the 'cap:geocode' and get a list of…
QUEST202
  • 11
  • 1
1
vote
1 answer

Add namespace with colon to xml file

I need to generate a xml file that looks like this: ValueA ValueB This is my code: const string ns =…
sventevit
  • 4,766
  • 10
  • 57
  • 89
1
2