Why is an external document resolved in Altova XMLSpy but not in SaxonHE10? - xslt-2.0

I want to load an external XML-document into a variable, which works in Altova XMLSpy but not in SaxonHE10.
In Altova XMLSpy the following XSLT 2.0 line returns true.
<xsl:copy-of select="fn:doc-available('https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode')"/>
In my local SaxonHE10 installation it returns false.
Are there any commandline parameters I can use to change this behavior?
Addition 18.10.2021 13:12:
The comment section ist to small, so I edit my question:
That is the XSLT:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xdf3="urn:xoev-de:fim:standard:xdatenfelder_3.0.0"
xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/"
exclude-result-prefixes="html"
>
<xsl:template match="/">
<xsl:message>
<xsl:copy-of select="fn:doc-available('https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode')"/>
</xsl:message>
<xsl:message>
<xsl:copy-of select="fn:document('https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode')"/>
</xsl:message>
</xsl:template>
</xsl:stylesheet>
That is the command call:
"C:\Program Files\Saxonica\SaxonHE10.2N\bin\Transform.exe" -s:test.xml -xsl:test.xsl
This is the result:
false
Error FODC0002 while evaluating xsl:message at line 20 of file:/C:/Users/Volker/Dropbox/FIM/Tools/QS%20Datenfelder/test.xsl: Document has been marked not available: https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode
<?xml version="1.0" encoding="UTF-8"?>

Interestingly the doc and doc-available calls to the given URL work in the Saxon .NET based XSLT fiddle app I run.
As far as I can tell, the only IKVM setting I have there in the web.config (that might as well work in an app.config for non web use of .NET and Saxon) are the TLS settings e.g.
<configuration>
<appSettings>
<add key="ikvm:https.protocols" value="TLSv1,TLSv1.1,TLSv1.2" />
</appSettings>
</configuration>
So that would be worth a try, that any .NET users of Saxon for which the URI fails add the above setting to the app.config or web.config.
I now tried some simple C# code using Saxon HE 10.6 .NET with e.g.
Processor processor = new Processor();
string xpathExpression = "doc-available('https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode')";
Console.WriteLine(processor.NewXPathCompiler().EvaluateSingle(xpathExpression, null).GetStringValue());
Console.ReadLine();
without any change to IKVM settings or app.config this outputs true. It turns out that the used .NET framework version is decisive or part of the reason, the first test was done with 4.8. Using 4.5 gives false, using 4.6 gives true.
Even without using Saxon or IKVM, a .NET framework 4.5 application doing
string url = "https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode";
var request = WebRequest.Create(url);
{
using (var response = (HttpWebResponse)request.GetResponse())
{
Console.WriteLine("Status: {0}", response.StatusCode);
response.Close();
}
}
Console.ReadLine();
fails to establish a connection as it gives some error about not being able to establish a protected SSL/TLS channel. Using .NET framework 4.8 no such problem arises. Still don't know how to get compiled and installed .exe files like Transform.exe or Query.exe from Saxon to switch/look for the latest/highest installed .NET framework instead of (I presume) the lowest they were compiled for and tested for to run with. https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls might give some clues.

Related

Getting errors in Saxon-HE 9.9.1 when processing DITA: I/O error on DTD

Using Saxon 9.9.1.3J, I am getting an I/O error every time I try to transform a DITA file that has a DTD:
I/O error reported by XML parser processing file:/test.dita: /learningAssessment.dtd (No such file or directory)
This happens even if I force -dtd:off on the command line. Commenting out the DTD in the DITA file does allow it to process.
Interestingly, when I run the same DITA file in oXygen using Saxon-HE 9.8.0.12, it does process correctly. Any idea what might be causing this to behave differently?
Sample DITA file:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE learningAssessment PUBLIC "-//OASIS//DTD DITA Learning Assessment//EN" "learningAssessment.dtd">
<learningAssessment id="id">
<title>Title</title>
<learningAssessmentbody>
<lcInteraction>
<lcSingleSelect id="lcSingleSelect_agy_fxz_ljb">
<lcQuestion>Question</lcQuestion>
<lcAnswerOptionGroup id="lcAnswerOptionGroup_bgy_fxz_ljb">
<lcAnswerOption>
<lcAnswerContent>A</lcAnswerContent>
</lcAnswerOption>
<lcAnswerOption>
<lcAnswerContent>B</lcAnswerContent>
<lcCorrectResponse/>
</lcAnswerOption>
</lcAnswerOptionGroup>
</lcSingleSelect>
</lcInteraction>
</learningAssessmentbody>
</learningAssessment>
And here's a shell of an XSL that demonstrates the error:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
<xsl:output />
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
You can resolve the problem by the following steps:
Download DITA-OT and expand it any folder you like. In my case it is located at D:\DITA-OT\dita-ot-3.3.4.
Set CLASSPATH environment variable to contain saxon9he.jarand xml-resolver-1.2.jar in DITA-OT/lib.
Invoke Saxon by specifying class name net.sf.saxon.Transform and the catalog: paramter that specifies [DITA-OT]/catalog-dita.xml.
Here is execution example command window:
Hope this helps!
My guess is that you have somehow contrived to give the document a base URI of "file:/test.dita: ", including the final space. You haven't shown how you are running the transformation, so we can't tell where this base URI comes from.
The option -dtd:off is a little misleading. It doesn't switch off DTD processing, only DTD-based validation, which is just one aspect of DTD processing. An XSLT processor always needs to ask the XML parser to read the DTD in order to expand any entity references.
(Well, theoretically it could delay reading any external DTD until it finds the first entity reference; but sadly, I don't know of any XML parser that does that.)
I misunderstood how DTDs work. I assumed the public ones were loaded from an HTTP URL, but they need to be local files. Loading the catalog for DITA OT resolved the issue.
transform -s:test.dita -xsl:test.xsl -o:test.html -catalog:/org.oasis-open.dita.v1_2/plugins/org.oasis-open.dita.v1_2/catalog.xml
Where the catalog option points to this file on my local filesystem, which comes from DITA OT

Shipping logs to Logz.io with NLog fails

I'm just trying to ship some error logs from my ASP.NET MVC 5 app to Logz.io
I'm using NLog to ship my logs.
I've installed NLog and NLog.Web packages
I have the following nlog.config file :
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="true"
internalLogLevel="ERROR"
internalLogFile="C:\Temp\nlog-internal.log">
<extensions>
<add assembly="Logzio.DotNet.NLog"/>
</extensions>
<targets async="true">
<target name="file" type="File"
fileName="<pathToFileName>"
archiveFileName="<pathToArchiveFileName>"
keepFileOpen="false"
layout="<long layout patten>"/>
<target name="logzio"
type="Logzio"
token="LRK......"
logzioType="nlog"
listenerUrl="https://listener.logz.io:8071"
bufferSize="1"
bufferTimeout="00:00:05"
retriesMaxAttempts="3"
retriesInterval="00:00:02"
debug="false" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="logzio" />
</rules>
</nlog>
Then, each of my C# controller have this line :
private static Logger logger = LogManager.GetCurrentClassLogger();
and then I try to ship my logs using something like :
logger.Fatal("Something bad happens");
However, when I writeTo="file" in the nlog.config file, I can find a log file on my local disk with "Something bad happens", so everything is fine.
However, nothing appear on my LogzIo web interface when I writeTo="logzio", no logs are shipped there.
What did I miss ?
Answering my own question after I found how to solve this.
Actually, my whole project use HTTPS.
In internal Nlog logs, I had this error
Error : System.Net.WebException : The request was aborted: Could not create SSL/TLS secure channel
I've just added this line of code at the very beginning of ApplicationStart in Global.asax.cs
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
After testing the whole project during some days, it seems it doesn't affect the other parts of the project.
However, just be careful as it is a global setting
I had the same issue, and it turned out that in my published app the logzio dlls were missing. I added them and it resolved the issue.
Check if you're missing these files in your bin folder:
Logzio.DotNet.NLog.dll
Logzio.DotNet.Core.dll

Schema error with SalesForce wsdl

I have been working with an Apex class in SalesForce that has been working perfectly in terms of updating, generating the new WSDL and updating the reference in Visual Studio. Yesterday I added a new method and now I get an invalid schema error in VS when trying to update the reference. I tested the validaty of the WSDL here www.wsdl-analyzer.com and sure enough it gave me the error:
The reference ns1:ID in the XML Schema references a type or element that is not defined. Please make sure that your Schema documents are correct.
Looking at the xml file I can see that even in visual studio it doesnt like this particular line or several of the others as well:
<xsd:element name="CreatedById" minOccurs="0" type="ns1:ID" nillable="true"/>
The first few lines of the xml file look like (I've replaced parts with xxxx for privacy but they refer to the SF instance):
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://soap.sforce.com/schemas/class/xxxx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soap.sforce.com/schemas/class/xxxx" xmlns:AvailabilityExtended="http://soap.sforce.com/schemas/class/AvailabilityExtended" xmlns:BookingWrapper="http://soap.sforce.com/schemas/class/BookingWrapper">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://soap.sforce.com/schemas/class/AvailabilityExtended">
Any suggestions?

parsing error while including taglib

I'm trying to use Apache Commons Lang 3 in my JSF 2 application, and I followed BalusC's example
But when I included this line in my .xhtml page :
<%#taglib prefix="f" uri="/WEB-INF/functions.tld" %>
I have an error while parsing the page code.
How can I fix the problem?
The answer was targeted on a question whose asker is known to use JSF 1.x on JSP. The syntax which you've there is specific to JSP, the legacy predecesor of Facelets which is deprecated since JSF 2.0.
Get rid of the functions.tld file altogether. The proper JSF 2.x Facelets way of declaring a custom function based on an existing static method is as follows:
First create a /WEB-INF/functions.taglib.xml:
<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://example.com/functions</namespace>
<function>
<function-name>escapeJavaScript</function-name>
<function-class>org.apache.commons.lang.StringEscapeUtils</function-class>
<function-signature>java.lang.String escapeJavaScript(java.lang.String)</function-signature>
</function>
</facelet-taglib>
Then register it in /WEB-INF/web.xml:
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/functions.taglib.xml</param-value>
</context-param>
(that step is unnecessary when it is placed in /META-INF of a JAR file which is in turn placed in /WEB-INF/lib)
Finally declare and use it as follows:
<html ... xmlns:func="http://example.com/functions">
...
<h:outputScript>var foo = '#{func:escapeJavaScript(bean.foo)}';</h:outputScript>
Note that I've updated the answer you found accordingly. Also note that this function is already provided out the box as #{of:escapeJS(bean.foo)} by JSF utility library OmniFaces, in case you're using it.

Flex Ruby-on-Rails http xml request error

I'm currently developing a Ruby on Rails application with Rails 3.0 on Ubuntu 10.4.
I intend to use Adobe Flex for the front-end. For this reason I've installed Flash Builder 4 on Windows XP using Virtual Box. The Internet connection of this virtual machine is bridged.
The Flex Application currently only consists of a simple HTTP Request that retrieves an XML file from the Rails Application running on Ubuntu localhost:3000 :
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="plansService.send()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:HTTPService id="plansService"
url="http://192.168.1.102:3000/plans/list" />
</fx:Declarations>
<fx:Script>
<![CDATA[
private function printPlans():void {
for each (var xm:XML in plansService.lastResult.plans.plan) {
trace("my name is "+ xm.child("name"));
}
}
]]>
</fx:Script>
</s:Application>
In the Flash Builder Network Manager the HTTP Request is displayed as working. The response is there and contains the correct XML data.
But when the Flex Application loads in the Browser I get this error:
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: file://C:\Documents and Settings\susi\Adobe Flash Builder 4\naturalstudy\bin-debug\naturalstudy.swf cannot load data from localhost:27813.
at mx.netmon::NetworkMonitorImpl()[/ndepot/fb_401/ide_builder/ActionscriptProjects/src/mx/netmon/NetworkMonitorImpl.as:81]
at mx.netmon::NetworkMonitorImpl$/init()[/ndepot/fb_401/ide_builder/ActionscriptProjects/src/mx/netmon/NetworkMonitorImpl.as:49]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:2620]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:2539]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/timerHandler()[E:\dev\4.x\frameworks\projects\framework\src\mx\preloaders\Preloader.as:515]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
I googled this and thus have tried these things:
- added use-network=false to the Flash Builder compiler options for this project
- added a crossdomain.xml file to the Rails Project public folder:
<?xml version="1.0" encoding="utf-8"?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
But it still doesn't work and the error is the same.
I think the problem is that the Flex application is trying to receive something from localhost:27813 ... but I'm stuck at this point.
Help would be much appreciated!
A shot in the dark. Go here and add that location (localhost:27813) as trusted location:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
More guesses:
Run your project with Flash Builder Network Monitor disabled.
Export a release build and run that

Resources