Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Tuesday, August 30, 2016

Dot in URL in ASP.NET MVC causes 404 error

URLs with dot (.) generate a 404 error. This happens irrespective of whether scaffolding is used or not.

Solution

This can be fixed by enabling RAMMFAR (runAllManagedModulesForAllRequests). The RAMMFAR setting is for per application. Enabling this option will enable all managed modules for all requests. That means static files such as images, PDFs and everything else will be processed by .NET

A smart solution is to add a new HTTP handler that looks for specific path criteria.

Add the following to the site's web.config within the and element


Friday, February 11, 2011

How to create XSD file path as expression for XML Source in SSIS

In your CONTROL FLOW tab, select the data flow step that contains the XML Source step. Do not go into the dataflow, it must be done in control flow.

1. Bring up its properties (right-click > Properties)
2. Click the elipsis button next to EXPRESSIONS
3. Select the [XML Source].[XMLSchemaDefinition] property then hit the elipsis button to the right of the Expression textbox to set the XSD File path
4. Drag and Drop your variable that holds your XSD path into the expression box, you should be able to evaluate expression here.
5. Click OK
6. Click OK again
7. Done

Sunday, August 01, 2010

How to escape XML text in c#?

Escaping XML text is basically encoding the following symbols (<, >, &, ", ').

This can be done in the following ways.

a) Using Replace function

string xmlData = "I live in \"wellington\" & I love listening to music."
string escapedXmlData = xmlData.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """).Replace("'", "&apos;");

Note: Replace the & symbol first.

b) Using System.Security.SecurityElement.Escape() method

string xmlData = "I live in \"wellington\" & I love listening to music."

string escapeXmlData = System.Security.SecurityElement.Escape(xmlData);

Monday, April 26, 2010

Chemistry for Word Addin

Chem4Word addin makes it easier for students, chemists and researchers to insert and modify chemical information, such as labels, formulas and 2-D depictions, from within Microsoft Office Word.

Currently this addin is applicable for Word 2007 and above versions.

It uses Chemical Markup Language which is XML for chemistry. Good to see periodic tables appearing in Word documents.

Beta version of the product is currently available at http://chem4word.codeplex.com/

Demo - http://research.microsoft.com/en-us/downloads/3fe31020-0e51-4ee0-ada3-5cd142bcf930/default.aspx

Thursday, January 28, 2010

Data at the root level is invalid. Line 1, position 1

I got this error "Data at the root level is invalid. Line 1, position 1" when I tried to read an XML file using C#.

Initially I was checking whether the XML is well formed and tried opening in IE to make sure whether it opens fine. IE didn't show any errors and my XML document was fine.

I couldn't figure out what's gone wrong. After a few minutes I realised that I was using XML.LoadXML() instead of XML.Load().

Actually I had my code initially to load an XML string so I was using XML.LoadXML() but changed the logic to load an XML document but forgot to change the code to XML.Load().

XML.Load() - to load an XML File
XML.LoadXML() - to load a XML String