configure Saxon in eXist-db 5+ for xinclude - saxon

As of version 5.0 eXist-db no longer supports dynamically passing the option expand-xincludes=no to the Saxon processor during serialization. As such, I have to configure this in a Saxon config file. However this configuration does not seem to work - the xincludes are still being expanded in output.
Steps:
Following this comment and Saxon docs I created a configuration file called saxon-config.xml with the #xInclude="false" parameter:
<configuration xmlns="http://saxon.sf.net/ns/configuration" edition="HE">
<global xInclude="false"/>
</configuration>
I saved this in eXist's /etc/ directory and pointed to this file in the attribute in eXist's conf.xml:
<transformer class="net.sf.saxon.TransformerFactoryImpl" caching="no">
<attribute name="http://saxon.sf.net/feature/version-warning" value="false" type="boolean"/>
<attribute name="http://saxon.sf.net/feature/configuration-file" value="/Applications/eXist-db-5.2/etc/saxon-config.xml" type="string"/>
</transformer>
Yet the serializer still expands all the xincludes on output.
As a test to see if Saxon is reading the config, I put a deliberate error in the Saxon config file and Saxon objected.
Have I configured this for xInclude correctly?
--- adding more about workflow ---
Serialization in eXist 5.0 is performed in Xquery with the function fn:serialize().
I obtain a node (testing shows that this action does not expand xi:includes automatically in eXist) = $mydoc
I pass the node to the function with certain parameters, for example
fn:serialize($mydoc, map {"indent":true(),"method":"xml", "omit-xml-declaration":false()})
Output has expanded xinclude

I noticed this message on a recent mailing list, perhaps it's relevant.
My reading of this is that it's eXist doing the serialization with XInclude expansion, and this has nothing to do with Saxon. This doesn't solve your problem but hopefully it means you will be able to look in the right place for a solution; nothing you do with Saxon configuration options is going to make any difference.
Hi Ihe,
See the eXist documentation on XInclude, particularly the section on error handling:
https://exist-db.org/exist/apps/doc/xinclude
Joe
On Thu, Jun 18, 2020 at 7:50 AM Ihe Onwuka <ihe.onwuka#gmail.com> wrote:
5.2.0
On Thu, Jun 18, 2020 at 6:31 AM Jean-Paul Rehr <rehrjb#gmail.com> wrote:
Which version of eXist? Prior to 5.0 you can use
declare option exist:serialize "expand-xincludes=no";
in your Xquery declarations to allow/disallow Xinclude expansion (assuming you are using Xquery to execute the transformation). After 5.0...this no longer has an effect. Hopefully it will be reintroduced or another method discovered (see https://github.com/eXist-db/exist/issues/3446).
On Thu, Jun 18, 2020 at 11:12 AM Ihe Onwuka <ihe.onwuka#gmail.com> wrote:
A short while ago I wrote a transform that was supposed to transform a certain input element to an Xinclude element.
eXist blew up because it tried to resolve Xinclude call as soon as I attempted to store the transformation in the database.
Is that supposed to happen? Including the xsl list because am wondering whether this was a use case for namespace aliasing.
I have since solved the problem another way so the question is of academic interest only.
_______________________________________________
Exist-open mailing list
Exist-open#lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open

Related

Orbeon Documentation for oxf.xforms.format.input.time

<!-- [h]:[m]:[s] [P,*-2] or [h]:[m]:[s] [P,2-2] or [H]:[m]:[s] -->
<property as="xs:string" name="oxf.xforms.format.input.time" value="[h]:[m]:[s] [P,*-2]"/>
I wonder if the Orbeon time picker can display hours with preceding zero e.g. parse from 5:00pm becomes 05:00pm, and found above properties.
Also, can anyone explain what [P, *-2] and [P,2-2] mean?
Regarding your questions:
You can use [P,2-2] if you don't want dots in am and pm.
Adding leading zeros currently isn't supported. (If your organization has a PE or Dev Support subscription, you can contact Orbeon to see if this can be implemented as a "sponsored feature".)
And you can find more about the supported format in the section of the documentation about xf:input formatting.

result from /proc/self/exe is unfriendly in a clearcase view

If I execute a binary in a clearcase view, and look at /proc/self/exe for that on Linux, I see something like the following:
$ cd /proc/19220
$ ls -l exe
lrwxrwxrwx 1 peeterj pdxdb2 0 2012-11-30 13:04 exe -> /home/peeterj/views/peeterj_clang-7.vws/.s/00024/8000028250b8f1d1llvm-config
The clang llvm-config program, not unreasonably, uses this output to try to figure out the absolute fully qualified path that it is located in (I assume in case argv[0] isn't fully qualified).
Is there a way to find the location within the view that this corresponds to. For example, in this case, the llvm-config exe is actually in:
/vbs/bldsupp/linuxamd64/clang/debug/bin
(I'm wondering if it's feasible to modify clang's GetExecutablePath() function to figure this out.)
No trivial solution here (for an old version of ClearCase though):
The technote "PK27447: WITHIN A CLEARCASE DYNAMIC VIEW, THE READLINK() CALL ON LINUX RETURNS THE WRONG PATH FOR THE EXECUTABLE'S /PROC/SELF/EXE VALUE" suggests:
Local fix
Use getcwd(), get_current_dir_name(), getwd() in applications slated for a VOB/View context
Create an interposer library to intercept the readlink() call, and modify to use any of the above calls to return the proper data
The cause:
/proc/self/exe returns the improper path while getcwd succeeds.
Unfortunately, for /proc/self/exe to return the proper value [from within a VOB/View context] would require a change within the Linux kernel to allow MVFS to "override" the present setting.
IBM LTC has been working on having the Linux community adopt this change so that we can then incorporate the new features within MVFS.
Related: Bug Sun 6189256.

How do I get the Ant <input> task to output åäö (and similar characters) properly?

My first question. Please bear with me!
I have an Ant task that need to get some input from the user before proceeding. I use the Input task to achieve this. The input message will contain Swedish characters (eg å, ä and ö) but I am unable to get Ant to output the message properly. I'm testing this using the command line on a machine running Windows 7 Pro English (but obviously using a Swedish keyboard). Example:
<input message="åäö"/>
will output:
[input] Õõ÷
The build.xml is saved in UTF-8 format. If I do 'chcp' on the command line I get "Active code page: 850".
The same result can be seen when doing an echo:
<echo message="åäö"/>
will output:
[echo] Õõ÷
But in the case of the echo task I'm able to do:
<echo encoding="850" message=åäö">
to get the expected output:
[echo] åäö
The input task does however not have an encoding attribute and I'd very much prefer to not have to define an encoding at all, especially not on a per-task level (since I can't tell for sure on what machine the Ant script will be run from).
PS I have additional problems with the received input if it contains åäö and I set the input as a property that is later used in a filter copy task, but I guess that's a whole other question
I can observe the issue on my Polish Windows.
<script language="javascript">
java.lang.System.out.println("default charset: "
+ java.nio.charset.Charset.defaultCharset());
</script>
reports default charset as "windows-1250" while the console operates at "iso-8859-2" (I guess so).
Looks like <input> task uses the default charset thinking it would match the console input. In case it does not, I managed to override the encoding this way:
set ANT_OPTS=-Dfile.encoding=iso-8859-2
ant
In your case I would try to force 850, as it looks like JRE defaults to something else.
This question helped me to find the property name.
It is also important where ant is run from. If I run it from my ide, jedit console plugin, I don't need to override encoding, because I configured it to operate in windows-1250. So it seems to be another workaround, using an IDE.

XDoclet Ant Tasks Not Respecting force="true" Attribute

I've been running into some issues with the ejbdoclet Ant task, specifically, it is giving me output such as the following:
[ejbdoclet] XJavaDoc Ignoring class myClass in
/path/myClass.java. It was generated (Wed Mar 28 16:59:12 EDT 2012) after XJavaDoc's timestamp was reset (Wed Mar 28 16:58:52 EDT
2012)
You will note that the file is being ignored because it was generated after the timestamp on the file. The source files are currently sitting on an NFS share connected to the build cluster and for various resasons, generating the files on the local machines will not be posible. As such, I have used the force="true" tag as documented as follows:
<ejbdoclet ejbSpec="2.0" destdir="${common.generated}" force="true">
However, it is not being respected by XDoclet, any thoughts as to what might be going on?
Oddly enough, this appears to be an error where the message that was provided didn't accurately reflect what was expected. The error message indicates that the file is being ignored due to the fact that it's date stamp is in the future when compared to the one that ejbdoclet is using to determine if the files should be generated. This actually bypasses the force attribute so the error is actually with regards to the system clocks not being synchronized as opposed to with ejbdoclet itself per se.

"attributeGroup" references ignored by Delphi WSDL Import Tool

I am completely new to web services, but not new to Delphi.
I am importing a WSDL file into Delphi 2010 with the "WSDL Importer" wizard. The WSDL file contains some "attributeGroup" tags which Delphi completely ignores, which is presumably a bug, although I haven't yet found an entry on Quality Central for this issue, only mentions in forums like here and here.
My question has several parts:
What is the best workaround?
I have written a Python script to format the WSDL file such that all references to attributeGroup tags are replaced with the declaration of the attributes defined in the attributeGroups; in other words, flattening the references. The output is successfully imported into Delphi via the "WSDL importer" wizard, and looks correct, but I have yet to test whether the messages constructed via this new WSDL file will work correctly. Is this strategy likely to be viable, or should I quit now and move onto something else more productive?
Update
Based on my experiences, and the answers in this question, I decided to go the wrapper route with a C# console application that eats JSON input data and outputs JSON reply data. A Delphi app drives the C# app. The SOAP part of the whole thing is now effortless, and "just works" in C#.NET, and the rest of the functionality is handled well by Delphi. I would recommend this route to anyone else with similar problems. I did try exporting a C# SOAP assembly as a COM library, and connecting to that from Delphi, but it became very complex, because the SOAP specification in my particular app is large and somewhat complex.
Ok, this one took a while.
According to this post, there are certain tags that the .NET wsdl.exe tool just won't recognize when importing a wsdl file. According to MSDN:
attributeGroup: Ignored. DataContractSerializer does not support use of xs:group, xs:attributeGroup, and xs:attribute. These declarations are ignored as children of xs:schema, but cannot be referenced from within complexType or other supported constructs.
This behaviour is also described (albeit in a very hard-to-understand manner) on one of the MSDN blogs. In my specific case, the particular part of the wsdl file causing the problem looks like this:
<xs:complexType name="PhonesType">
<xs:annotation>
<xs:documentation xml:lang="en">Provides detailed phone information.</ xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Phone">
<xs:annotation>
<xs:documentation xml:lang="en">Used to pass detailed phone information.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="TelephoneInfoGroup"/>
<xs:attributeGroup ref="ID_OptionalGroup">
<xs:annotation>
<xs:documentation xml:lang="en">The ID attribute in this group is a unique identifying value assigned by the creating system and may be used to reference a primary-key value within a database or in a particular implementation.</xs:documentation>
</xs:annotation>
</xs:attributeGroup>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
It seems that the <xs:attributeGroup ref="TelephoneInfoGroup"/> is being ignored by the .NET wsdl.exe tool, just like it was being ignored by the Delphi wsdl importer. In such a situation, where importing fails in both Delphi and .NET, the wsdl file probably has to be changed, and that means I will have to use my home-made python ref-flattener after all.
We had a similar problem with Delphi 2009 and a standard Soap service (CRM). It was not related to attributeGroup. We found so many incompatibilities that we finally decided to use a small C# application as a proxy for the real .Net based service.
I was the poster of the first reference you give. I think I found out that this bug has never been fixed.
I later posted another question on the Embarcadero Developer Network where Nick Hodges said that
We are concentrating on client development [...] if you are looking to build SOAP servers, then I'd suggest that you also give Delphi Prism a look.
We decided to switch to C# for development of our SOAP servers. I decided to let the service talk to a database, which is then accessed by our Delphi application.
Later I ran into problems with client development under Delphi as well, so we're doing that in C#, too. This time the C# class is com visible and can be accessed from Delphi. Seems to work fine.
Regards, Miel.
The Delphi WSDL importer can't handle <xsd:attributeGroup ref="..."> elements, but you can replace those with the actual attributes that are referenced, which the importer can deal with.
Below is a PowerShell script that does this replacement.
The script is unpolished. It's just what I created for my own needs. It may work for you too, or at least it should give you a starting point.
$xsdPath = "E:\scratch\InputFile.wsdl"
# Note: Must be full path.
$outPath = "E:\scratch\OutputFile.wsdl"
$xsd = [xml](gc $xsdPath)
$ns = #{xsd="http://www.w3.org/2001/XMLSchema"}
$attrGroupDefs = $xsd |
Select-Xml -Namespace $ns -XPath "//xsd:schema/xsd:attributeGroup" |
select -ExpandProperty Node
$attrGroupRefs = $xsd |
Select-Xml -Namespace $ns -XPath "//xsd:complexType/xsd:attributeGroup" |
select -ExpandProperty Node
$attrGroupRefs | % {
# the thing to be replaced
$ref = $_
$refParent = $ref.ParentNode
$namespace, $name = $_.ref -split ":"
$attrs = $attrGroupDefs | ? name -eq $name | select -ExpandProperty attribute
# remove the reference
$refParent.RemoveChild($ref)
# add the actual definitions
$attrs | % {
$newNode = $_.CloneNode($true)
$refParent.AppendChild($newNode)
}
}
$xsd.Save($outPath)

Resources