xmldocument

signedXml.LoadXml((XmlElement)nodeList[0]); returns Malformed SignedInfo/Reference

别来无恙 提交于 2020-04-18 01:08:13
问题 I've been developing this console application for about close to 2-3 months now. What I'm trying to achieve from the console application is to generate data files and sign the files into a "signature.xml" file. It is working using several custom methods to sign (without use of Regedit Key). However, once the number of references goes over 99, it refuses to sign and gives the error "Malformed SignedInfo/Reference..". Even though previously it did work and this error has never surfaced. I've

How to Select XML Nodes with XML Namespaces from an XmlDocument?

爷,独闯天下 提交于 2020-03-07 06:11:32
问题 my code attempts to grab data from the RSS feed of a website. It grabs the nodes fine, but when attempting to grab the data from a node with a colon, it crashes and gives the error "Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function." The code is shown below: WebRequest request = WebRequest.Create("http://buypoe.com/external.php?type=RSS2&lastpost=true"); WebResponse response = request.GetResponse(); StringBuilder sb = new StringBuilder("");

Remove xmlns=“” attribute when adding Reference element into csproj

两盒软妹~` 提交于 2020-01-25 12:21:30
问题 I try to programmatic add the reference of dll into csproj file at time of installation service through the MSI Installer. <Reference Include="TestProject"> <HintPath>..\..\TestProject.dll</HintPath> </Reference> I put below line of source code of add node into protected override void OnAfterInstall(IDictionary savedState) of ProjectInstaller.cs var refnode = xml.CreateElement("Reference"); var attribute = xml.CreateAttribute("Include", null); attribute.Value = "TestProject"; refnode

Reading a particular config element using c#?

本小妞迷上赌 提交于 2020-01-24 21:28:08
问题 Here i have a config file and i am reading that config elements in c#. What i need is to read all the elements based on the host <Brand Host="localhost:64995"> .For example if the host is localhost:64995 i need the nodes inside it like <add Name="aaa" BrandId="13" /> Here is my config <SingleSignOn> <Brands> <Brand Host="localhost:64995"> <add Name="aaa" BrandId="1" /> </Brand> <Brand Host="aaaaa"> <add Name="bbbb" BrandId="2" /> </Brand> </Brands> </SingleSignOn> and my code string host =

Java Document builder returning null Document for Xml String

℡╲_俬逩灬. 提交于 2020-01-24 21:18:52
问题 I have tried all possible answers on Stackoverflow but I can't get this resolved. I have the following xml as a String: private static final String xmlStr = "<parameters>\n" + " <parameter>\n" + " <name>emp</name>\n" + " <keyvalue>John Smith</keyvalue>\n" + " </parameter>\n" + " <parameter>\n" + " <name>age</name>\n" + " <keyvalue>22</keyvalue>\n" + " </parameter>\n" + " <parameter>\n" + " <name>Birth Date</name>\n" + " <keyvalue>02/05/1978</keyvalue>\n" + " </parameter>\n" + " <parameter>\n"

Java Document builder returning null Document for Xml String

血红的双手。 提交于 2020-01-24 21:18:06
问题 I have tried all possible answers on Stackoverflow but I can't get this resolved. I have the following xml as a String: private static final String xmlStr = "<parameters>\n" + " <parameter>\n" + " <name>emp</name>\n" + " <keyvalue>John Smith</keyvalue>\n" + " </parameter>\n" + " <parameter>\n" + " <name>age</name>\n" + " <keyvalue>22</keyvalue>\n" + " </parameter>\n" + " <parameter>\n" + " <name>Birth Date</name>\n" + " <keyvalue>02/05/1978</keyvalue>\n" + " </parameter>\n" + " <parameter>\n"

How can I add new root element to a C# XmlDocument?

旧城冷巷雨未停 提交于 2020-01-24 04:08:29
问题 I have, outside of my control, an XmlDocument which has a structure like the following: <parent1> ...minor amount of data... </parent1> I have another XmlDocument, also outside of my control, which has the following structure: <parent2> ..very large amount of data... </parent2> I need an XmlDocument in the format: <parent1> ...minor amount of data... <parent2> ..very large amount of data... </parent2> </parent1> I don't want to make a copy of parent2. How can I get the structure I need,

How can I add new root element to a C# XmlDocument?

送分小仙女□ 提交于 2020-01-24 04:08:27
问题 I have, outside of my control, an XmlDocument which has a structure like the following: <parent1> ...minor amount of data... </parent1> I have another XmlDocument, also outside of my control, which has the following structure: <parent2> ..very large amount of data... </parent2> I need an XmlDocument in the format: <parent1> ...minor amount of data... <parent2> ..very large amount of data... </parent2> </parent1> I don't want to make a copy of parent2. How can I get the structure I need,

C# hexadecimal value 0x12, is an invalid character

大兔子大兔子 提交于 2020-01-20 16:53:04
问题 I am loading a lot of xml documents and some of them return errors like "hexadecimal value 0x12, is an invalid character" and there are different character. How to remove them? 回答1: I made a small research here. Here is the ASCII table. There are 128 symbols Here is some small test code which adds every symbol from ASCII table and tries to load it as an XML document. static public void RegexTry() { StreamReader stream = new StreamReader(@"test.xml"); string xmlfile = stream.ReadToEnd();

Add sibling after a specific XML node C#

江枫思渺然 提交于 2020-01-17 01:38:08
问题 My xml document looks like this: <root> <parent1> <element1> </element1> </parent1> <parent1> <element1> </element1> </parent1> <parent1> <element1> </element1> </parent1> <parent2> <element1> </element1> </parent2> <parent2> <element1> </element1> </parent2> <parent3> <element2> </element2> </parent3> </root> I would like to add a new parent1 node after the last parent1 node before the first parent2 node. Like this: <root> <parent1> <element1> </element1> </parent1> <parent1> <element1> <