I am rewriting an existing XmlDocument, which contains an element that has a new default namespace defined (see below, the assemblyBinding element)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<legacyCasPolicy enabled="true" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBindin...
I'm trying to access UPS tracking info and, as per their example, I need to build a request like so:
<?xml version="1.0" ?>
<AccessRequest xml:lang='en-US'>
<AccessLicenseNumber>YOURACCESSLICENSENUMBER</AccessLicenseNumber>
<UserId>YOURUSERID</UserId>
<Password>YOURPASSWORD</Password>
</AccessRequest>
<?xml version="1.0" ?>
<Tr...
I'm trying to figure out how to properly serialize my XmlDocument and send it via a HTTPWebRequest object.
Heres what I have thusfar:
Stream requestStream;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://wwwcie.ups.com/ups.app/xml/Track");
request.Method = "POST";
request.ContentType = "application/x-www-form-urle...
This is probably along the lines of http://stackoverflow.com/questions/698147/net-collections-and-the-large-object-heap-loh
In .Net, I'm loading an XmlDocument with a string that makes ~200KB text document when the xml is converted to base64. The point being, the string should be allocated to the large object heap. I know from reading...
Sorry to be asking such similar question again, I am trying to read the following XML document:
<markets currency="GBP">
<market id="2908368" nextId="2908395">
<status>ACTIVE</status>
<commissionRate>2.5</commissionRate>
<marketType>ANY_NUMBER_OF_WINNERS</marketType>
<selections type="MainBets">
<selection id="65...
Hi Guys and Girls,
Its been a while since i've needed to do this so i was looking at the old school methods of writing XMLDocument from code down to a File.
In my application i am writing alot to an XMLdocument with new elements and values and periodically saving it down to disc and also reading from the file and depending on the data ...
I have an application which saves documents (think word documents) in an Xml based format - Currently C# classes generated from xsd files are used for reading / writing the document format and all was well until recently when I had to make a change the format of the document. My concern is with backwards compatability as future versions ...
I am building an XmlDocument on the fly in .NET with an xml document. I then transform that with the Transform() method of an XslCompiledTransform.
The Transform() method threw an exception because an invalid character for the encoding was found in the stream. When I copy/paste the string with the help of the TextVisualizer in Visual St...
I have a bit of XML as follows:
<section>
<description>
<![CDATA[
This is a "description"
that I have formatted
]]>
</description>
</section>
I'm accessing it using curXmlNode.SelectSingleNode("description").InnerText but the value returns \r\n This is a "description"\r\n that I have formatted instead...
Many .NET functions use XmlWriter to output/generate xml. Outputting to a file/string/memory is a very operation:
XmlWriter xw = XmlWriter.Create(PutYourStreamFileWriterEtcHere);
xw.WriteStartElement("root");
...
Sometimes , you need to manipulate the resulting Xml and would therefore like to load it into a XmlDocument or might need a...
In C#, how do I replace a node in an xml with another node using XmlDocument.
For E.g, consider the following xml file.
<Products>
<Product ProdID="1">
<Data>abc</Data>
</Product>
<Product ProdID="2">
<Data>def</Data>
</Product>
</Products>
Let us say I need to replace
<Product ProdID="2">
<Data>def</Data>
<...
I have an XmlDocument that is from a webservice, and I want to use a subset of the xml to populate a Gridview control. Unfortunately, it contains extra data that I don't need. So I want to create a new XmlDocument from a subset of the existing xml document.
protected void Page_Load(object sender, EventArgs e)
{
XmlDocument xmlDoc...
For unit testing XmlDocument, I'm a little bit worried about the way I write test case.
To assert the XmlDocument, I'm creating XmlElements manually. sometime the XmlDocument to test is large, so I need to write a lot of code to build an expected xmldocument. the workload is huge.
Is there any better implement on XmlDocument unit testi...
The following code fails with a 'Could not load type 'System.Xml.XmlDocument' from assembly' error:
object a = Type.GetType("System.Xml.XmlDocument", true);
I have a reference to System.Xml in which XmlDocument resides.
Any idea what I am doing wrong?
...
I am refactoring some code in an existing system. The goal is to remove all instances of the XmlDocument to reduce the memory footprint. However, we use XPath to manipulate the xml when certain rules apply. Is there a way to use XPath without using a class that loads the entire document into memory? We've replaced all other instances...
Hi everyone,
I am now learning XMLDocument but I've just ran into XDocument and when I try to search the difference or benefits of them I can't find something useful, could you please tell me why you would use one over another ?
Thanks in advance.
...
I'm receiving data from web-services in XML and I'm using that data via objects, build upon received XML. So, sometimes I need to store such user-specific objects between requests in session. I know that XMLDocument couldn't be stored explicitly (state server)... so I'm making a terrible construction like:
private string _data;
public X...
I've got an XMLTextWriter writing to a Stream of a WebRequest. Everything works as it should:
Dim wr As WebRequest = WebRequest.Create("https://wwwcie.ups.com/ups.app/xml/ShipAccept")
With wr
.Method = "POST"
.ContentType = "application/x-www-form-urlencoded"
End With
Dim requestStream As Stream = wr.GetR...
I just came across with a problem using XmlDocument.LoadXml.
The application was crashing with the following error:
"Data at the root level is invalid. Line 1, position 1"
After inspecting the XML and founding nothing wrong with it I googled a bit and found a tip to use XmlDocument.Load instead of XmlDocument.LoadXml.
I have tried it ...
I have tried and failed to find out how to get the entire XML string from the XMLDocument returned by a GET. There are a lot of questions on SO on how to find or replace specific elements in the object, but I can't seem to find any answer to how to get the entire document as a string.
The example I'm working with is from here. The "do s...