Yesterday I had a talk to a developer at work. She came from the same city as my hometown where I was grown up. She was working on a project to import thousands of XML files SQL database. I recommended my dotNetCommonLibrary.dll, where I have a wrapper class for Json.Net. The wrapper class provides several APIs to convert XML string to an instance of a class and vice versa. I have used this feature to convert many application XML configuration settings to instances.
However, when I saw her XML files, I noticed that those XML files contains namespaces, which are used in XML nodes as prefix. I had never tried those types of XML documents before. Today I tried a simple XML file with a namespace for testing. Unfortunately, it looks like that Json.Net converter does not support XML with namespaces.
Example of XML with namespaces:
<?xml version="1.0" encoding="UTF-8" ?> <Root> <b:Log xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' > ... </b:Log> </Root>
I think this type XML files are very common. I have to find out a way to remove namespaces and use only local names in XML notes for instance mapping by Json.Net
It was a good talk. At least I find my wrapper class has to provide an API to remove namespaces from an XML string.
0 comments:
Post a Comment