I'm working on two large 3rd party schemas, one includes the other and generates a large number of type name collisions. If I could set the package on a namespace this problem would go away.
I hoped something like
<jaxb:bindings namespace="http://www.openapplications.org/oagis/9" >
<jaxb:schemaBindings>
<jaxb:package name="org.oagis" />
</jaxb:schemaBindings>
</jaxb:bindings>
would work, or perhaps
<jaxb:bindings node="/xsd:schema[#targetNamespace='http://www.openapplications.org/oagis/9']">
<jaxb:schemaBindings>
<jaxb:package name="org.oagis" />
</jaxb:schemaBindings>
</jaxb:bindings>
But no joy.
Trying to set on the individual xsd files in that namespace left me with the dread
[ERROR] Multiple <schemaBindings> are defined for the target namespace "http://www.openapplications.org/oagis/9"
Pointers/suggestions are appreciated.
This is a bit hard to answer without seeing the whole compilation. However I often got this error when compiling third-party schemas in the case when the same schema was included via different URLs.
I.e. I've implemented a project which compiled an extensive set of OGC Schemas. The problem was that these schemas referenced each other via relative and absolute URLs. So when I customized one of the schemas there were other schemas for the same namespace URI. Since JAXB processes imports and includes, it is not quite transparent what exactly gets compiled. Try to check your XJC logs for cues or - if you compile schemas directly via URLs (which is not recommended) - go through a logging proxy and see what actually gets accessed.
Related
For legacy reasons, I'm maintaining a Web Site Project for which I want to provide up-to-date documentation from the XML documentation comments. I gather I can do that by tweaking the <compilers> section in web.config. I finally reached this point:
<system.codedom>
<compilers>
<compiler
language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider"
compilerOptions="/optimize /doc:C:\temp\my-output-here.xml"
warningLevel="1" />
</compilers>
</system.codedom>
Now when I start the website with (and thus invoke just-in-time compilation) I do get an XML file in the requested location but it's minimal:
<?xml version="1.0"?>
<doc>
<assembly>
<name>App_global.asax.abqhzva4</name>
</assembly>
<members>
</members>
</doc>
It seems like the <compiler> tag doesn't quite do what I want. It must be generating XML for the project folder itself rather than the .cs files, or it's getting overwritten with each compilation unit and I'm only seeing the trivial last one, or... I don't know. I'm not sure. This config tag is not well documented.
Long story short, I'm looking for a way to get XML documentation for all the .cs files in this website project. It doesn't matter if it's all in one file, in separate files, or even shoved into memory at run time.
I'm aware of the prior question on this, but the link provided there has been redirected to the Sandcastle site. That's great, but it's way more than I'm actually going to use on this project. Simply getting XML documentation at build time or run time is all that is necessary.
My question then is: What do I need to do to get the <compiler> config entry to generate XML docs for a Website Project?
I have an ugly workaround as well... But here goes!
1. Download the latest Sandcastle Installer from this page - https://github.com/EWSoftware/SHFB/releases
2. Unzip and run the installer
3. Copy EWSoftware.CodeDom.dll into your website's \bin directory. The default location of this file is - C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\Extras\EWSoftware.CodeDom.dll
4. Modify web.config as follows:
<configuration>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
compilerOptions="/docpath:C:\Publish\Docs"
type="EWSoftware.CodeDom.CSharpCodeProviderWithDocs, EWSoftware.CodeDom"
>
<!-- NOTE: Change version value as needed (v3.5, v4.0, etc.) -->
<providerOption name="CompilerVersion" value="v4.0"/>
</compiler>
</compilers>
</system.codedom>
</configuration>
Source: http://ewsoftware.github.io/EWSoftwareCodeDom/html/40ba6bda-95d6-4a64-834f-f7cedcb589d1.htm
5. Rebuild your solution and voila! The folder specified with the /docpath option will contain your XML documentation.
I know I have seen this somewhere before, but I cannot find it again. I need an example of calling an xsd file from within another xsd. This is quite useful where a number for xml files are being generated, but where there is large common areas between these xml files being validated. In that scenario, it is useful to have an xsd that validates the parts common to all xml files, then have separate smaller xsd validation files for the parts of the xml that are specific to each xml file.
Thanks
I'd probably call it referencing another XSD file (calling implies that the XSD is run or executed in some way, which isn't the case).
In any case you are probably looking for either the import or the include elements, for example:
<?xml version="1.0"?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://www.w3.org/2001/05/XMLInfoset" xmlns="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.example.com/IPO" />
<xs:include schemaLocation="example.xsd" />
</xs:schema>
What is the difference between import and include? Use import to reference declarations in a different namespace and include to reference declarations in the same namespace.
I have a .xsd file and need to convert it to WSDL. How can I do that? Is converting it even the right approach? The .xsd file contains both request and response data.
You can not do that so easily. Usually, the xsd defines the structure (type) of the input and output messages. The wsdl used the xsd to define the operations that will be exposed by the service. An operation has usually a name and a pair of input and output messages.
I don't see how a tool could "reconstruct" the operations out of only the xsd only, except if it uses naming convention. E.g. messages requestDoIt and responseDoIt --> operation DoIt. If the xsd already contains the operations (which would be unusual) that could be ok, but it doesn't seem to be your case.
Manually creating the wsdl shouldn't be too long.
<types>
<xsd:schema xmlns="..." targetNamespace="...">
<xsd:import namespace="..." schemaLocation="MySchema.xsd"/>
</xsd:schema>
</types>
...
<wsdl:portType name="...">
<wsdl:operation name="doIt">
<wsdl:input message="tns:requestDoIt"/>
<wsdl:output message="tns:responseDoIt"/>
</wsdl:operation>
</wsdl:portType>
Have a look at WSDL essentials to get the general structure of the wsdl.
Or you can give a try to the tool WSDL Generator (from http://www.theprogrammerfactory.com/) whose purpose is apparently to ease this task. (Note that I never used it).
Another approach would be to generate classes out of the xsd, then use them to define the service class manually (this is the tedious part of matching types together into the corresponding operation) and then use another tool to transform the service class back into a complete wsdl. There are various tools available to convert to/from xsd and wsdl, for both Java or C#: wsgen, wsimport, xsd.exe, wsdl.exe.
Web Services Description Language Tool (Wsdl.exe)
I realized in C# "XMas XSD Schema Tool" to incorporate an XSD Schema structure into a WSDL file.
The WSDL file produced includes minimal structures to be used in a web service consumer tool.
If you want to try it for free, you have the manual and download link here: https://www.nick4name.eu/downloads/xmas_en/
Let me know your opinion.
I am using trang to convert a RELAX NG .rng file to an XML Schema .xsd file for use with JAXB. Is there a way to put attributes/elements in the .rng file and have them show up in the .xsd file? I have an external .xjb file that I use for JAXB settings, but there are some JAXB settings that are very closely coupled to the schema itself and it seems like it makes more sense to (somehow) put them in the .rng file rather than the .xjb file.
Any advice?
My opinion is that what you're doing now is the best way and you should keep your JAXB customizations separate from your RELAX NG schema. JAXB customizations in an XML Schema are ugly at best, distracting and confusing at worse. With RELAX NG, there's much less of a mapping and my guess is that you'll still need to put some of the customizations in a separate JAXB customization file, which means that your customizations will be in two different files.
Right now I have a visual studio project which contains a custom content type that I made. It also contains all the necessary files for making a sharepoint solution (wsp) file and a script to generate this.
Now, I would like to do 2 things.
First, I'd like to create a custom display form for the content type and include it in my solution so that it is automatically deployed when I deploy my solution. How do I include this in my solution and make my content type use it?
Secondly, you can query this type with the CQWP. I've thought about exporting it, adding more common view fields, and then modifying the XSL that is used to render it. How do I include this into my solution so that it is also deployed. I know i can export the CQWP webpart once it's all setup and include it in my project as a feature. But what abuot the XSL?
Looking forward to see your suggestions, cheers.
Did as described in the first answer. Worked like a charm.
Use STSDev to create the solution package.
That should help with creating the WSP. The custom form, CQWP webpart and the .xls file should also be deployable within the project.
To deploy the xslt, your feature will have an
<ElementManifest Location="mywebpartManifest.xml">
This then points to a files such as
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="Yourfile.xslt" Url="Style Library" Path="" RootWebOnly="TRUE">
<File Url="yourfile.xslt" Type="GhostableInLibrary" />
</Module>
</Elements>
for the webpart:
<Module Name="myWebpart" List="113" Url="_catalogs/wp" RootWebOnly="FALSE">
<File Url="myWebpart.webpart" Type="GhostableInLibrary" />
</Module>
Now that file will need to be contained in the solution manifest.xml. This is done automatically from the STSDev project.
e.g.
<Resources>
<Resource Location="SimpleFeature\Feature.xml"/>
The actual schemas are:
Site
Solution
Feature
and a link to someone else with the issue
But where in the folder structure do you deploy the form and the .xsl to?
I have followed your guide and although it deploys the xslt to the feature in 12 Hive it does not place it in the correct style library folder
You need to deactivate / reactivate the feature. This will give you any error messages that are associated with copying the file over.