Visual Studio 2008 Read values from XSD file - xsd

First post. I am trying to read the values of any XSD in Visual Basic. I want the application to read back values like complextypes, elements etc. I have been looking at MSXML2 but most examples include validation against a XML file. I only want to read XSD and get information. Will xml reader be able to read a XSD file? Any help be great.

It depends a lot on what you're trying to do with this information, therefore the prerequisites you need to have in place before doing it.
For all but really trivial tasks, I recommend the use of classes in System.Xml.Schema namespace, particularly start with XmlSchema and XmlSchemaSet. This would allow you to manipulate XSDs any way you want; it would also allow you to validate the schemas before using them, if it would prove to be a requirement.
For completeness, and for what I would call very simple tasks, you may also think that XSD is just XML, so then any XML processor should allow you to load an XSD and interogate it as needed.
All of the above, since you've mentioned VS2008, would be on Visual Basic.NET. If you're still on Visual Basic and need to rely on MSXML, then I would refer you to this article on using Visual Basic and SOM.

Related

Handling Excel Spreadsheets with Cucumber

I am planning to work on the Cucumber feature file with Groovy code (Katalon Studio) for step definitions. I wanted to use the excel file in Cucumber file or to see is there any other option to use it.
I have not yet tried as of now any other option. I am thinking just passing the cucumber step file without any parameter and then using the excel file with in the step definition and access excel file and get the corresponding value.
I see there is a post in this forum suggesting to use QMetry Automation Framework for this type of question. But it does not look like this will help on this or should I use the passing the row index from cucumber file and based on that retrieve the value. Please guide on this.
Handling excel spreadsheets with Cucumber Scenario Outline
You should know that this is not supported by Cucumber.
As specified in the FAQ:
"We advise you not to use Excel or csv files to define your test cases; using Excel or csv files is considered an anti-pattern.
One of the goals of Cucumber is to have executable specifications. This means your feature files should contain just the right level of information to document the expected behaviour of the system. If your test cases are kept in separate files, how would you be able to read the documentation?
This also means you shouldn’t have too many details in your feature file. If you do, you might consider moving them to your step definitions or helper methods. For instance, if you have a form where you need to populate lots of different fields, you might use the Builder pattern to do so."
If you are using cucumber java 5+ you can add qaf-cucumber dependency. It should work with groovy as well. It will enable to have examples from external source like CSV, XML, JSON, EXCEL, DB.

How to convert XBF (XAML Binary Format) to XAML

With Windows 8.1 release, there are some new API changes/Added. As per new Addition, there is new feature called as "XAML Binary Format" which will improve performance of rendering on screen. XamlBinaryWriter class is responsible to convert into XAML Binary Format.All the XAML files will be converted to XBF. Has Any one Tried in Converting XBF file into XAML File. I have some dependency on XAML File.I cannot proceed without in XAML format. Please let me know how to convert XBF to XAML File.
As a starting point, download and install Microsoft's .NetNative, the ReducerEngine.dll installed as a part of that thing includes some primitive implementation of the decompiler.
However, the MS' implementation is very poor, it doesn't even support XAML namespaces. You can use the Microsoft's implementation to learn the structure of an XBF file, for decompiling however I suggest you implement your own solution. It's not that hard, mine is about 1000 lines of code in 12 C# files.
XBF files are rather simple. They contain a fixed header, followed by 6 lookup tables (strings, assemblies, type namespaces, types, properties, XML namespaces), followed by the DOM tree part, where objects reference values from those tables by integer keys.
P.S. The most interesting question I have about that, is why did Microsoft choose to reinvent the wheel instead of using their .NET Binary XML format or the subset of it? They have binary XML implementation for many years, and technically it's better format then XBF.

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.

Sandcastle, /doc, and Unmanaged C++

I work on a project that uses unmanaged visual C++ and a smattering of C#. We are trying to come up with a way to document our project, both the API reference, as well as some additional conceptual documents. Ideally, all of the documentation would live together in a .chm file that we could distribute with our product.
I was already familiar with Doxygen, as a long time C++ developer. Someone suggested that I look into Sandcastle as well, but I've run into a few snags.
From a number of other sources, including other posts on this site, it's well known that sandcastle does not support unmanaged C++. I did find a post that seems to indicate that you can still cram the C++ documentation into sandcastle, by adding the API reference as conceptual topics.
Using Visual Studio 2010, you can turn on the /doc option in the project settings for your unmanaged C++ project. This produces .XDC files which studio then compiles into an .xml file that goes along with your lib/dll/exe. Where I am stuck is that is unclear what exactly you can do with this xml file. Some pages I've found online suggest that you may be able to use this file for intellisense, but I've never seen that work in unmanaged C++. I was hopeful that I might be able to use this .xml file in Sandcastle Help File Builder somehow, but I can't find any examples of how that's done online, and every attempt I've made with SHFB has failed. It seems to only want MAML or HTML files if I want to add an existing conceptual help file.
So my question:
Is there a way to get my /doc generated .xml file into my SHFB help solution?
If not, what is the point of the /doc option for unmanaged C++?
Is there some kind of transformation I can do on my /doc generated .xml file to produce HTML or MAML which I could then import via SHFB?
Can this work, or should I just go back to Doxygen?
In theory, Sandcastle could be used to document unmanaged code but it would require a tool to produce the equivalent reflection data file that is currently produced by the MRefBuilder.exe tool for managed code assemblies. So far, nobody has done that to my knowledge.
I can't comment on the lack of IntelliSense for unmanged C++ since I don't use it anymore. At a guess, /doc is probably there for the managed code output assuming the same compiler is used but with a few extra command line options.
Using XSL to transform the XML comments to MAML is a possibility but, again, it's an option I'm not aware of anyone pursuing. My guess is that most opt to use Doxygen in this case since it's an established solution.
Eric
I have a similar situation. I need XML documentation in my C++/CLI bindings so .NET code can see them with Intellisense. But FYI, Visual Studio 2010 doesn't support XML documentation in native code:
https://msdn.microsoft.com/en-us/library/ms177226(v=vs.100).aspx
Visual Studio 2010
In Visual C++, you can add XML
documentation (triple-slash) comments to your source code and instruct
the compiler to output them to an .xml file. This file can then be
input to a process that creates documentation for the classes in your
code. The IDE for Visual C++ in this version does not support XML
comments in Intellisense.
That limitation was removed in Visual Studio 2013. However, it's still an annoying ecosystem to work with if you use templates in the native code (e.g. Boost libraries):
In the current release, code comments are not processed on templates or anything containing a template type (for example, a function taking a parameter as a template). Adding such comments will result in undefined behavior.
I found your question while searching for a way to temporarily disable the XML comment parser with a #pragma or #define when including such libraries.

How to read an Open Office spreadsheet?

How can I read an Open Office 3.0 spreadsheet (.ods) from Groovy? I'd like to select specific columns from a named worksheet. Ideally, it would be useful to add a 'where' clause, or other criteria clause.
I've never used it, but Open Office has a Java API, which of course you could use from Groovy as well. It looks like the best places to start reading are the Developer's Guide, the Java UNO Reference, and the samples in Java and (hey!) Groovy. Hope that helps!
Might be something here at Spring Factories or here at Groovy and JMX. There is a forum for Groovy and Open Office.
Could you export the table / spreadsheet as SQL entries then use that. You could also look at this plugin for goovy -- http://www.ifcx.org/
OpenOffice documents are ZIP files which contains the document data as XML plus some other files (style sheets for word documents). Details can be found here.
The main problem with calc is formulas. If you just have tabular data, then you can simply read the cell values and use that. So you can open the ZIP archive, read the content.xml in it and parse that with any XML parser.
But when a cell contains a formula, then you need to execute it. In this case, you will have to open the document via the UNO API. Here is the Java version. There is a link where you can download example code that explains how to open ODF documents and how to examine their content. There are also snippets but none of them show how to examine a sheet.
The main disadvantage of UNO is the documentation. Each method is explained somewhere but you have to find the method which solves your problem, first.
Since the title does not mention Groovy (only question specifics does), I didn't want to make this a new question.
How to generally read an Open Office spreadsheet document? There are tools for creating one (ooo-python) but not for reading one. They are XML but just bluntly diving into that and trying to get the right logic of extracting the data I want seems so sub-optimal.
What I'd like is features similar to Excel COM support, but from a command line tool (or scripting language).

Resources