Hi, i was wondering if anyone knows how to stop xmldocument.Save() from reformatting the document.
Its not that the document is not formatted correctly with respect to XML, the particular document i am working with has lots of white space and things like that which - upon save - is all being removed.
...
I'm having to use .NET 2.0 so can't use any of the nice XDocument stuff.
I'm wondering if anyone has seen any helper/utility methods that still use XmlDocument but make xml creation a bit less tedious?
...
Hi,
I've got an XML doc to deal with that contains attributes like:
<action name="foo -> bar">
If I make a simple:
XmlDocument doc = new XmlDocument();
doc.Load(stInPath);
doc.Save(stOutPath);
The attribute string is escaped:
<action name="foo -> bar">
Which is the very thing I'd want to prevent.
Do you know any way to do ...
I'm having trouble getting my program to read this XML file properly, it will need to write to it also but not yet. Just note that this is only a little bit of the code
XmlDocument InstalledList = new XmlDocument();
InstalledList.Load(AppsInstalledFileNamePath);
//Sets the PackageNode to the correct part of the XmlDocument
XmlNodeList ...
I have the following XML that is built up at runtime using an XmlDocument:
<?xml version="1.0" standalone="yes"?>
<NewConfig xmlns="http://tempuri.org/NewConfig.xsd">
<SystemReference xmlns="">
<ID>1</ID>
<Name>CountryName</Name>
</SystemReference>
<ClientList xmlns="">
<Type>Private</Type>
<!-- elements omitte...
I have a object that has a number of properties that aren't present in the xsd file. When doing XmlDocument.Validate is there a way I can tell it to ignore properties that are not present in the xsd and instead just ensure that the properties required by xsd are present in the xml document?
I can get around this by adding [XmlIgnore] at...
I'm querying a Twitter RSS feed and supplying the results into a Repeater for display. I'd like to only get the first 5 results of the XPath query. Is there a way to do that in the XPath syntax or do I have to loop over the resulting XmlNodeList to pull out the first 5?
XmlDocument doc = new XmlDocument();
XmlTextReader reader = new Xml...
I'm getting a null reference exception whenever it tries to add the packages titles info and other attributes but the attributes exist and the proper package is selected
Heres the code:
private void categorylist_listview_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
XmlDocument LoadPackageList = new...
How would i go about to remove all comment tags from a XmlDocument instance?
Is there a better way than retrieving a XmlNodeList and iterate over those?
XmlNodeList list = xmlDoc.SelectNodes("//comment()");
foreach(XmlNode node in list)
{
node.ParentNode.RemoveChild(node);
}
...
Using C#, XmlDocument.Load is throwing this exception: "hexadecimal value 0x3C, is an invalid attribute character".
What's confusing me is it works find in development. What differences should I be looking for on the remote server vs my development environment?
...
I'm going on a couple assumptions here:
XPathDocument is not editable.
XmlDocument is editable.
XPathDocument is more efficient for
XslCompiledTransform.
That being the case (and please correct me if I am wrong), would it be better (more efficient) to:
Make modifications using the
XmlDocument, then convert to an
XPathDocument befo...
Hi,
I have one XML document which I want to store it inside ViewState so on each post back I do not need to load it from its physical path again. I do not want to store it in SessionState as well.
when I tried to srote it in ViewState I get an error:
Exception Details: System.Runtime.Serialization.SerializationException: Type 'System....
I have an xml document like this,
<Customer ID = "000A551"
Name = "Robert"
Salaried = "yes"
Area = "VA"
/>
Please note the how attributes are line-breaked and white-spaced for the editing and reading convenience. When using XDocument or XmlDocument to modify this document whole formatting goes...
Hi,
I have the following xml
<book>
<chapter>this is a sample text</chapter>
</book>
and need to add a namespace to it to be like the one below
<ns0:book xmlns:ns0="http://mybookurl/sample">
<chapter>this is a sample text</chapter>
</ns0:book>
I tried Greco suggestions but it does not work.
http://stackoverflow.com/ques...
I need to save one XmlDocument to file with proper indentation (Formatting.Indented) but some nodes with their children have to be in one line (Formatting.None).
How to achieve that since XmlTextWriter accept setting for a whole document?
Edit after @Ahmad Mageed's resposne:
I didn't know that XmlTextWriter settings can be modified ...
I am trying to load the digg favorites rss items. But getting error as operation timed out.
Please let me know if anyone have solved this issue before.
Public Shared Function HasRssItems() As Boolean
Dim doc As New XmlDocument
doc.Load("http://digg.com/users/Lovelezz/history/favorites.rss")
Return doc.SelectN...
Hi,
I have an xml with various namespaces that i would like to query using .SelectNodes(string xPath)
The problem that i notice is that the xPath query return nothing as long as i have all those namespaces around.
is there anyway to tell XmlDocument.SelectNodes to ignore those namespaces and just get me the correct elements (the ele...
I am working with org.w3c.xml java library
and encountering a few difficulties performing a few tasks:
I have an Element object; how can I remove namespaces from it and the predecessors?
How can I create a Document without the namespaces? I have tried
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
do...
Hi!
I'm working with c# .Net
I have a question,
I'm loading Xml file with XDocument.xDoc.Load(file), but it fails because in my content I also have xml tags:
Example: <root><abc><deg></abc></root>
My problem is that the Load function treats the <deg> as an Xml tag without a matching "</deg>"...
My question is, how can i replace th...
How can I remove the closing tag of element c in a XML document?
The converted XML will go through a schema validation and it is rejected because it has a whitespace within. I'm using C#, .NET 1.1 (I'm updating a legacy application :-( ).
Note: I must not resort to string manipulation to convert the XML document.
Current:
<main>
<...