I am using Xalan. My input XML has default namespace.
My XSL is huge and I dont want to prepend all selectors of XPATH with namespace alias.
Is there api in Xalan with which I can set the default namespace so that I need not mention it in the XSL/XPATH.
No, the xpath-default-namespace attribute requires XSLT 2.0, which Xalan does not support.
If you are using Xalan-J, then there should be little difficulty switching to Saxon, which supports XSLT 2.0. This should give you the opportunity to make your XSLT code much less verbose if you don't want it to grow even huger.
Related
I am trying to find out how to use SpEL (or any other expression language) in my Quarkus applications to handle basic object transformation via injected configuration (and run on Graal).
I am not sure if/what is possible here and I cant find much in the way of docs or how-tos.
I see that this can be possibly be used via the Apache Camel extension, but right now that would be overkill for this requirement.
Any pointers or guidance would be appreciated.
Thanks.
Not much - I cant find docs, examples or howtos for this anywhere.
This is not supported in core Quarkus
We use a Java type generator to modify our enum type from Swagger 2.0 to a Java enum, and there are cases where we have needed to deserialize enum values that we've removed from our codebase, so for now we need to keep these deprecated enum values.
Can we somehow mark them in Swagger 2.0 as deprecated? I don't see a way to do so in either Swagger 2.0 or 3.0.
Unfortunately it is not possible to achieve this with either versions. However as of 3.1 it is possible. Have a look at this article that explains this in debt: https://community.smartbear.com/t5/Swagger-Open-Source-Tools/Swagger-Enum-Deprecated-Values-Is-it-possible/td-p/207289
From what I understand, SAXON is the only library which supports XPath 3.0 in Java.
Its JAXP implementation only supports XPath 2.0.
Its XPath 3.0 implementation should be called this way and requires me to build the document in the first place with its own API rather than using a JAXP-compliant API like DOM4J.
This is a pain because I'd been careful to abstract away everything that uses XPath to a proxy interface taking a JAXP node and xpath string as parameters, but this seems pointless if I have to refactor everything to use SAXON nodes from the top down.
Am I misunderstanding something? Is there a less painful way?
I'm increasingly trying to encourage users to use the s9api API in preference to JAXP for XPath processing. There are a variety of reasons: the JAXP interface only gives very half-hearted support to tree models other than DOM; it really struggles with the extended type system of XPath 2.0 and now 3.0, and in the case of Saxon, it doesn't interoperate at all well with other XML technologies and APIs.
However, Saxon continues to support the JAXP XPath API, with all its limitations, both against its own tree model and against third-party tree models such as DOM4J.
One thing that we have dropped is support for the XPath services interface, whereby an application using the XPathFactory.newInstance() method will pick up Saxon if it's on the classpath. The reason for that is that you really need to know when you're writing an application whether you want an XPath 1.0 or 2.0 processor, and the JAXP mechanism gives you no way of saying which you want, or discovering which you have been given. The result was that a lot of applications were experiencing hard-to-diagnose failures when deployed with an incorrect classpath. If you want Saxon as your JAXP XPath provider you now have to ask for it explicitly.
It would be useful if you could be more specific about what you are trying to do, and how it is failing.
Iam trying to implement static code analysis for Apache Camel not only for java but also XML based DSL.Is there any SCA Tool available?
Do you refer to the Camel routes as you want some kind of analysis of those? As Apache Camel is just regular Java code, then any regular SCA tools you can use
There is a good list on wikipedia
https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis
That said we are working on a "code/route coverage" tool that you run as part of unit tests, and then it can report which parts of your Java or XML routes have been covered or not. That work is still ongoing, you can follow the ticket:
https://issues.apache.org/jira/browse/CAMEL-8657
I believe you can certainly create a custom Sonar XPath rule using the XML plug in e.g. testing elements exist with certain attributes.
I'm new in XSLT and I would know what is the best solution to integrate XSLT into Spring web application. I found quick example here, but all in all I had troubles with proper character encoding and switching to Saxon processor (I refer to my former questions here and here). In book: 'Spring in Action' is described solution by extending AbstractXsltView. Is better way than AbstractXsltView which would let me choose Saxon processor? Is better way than execute transformation from .jsp files?
There's an old IBM DeveloperWorks JSTL primer on doing transformations through JSP using the <x:transform> tag of JSTL. This would be a much simpler approach, but may not allow Saxon.