How do I fix this XML schema? - xsd

I am trying to use JAXB on my XML schema with IntelliJ Ultimate. This is the schema from the IndoorGML website. However, the IDE says there is something wrong with it.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.opengis.net/indoorgml/1.0/core"
xmlns:gml="http://www.opengis.net/gml/3.2" elementFormDefault="qualified" version="1.0.3">
<xs:annotation>
<xs:documentation>
IndoorGML is an OGC Standard. Copyright (c) 2014,2015,2016,2018 Open Geospatial Consortium. To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
</xs:documentation>
</xs:annotation>
<!--
======================================================================
-->
<xs:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
<!--
======================================================================
-->
<xs:element name="IndoorFeatures" type="IndoorFeaturesType" substitutionGroup="gml:AbstractFeature"/>
<!--
</xs:schema>
In the last line in substitutionGroup="gml:AbstractFeature", the IDE marks AbstractFeature in red with the message "Cannot resolve symbol 'gml:AbstractFeature'". Does anyone know why? (The XSD file has more tags before the closing schema tag which I didnt' put here because it's a couple hundred lines.)
Thanks in advance! :)

The reported error is on this reference: substitutionGroup="gml:AbstractFeature"
...which is attempting make 'IndoorFeatures' a member of a substitution group that is defined in another namespace.
But which namespace? The namespace identified by the prefix 'gml'. And which namespace is that? The answer is here: xmlns:gml="http://www.opengis.net/gml/3.2"
So we need to find out where that namespace is imported into this XSD. That is done here:
<xs:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
I think the reason for the error is fairly obvious now, but I will go ahead and complete the answer. The XSD which defines that namespace is identified here:
schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"
Clearly, your application cannot resolve that URL or is not allowed to access it.
How can you fix it?
If you can get a copy of the XSD then you can either
a) save it to a local folder and change the schemaLocation attribute to point to the local folder, or
b) Define a schema resolver that maps the URL to your folder location.
Not sure whether IntelliJ supports schema resolvers, but I expect it does.

Related

XSLT 3 how to write a package

I tried to learn package then I started and copied the working example from the xslt 3 specification but I cannot use the package.
In the template where I use I got an error:
The package cannot be found.
What did I do wrong? I expect something with name or xmlns declaration
The only thing I changed is http://example.com/csv-parser to http://flexibatch.com/fhx-parser and its related xmlns declaration.
Flexibatch.com is as fictional as example.com
Thanks for your help
If you are running Saxon 9 inside oXygen, then I think one option to use packages is the create and use a Saxon configuration file (oXygen supports creating that file type with new file -> Saxon configuration where you have an option to open the section [xsltPackages] where you can then relate the name of a package to a sourceLocation or exportLocation).
Then in the transformation scenario in the extended Saxon options you can specify the Saxon configuration file to use and that way Saxon will know how to find any package your main module uses with xsl:use-package (https://www.w3.org/TR/xslt-30/#element-use-package) because it can relate the URI/name given there to a package location.
It is a bit of a complicated setup, perhaps add a tag for oXygen so that their support guys see your question and can tell you any more or easier options.
An example section from a Saxon config file to use the package directly from the XSLT 3 test suite is
<xsltPackages>
<package name="http://example.com/csv-parser" version="1.0"
sourceLocation="https://github.com/w3c/xslt30-test/raw/master/tests/decl/package/package-100.xsl"/>
</xsltPackages>
of course you can adapt the source location if you have a local file and you need to adapt the name if you have done that as your question suggests.
The XSLT code to use that package is online viewable at https://github.com/w3c/xslt30-test/blob/master/tests/decl/package/package-100a.xsl (or executable/downloadable at https://github.com/w3c/xslt30-test/raw/master/tests/decl/package/package-100a.xsl) and is
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:csv="http://example.com/csv"
exclude-result-prefixes="xs csv" version="3.0">
<xsl:output indent="yes"/>
<!-- example input "file" -->
<xsl:variable name="input" as="xs:string"
>name,id,postal code
"Abel Braaksma",34291,1210 KA
"Anders Berglund",473892,9843 ZD</xsl:variable>
<!-- entry point -->
<xsl:template name="xsl:initial-template">
<xsl:copy-of select="csv:parse($input)"/>
</xsl:template>
<xsl:use-package name="http://example.com/csv-parser" package-version="*"/>
</xsl:stylesheet>
So you could start a transformation scenario in oXygen with the XSLT code linked directly from https://github.com/w3c/xslt30-test/raw/master/tests/decl/package/package-100a.xsl and the Saxon 9 specific settings using a configuration file with the above section.
It works with the config file but now I get an error message: « Cannot apply cascading transformation. Reason: .org.xml.sax.SAXParseException; systemId: file:/C:/..../Test-Package.xsl_xslt_cascade; lineNumber: 3; columnNumber: 9; Content not allowed in prolog. » (line 3 is xmlns:xsl=....)

Xamarin.iOS versioning during build

I've been trying to get an automatic versioning system going for builds (mainly due to external crash analytics picking up each build as the same until I change the version manually). The format is simple, I take the CFBundleShortVersionString from the Info.plist, and append the current date and time (in yyyyMMddmmss format) as subversion.
The task I've put together for this:
<Project>
<Target Name="BeforeBuild">
<XmlPeek XmlInputPath="$(ProjectDir)Info.plist" Query="//dict/key[. = 'CFBundleShortVersionString']/following-sibling::string[1]">
<Output TaskParameter="Result" ItemName="VersionNumber" />
</XmlPeek>
<PropertyGroup>
<BuildNumber>$([System.DateTime]::Now.ToString(yyyyMMddmmss))</BuildNumber>
</PropertyGroup>
<XmlPoke XmlInputPath="$(ProjectDir)Info.plist" Query="//dict/key[. = 'CFBundleVersion']/following-sibling::string[1]" Value="$(VersionNumber).$(BuildNumber)" />
</Target>
</Project>
However it fails with the following error:
Target BeforeBuild:
[...]/[...].csproj(1069,5): error MSB3733: Input file "[...]/Info.plist" cannot be opened. For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.
Done building target "BeforeBuild" in project "[...].csproj" -- FAILED.
What am I doing wrong? There's not much info about this error, at least not much that I could find and would help fixing it.

Distribute SQL_SSDT Code Snippets using vscontent (lang attribute error)

I'm trying to distribute some SQL_SSDT Visual Studio code snippets using .vsi and .vscontent files, but I'm getting an error while installing:
The .vscontent file either contains invalid attributes or specifies a code snippet for a programming language that is not installed.
The .vscontent file is based on the documentation provided by Microsoft How to: Distribute Code Snippets
The sample on this site is the following:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName> </FileName>
<DisplayName> </DisplayName>
<Description> </Description>
<FileContentType> </FileContentType>
<ContentVersion>2.0</ContentVersion>
<Attributes>
<Attribute name="lang" value=""/>
</Attributes>
</Content>
</VSContent>
My file looks like this:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName>SSDTTest.snippet</FileName>
<DisplayName>SSDTTest</DisplayName>
<Description>SSDTTest</Description>
<FileContentType>Code Snippet</FileContentType>
<ContentVersion>1.0</ContentVersion>
<Attributes>
<Attribute name="lang" value="SQL_SSDT"/>
</Attributes>
</Content>
</VSContent>
I'm using the value SQL_SSDT since this is the required value in the .snippet files (<Code Language="SQL_SSDT">).
The installation starts as expected (double clicking on the .vsi file), the VS Content Installer pops up, lists the included content. The error occurs after hitting Finish. (Installation starts, but the above error pops up after a few seconds.)
The snippet is working fine if I copy it to the default snippet folder for SSDT (Documents\Visual Studio 2012\Code Snippets\SQL_SSDT\My Code Snippets) or if I'm adding it via snippet manager in SSDT, but the .vsi installation fails using the above file.
Am I missing something?
Installed VS products on this box:
SSDT
SSDT-BI
VS Express for Desktop (2012)
Update
I found the XML schema reference for the .vscontent files (VS2012), and it seems that the SQL_SSDT is not a valid value for the Lang attribute. It suggests that there are only four values available for the lang attribute. (csharp, jsharp, vb, xml).
Now the question is: Does SSDT add any extensions to this XML schema?
It seems that VS Content Installer has no support for deploying SSDT code snippets. There is a posted idea on visualstudio.uservoice.com which requests this feature, but it is still open.
I did not found any other resources related to this issue.
There is a possible workaround, which needs testing: You can create a PS/BAT which copies the snippet files into the VS's snippet folder for SSDT.

IIS web.config, any other % symbols apart from %s?

Regarding the scriptProcessor in the handlers section of IIS's web.config, are there any % symbols apart from %s (which seems to represent the requested filename)? For example, is %a a recognised macro/symbol? If there are others besides %s, where are they described?
Your question is a bit unclear, so I had to make a number of assumptions in order to answer it. Please let me know if I got anything wrong.
From the documentation:
Script Processor
Optional string attribute.
Specifies the physical path of the ISAPI extension .dll file or Common Gateway Interface (CGI) .exe file that processes the request.
The scriptProcessor attribute is required only for script map handler mappings. When you map a handler to an ISAPI extension, you must specify ISAPIModule for the modules attribute. When you map a handler to a CGI file, you must specify CGIModule for the modules attribute.
From the documentation, we don't see any mention of format strings at all. If there were format strings, what would you replace them with? There's no clear answer based on the XML. Perhaps you're mistaking an environment variable for a format string. Or your particular configuration setup has some post processing that's ran on it before it's pushed live.
If we are actually talking about environment variables, then you can view them by issuing Win+Break to bring up system settings, go to advanced, then open up environment variables. You may also define your own. To use any environment variable you can use %variablename% as you would in a standard .bat file.
EDIT: Upon greater research, I've found the following. %s will give you the script name, then %s again will give you the parameters foo=bar. This feature isn't advertised (that I can find) in any official IIS documentation. I strongly suspect that it's considered a deprecated feature. And they're pushing hard to make ISAPI the norm.
Because of how it's structured (ie like a standard format string) I suspect that trying other common format strings (%d %c %f) might yield you something interesting, but probably not. It looks like this was a very specific solution to a very specific problem.
It's not strictly related to your question but I post these 2 links as they are in some way connected and could be useful.
I've found how to use "#" and "$" to transform Web.Config, but I've found nothing on "%" that's not strictly related to environment variables.
First link: "#"
This first link explains the use of xdt:Transform and xdt:Locator attributes that you can use in Web.config transform files:
http://msdn.microsoft.com/en-us/library/dd465326.aspx
This example is an interesting use of Web.Config transformation using Conditions with "#":
<configuration xmlns:xdt="...">
<connectionStrings>
<add name="AWLT" connectionString="newstring"
providerName="newprovider"
xdt:Transform="Replace"
xdt:Locator="Condition(#name='oldname'
or #providerName='oldprovider')" />
</connectionStrings>
</configuration>
Second link: "$"
This second link shows how to use "$" to transform Web.Config avoiding the boring procedure to manually comment/uncomment Web.Config parts when deploying or testing in different servers:
http://andrewtwest.com/2010/02/25/using-web-config-transformations-in-web-site-projects/
An extract of the link, showing how to use MSBuild to transform Web.Config files starting from a Web Application project file:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\</OutputPath>
</PropertyGroup>

CruiseControl.NET and Clearcase configuration

I'm having problems simply configuring the server for CruiseControl.NET. I am using the source block that is given by ThoughtWorks to set it up, but I cannot seem to get it to be error-free. I am pretty new to all this and some sort of direction would be fantastic.
Does anyone use this combination?
Do you have a ccnet.config file I can look at?
This is what does not work for me:
<cruisecontrol>
<project name="test">
<sourcecontrol type="clearCase">
<exec>batch file</exec>
<viewPath>path_name</viewPath>
<branch>main</branch>
<autoGetSource>false</autoGetSource>
<useLabel>true</useLabel>
<useBaseline>false</useBaseline>
<projectVobName>vob_name</projectVobName>
<viewName>projecy_name</viewName>
<executable>cleartool.exe</executable>
<timeout>50000</timeout>
</sourcecontrol>
</project>
</cruisecontrol>
Thank you.
I have no direct experience with this kind of setup, but if you are using the <projectVobName> tag, that means:
you are declaring a pvob (project vob used only in UCM to store project, stream, activities and components, all UCM data)
your view (with the root directory referenced in <viewPath>) must be an UCM view.
All the other path elements (like 'executable') should reference an absolute path (and not just "cleartool.exe")

Resources