Consuming .ashx files in C# - xsd

I need to consume / parse .ashx files in C#. I could create strongly typed C# class by using xsd.exe and add this to my project. But the schema of the .ashx could change at anytime.
So, I don't want to create C# classes using command line utility like xsd.
Is there any way i can create C# class on the fly from a .ashx and use the class to parse the .ashx content?.

I assume that what you need to parse/consume is the XML produced by the .ashx handler.
There is no way I know of to generate a class directly using .NET functions - you could call xsd.exe and then load and compile the generated code - quite a hack.

Related

Create an memo document using MIME

Is there any way to create a document (memo) using MIME?
We want to 'journalize' emails from Outlook 365 (I have managed to create an addin that can send MIME format to Domino via REST API), however I'm not sure how to convert it to a memo document.
So far the only helpful thing I found is this post: Importing EML files into Notes (lots of them). It makes similar transformation (EML to Doc), so I guess I can find needed part and re-use it.
But before I do that - are there any other ways that can do such transformation?
Thanks!
The LotusScript object model includes a NotesMIMEEntity class (MIMEEntity in Java) for creating MIME parts in a document. However, the LotusScript object model does not include a MIME parser. Stephan Wissel's example uses the mime4j library to parse MIME. Then he uses MIMEEntity to create each part. I think you will have to do something similar.
MimeMessageParser.java is another example that writes MIME to a Notes document. This class is part of the XPages Extension Library. It also uses the mime4j parser and MIMEEntity. It just uses a different approach to parsing. It might be useful to compare MimeMessageParser with Stephan's code.
By the way mime4j itself has been included in Domino since 9.x, but it is packaged as part of the OSGi framework. If you are implementing an OSGi plugin it's easy to add a dependency on the org.apache.james.mime4j bundle. If not OSGi, you may need to get your own mime4j jar (or find a different MIME library).

JUnit Test Class template not converted to Kotlin file in Kotlin project

If I open a Kotlin project and try to create my own template for JUnit Test Classes I get the generated template generated as a Java file instead of as a Kotlin file.
Is there any way to make this generation to happen as a Kotlin file?
I attached some images to easily show the issue I am facing.
The question marks on one of the images have to do because I don't know what that default parse function does. I tried to change it to #parse("File Header.kt") but that does not work.
The issue was I was trying to add kotlin code to the template.
All I had to do is create the template using Java code and it automatically gets generated in Java.
However, if anyone know a way to specifically use this feature using your own kotlin code instead of generated one, please let me know.

Generate DDIC structure from XSD?

I have a number of XSDs that are part of the enterprise definitions for several services at the client.
I would like to be able to take a single XSD and generate a DDIC structure from it (without the use of PI!)
Seeing as you can generate proxies directly from a WSDL, and this also generates structures and data elements from the XSD definitions inside the WSDL, there is obviously already ABAP code that does this.
But do you know what classes/function modules to use to achieve this? Perhaps there is a convenient utility function or class method that takes the XSD as input and generates the relevant DDIC objects?
Some background on why I need this:
Some of the services include variable sections that include a piece of XML containing the data for one of the enterprise XSD entities; I am hoping to have a DDIC representation of these, which I can fill at runtime and then convert to XML to include in the message.
There is a program on the system called SPROX_XSD2PROXY with which you can upload one or more XSD files which will generate proxy objects for you.
You also end up with a service consumer with a corresponding class and what looks like a dummy operation.
The program is fairly short; it uploads the files(s) to an XSTRING, then converts the XSD(s) to WSDL(s) and finally the WSDL(s) to proxy objects using methods of a class called CL_PROXY_TEST_UTILS.
However, the result is satisfactory as it does give me a structure I can work with. And by examining the contents of those methods, it may be possible to build a more fine-tuned tool if I need one.

Parsing Excel files in monotouch

Are there any good ways of parsing Excel files in monotouch? Seems like most methods to work with Excel is based on using the Excel Object Library. Doesn't seem like that's even an option in monotouch? I read that objective-c doesn't have any native support for Excel-files, so don't know if that would change anything?
You would need to either
write your own
find an obj-c library that does it and write MT bindings for it
find a open source .NET library and port it to MT
If all you want to do is display a file, you can use the existing iOS document APIs to do it.
The newest Office formats are XML based, so depending on how complex the files are, writing your own parser might be feasible to do.
I ended up just writing the middle step, a web service that fetches the Excel file, parses it and serves up the content as xml/json.

Load XML file into object. Best method?

We are receiving an XML file from our client. I want to load the data from this file into a class, but am unsure about which way to go about it.
I have an XSD to defining what is expected in the XML file, so therefore i can easily validate the XML file.
Can i use the XSD file to load the data into a POCO, using some sort of serialization?
The other way i was thinking was to load the xml into a XMLDocument and use XPath to populate each property in my class.
Cheers for any advice
Depending on how complex the XSD is, you have a couple of options:
Use xsd.exe to generate C# classes which can be used in conjunction with the XmlSerializer.
Use svcutil.exe with the /dconly argument to generate DataContract-attributed types appropriate for use with the DataContractSerializer.

Resources