Tag Archives: xml

How to use AJAX livesearch with XML attribute names

Questions: I’m trying to modify and use this AJAX live search example to get values from XML file using PHP. Here is the working code example: javascript: function showResult(str) { if (str.length==0) { document.getElementById(“livesearch”).innerHTML=””; document.getElementById(“livesearch”).style.border=”0px”; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=function() { if (this.readyState==4 &&… Read More »

xmlhttprequest.open() should not reload page or direct to requested URL

Questions: I am developing a website and trying to make it as interactive as possible, so the least page reloads or redirections possible. I need to submit a form through the POSTmethod: <form method = “post” id = “form”> #<Text Inputs> <input type = “submit” class = “form-control” onclick = “post_to_url(‘/url/’, $(‘#form’).serialize()); “> </form> And… Read More »

Openxmlsdk: Replace MergeField by html text

Questions: I’m using DocumentFormat.OpenXml to replace merge fields in my template docx file. Step 1, I write method to find merge field var instructionRegEx = new Regex(@”[\w]*\sMERGEFIELD\s+(?<name>[\w]+)”, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); string GetFieldName(OpenXmlElement field) { string outerXml = field.OuterXml; if (!string.IsNullOrEmpty(outerXml)) { Match m = instructionRegEx.Match(outerXml); if (m.Success) { return m.Groups[“name”].ToString().Trim(); } } return… Read More »

InvalidOperationException: There was an error generating the XML document

Questions: I have a web service method defined as follows [WebMethod] public DataTable GetPrintingList() { DataTable DT = new DataTable(); DT = CommonModule.Connection.ExecuteDataTable(“SELECT QUERY”); return (DT); } when consuming this webservice method I am getting exception System.InvalidOperationException: ‘There was an error generating the XML document. after execution of select query I am getting 2 rows… Read More »

How to select XML node with XPath query

Questions: I want to select all user nodes m:properties from XmlDocument object in XMLNodeList object with C#! How to do this? This is my C# code where get xml document: XmlDocument navEmployesXML = GetXmlDataFromUrl(“MYURL”); XmlNodeList nodelist = navEmployesXML.SelectNodes(“/feed/entry”); I try with full path but doesnt working This is my xml document format: <?xml version=”1.0″ encoding=”UTF-8″?>… Read More »

How to get XML markup in single node

Questions: I’m trying to write a tool in C# which will take any XML file (of undefined structure) and will generate a list of the names and values. I have this mostly working, except for instances where the XML contains a description node which has markup within it. Take the following XML example: <TESTROOT> <MAIN>… Read More »

php curl gives 404 but on XMLHttpRequest works

Questions: i have a data acquisition module that gives me some xml data on a http request. the request needs to have user an password. If i try to get the data via javascript on a browser it works. here is the working code: var url = “”; var x = httpGet(url); function httpGet(theUrl, callback){… Read More »

Serialization Object into SOAP XML

Questions: I would like to use web request to call for the SAOP XML request. I have the class RegisterUser [Serializable] public class RegisterUser { public RegisterUser() { userInfo = new UserInfo(); } private UserInfo userInfo; public UserInfo UserInfo { get { return userInfo; } set { userInfo = value; } } } [Serializable] public… Read More »

Custom XML Deserializer

Questions: I’m trying to read xml string from web service and deserialize it. Responses for each request have some common nodes and some changed nodes,I need only common nodes,then I created a class that contains common properties, So have exception on Deserialize, because can’t find property for each node. How can I customize Deserialize to… Read More »

System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name [on hold]

Questions: When I am trying to load the XDocument from the stringReader i get this error: System.Xml.XmlException: The ‘=’ character, hexadecimal value 0x3D, cannot be included in a name. Line 1, position 496. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)… Read More »