Creating a RELAX NG datatype library .jar for use with the v.Nu schemas

I forget to mention in my previous post: I've run Oxygen XML Author with oxygenDebug.bat and with the log4j.properties specified on the Oxygen website (to write logs under my desktop), but the only error I see when I use "my" .jar is the same one I get when there is no datatype .jar present:
E [Jing] datatype library "http://whattf.org/datatype-draft" not recognized
It's as if my .jar is being ignored. This is partly what prompted my niggling thought that perhaps Oxygen has some persistent parser cache that expects the other jar (from the jEdit XML plugin developer that I used first); but if so, the stickiness is deeper than just the .jar file name, because I get the same behavior when I use the same .jar file name. If I close Oxygen, replace my .jar with the .jar from the jEdit XML plugin developer, and restart Oxygen, then I don't get that Jing error, and validation works using the v.Nu schemas that refer to those datatypes. I need to investigate whether I can turn on additional diagnostic options for Jing that might indicate whether or not my .jar is being used. I'd appreciate advice on that. (I've had confirmation from the jEdit XML plugin developer that all he did was to cut down the vnu.jar.) Regards, Graham Hannington Fundi Software Pty Ltd 2016 ABN 89 009 120 290 This message has been scanned for malware by Websense. www.websense.com

Hi Graham, Check the META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory in both JARs. I think Jing uses this to identify the available datatype libraries and if your JAR file does not provide the entry there then Jing will not load your datatype library. Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 14/03/16 01:35, Graham Hannington wrote:
I forget to mention in my previous post: I've run Oxygen XML Author with oxygenDebug.bat and with the log4j.properties specified on the Oxygen website (to write logs under my desktop), but the only error I see when I use "my" .jar is the same one I get when there is no datatype .jar present:
E [Jing] datatype library "http://whattf.org/datatype-draft" not recognized
It's as if my .jar is being ignored. This is partly what prompted my niggling thought that perhaps Oxygen has some persistent parser cache that expects the other jar (from the jEdit XML plugin developer that I used first); but if so, the stickiness is deeper than just the .jar file name, because I get the same behavior when I use the same .jar file name.
If I close Oxygen, replace my .jar with the .jar from the jEdit XML plugin developer, and restart Oxygen, then I don't get that Jing error, and validation works using the v.Nu schemas that refer to those datatypes.
I need to investigate whether I can turn on additional diagnostic options for Jing that might indicate whether or not my .jar is being used. I'd appreciate advice on that.
(I've had confirmation from the jEdit XML plugin developer that all he did was to cut down the vnu.jar.)
Regards, Graham Hannington
Fundi Software Pty Ltd 2016 ABN 89 009 120 290
This message has been scanned for malware by Websense. www.websense.com _______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-user

Hi Graham,
It's as if my .jar is being ignored. This is partly what prompted my niggling thought that perhaps Oxygen has some persistent parser cache that expects the other jar (from the jEdit XML plugin developer that I used first); but if so, the stickiness is deeper than just the .jar file name, because I get the same behavior when I use the same .jar file name. I just wanted to mention that there is no such cache, restarting the application will result in the new jar being loaded.
The problem is most likely the one that George mentioned. When you re-create the jar, make sure that in the 'META-INF/services' folder from within the .jar the appropriate factory class is specified (use a ZIP archive tool like 7-zip to check). Regards, Adrian Adrian Buza oXygen XML Editor and Author Support Tel: +1-650-352-1250 ext.2020 Fax: +40-251-461482 On 14.03.2016 10:34, George Bina wrote:
Hi Graham,
Check the META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory in both JARs. I think Jing uses this to identify the available datatype libraries and if your JAR file does not provide the entry there then Jing will not load your datatype library.
Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
On 14/03/16 01:35, Graham Hannington wrote:
I forget to mention in my previous post: I've run Oxygen XML Author with oxygenDebug.bat and with the log4j.properties specified on the Oxygen website (to write logs under my desktop), but the only error I see when I use "my" .jar is the same one I get when there is no datatype .jar present:
E [Jing] datatype library "http://whattf.org/datatype-draft" not recognized
It's as if my .jar is being ignored. This is partly what prompted my niggling thought that perhaps Oxygen has some persistent parser cache that expects the other jar (from the jEdit XML plugin developer that I used first); but if so, the stickiness is deeper than just the .jar file name, because I get the same behavior when I use the same .jar file name.
If I close Oxygen, replace my .jar with the .jar from the jEdit XML plugin developer, and restart Oxygen, then I don't get that Jing error, and validation works using the v.Nu schemas that refer to those datatypes.
I need to investigate whether I can turn on additional diagnostic options for Jing that might indicate whether or not my .jar is being used. I'd appreciate advice on that.
(I've had confirmation from the jEdit XML plugin developer that all he did was to cut down the vnu.jar.)
Regards, Graham Hannington
Fundi Software Pty Ltd 2016 ABN 89 009 120 290
This message has been scanned for malware by Websense. www.websense.com _______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-user
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-user

On Mon, Mar 14, 2016 at 10:52:14AM +0200, Oxygen XML Editor Support (Adrian Buza) wrote:
The problem is most likely the one that George mentioned. When you re-create the jar, make sure that in the 'META-INF/services' folder from within the .jar the appropriate factory class is specified (use a ZIP archive tool like 7-zip to check).
Oh dear ... never, ever ask a java dev how to decompile or peer inside a .jar; ask a security researcher instead. JavaDecompiler (JD-GUI and friends) will be your friend too: http://jd.benow.ca https://github.com/java-decompiler/ There's a little background on WikiPedia: https://en.wikipedia.org/wiki/Java_Decompiler Regards, Ben -- | Ben McGinnes | Adversarial Press | Twitter: benmcginnes | | Writer, Publisher, Systems Administrator, Trainer, ICT Consultant | | http://www.adversary.org/ http://publishing.adversary.org/ | | GPGME Python 3 API Dev, GNU Privacy Guard https://www.gnupg.org/ | | Encrypted email preferred, OpenPGP/GPG key: 0x321E4E2373590E5D | | OpenPGP/GPG key here: http://goo.gl/GVGwT and http://goo.gl/SDs0D |

On Mon, Mar 14, 2016 at 10:52:14AM +0200, Oxygen XML Editor Support (Adrian Buza) wrote:
The problem is most likely the one that George mentioned. When you re-create the jar, make sure that in the 'META-INF/services' folder from within the .jar the appropriate factory class is specified (use a ZIP archive tool like 7-zip to check).
Oh dear ... never, ever ask a java dev how to decompile or peer inside a .jar; ask a security researcher instead. JavaDecompiler (JD-GUI and friends) will be your friend too: http://jd.benow.ca https://github.com/java-decompiler/ There's a little background on WikiPedia: https://en.wikipedia.org/wiki/Java_Decompiler Regards, Ben -- | Ben McGinnes | Adversarial Press | Twitter: benmcginnes | | Writer, Publisher, Systems Administrator, Trainer, ICT Consultant | | http://www.adversary.org/ http://publishing.adversary.org/ | | GPGME Python 3 API Dev, GNU Privacy Guard https://www.gnupg.org/ | | Encrypted email preferred, OpenPGP/GPG key: 0x321E4E2373590E5D | | OpenPGP/GPG key here: http://goo.gl/GVGwT and http://goo.gl/SDs0D |

Hi Ben, Yes, I'm with you, good tip: the Java Decompiler (JD-GUI) is exactly what I used :-). Meanwhile, the jEdit XML plugin developer has clued me into why his .jar worked: he recompiled the v.Nu source using Java version 1.7. I have some thoughts about that - the RELAX NG schemas being usable as-is across editors/tools, while the required datatype .jar needs to be built to match the editor/tool - but they'll keep for now. Regards, Graham Fundi Software Pty Ltd 2016 ABN 89 009 120 290 This message has been scanned for malware by Websense. www.websense.com

make sure that in the 'META-INF/services' folder from within the .jar
Hi George and Adrian, Re: the appropriate factory class is specified (use a ZIP archive tool like 7-zip to check). Yes, you're absolutely right about that requirement, and thanks very much for the advice, but I don't think that's it. That was one of the first things that occurred to me. The following file in my (non-working) datatype .jar: META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory has the same content: nu.validator.datatype.Html5DatatypeLibraryFactory as the same file in the .jar that does work. Byte-identical, right down to the x'0A' end-of-line character. And, as I mentioned, they both work in jEdit, which also uses Jing. If you swear that Oxygen doesn't have a persistent parser cache lurking that might be the culprit, then I guess I'll have to do some more digging. I want to see an error that I can act on. I think being able to edit XHTML5 in Oxygen - and other validating XML editors that are capable of it - using the "living" v.Nu schemas is a worthy goal. I'm going to persevere. And, yes, I use 7-Zip to perform surgery on .jar files. Nice tool. But it changes the "order" of files in a .jar as reported by the tf option of the jar utility. I got paranoid about that and, in one permutation of my testing, I used the jar utility to re-create the datatype .jar with the META-INF directory and its files deliberately right at the top of the tf listing. Nope. Made no difference. If/when I get this working (well, it already is; I mean: working with my own "reproducible" .jar :-) ), I might get back to you about validating XHTML5 that contains custom data-* attributes, using the combination of the v.Nu schemas and your tweaked parser code mentioned in: https://www.oxygenxml.com/forum/topic7698.html I sincerely don't mean any offence, but I am curious why Oxygen doesn't offer out-of-the-box support for XHTML5 validation using the "living" XHTML5 schemas from v.Nu. When I started looking into XHTML5 validation, it became clear to me that the v.Nu schemas were the best choice. For some background on my investigation, see: https://github.com/validator/validator/issues/251 Even if you disagree with Mike(tm) Smith's "canonical" comment (do you?), anyone who goes looking at the HTML5 spec on either the WHATWG or W3C website for information on validating XHTML5 will end up at the Nu Html (sic) Checker (Validator.nu; v.Nu). It makes sense to me for editors that can support the same schemas to do so. But Oxygen is not alone in this. I've started doing the rounds of the free validating XML editors that I'm aware of, and the commercial ones my employer has paid for on my behalf, and none, so far, have pointed out-of-the-box to the "live" v.Nu schemas on GitHub. Having looked into it, I can see there are some reasons for that, that I'm working on, as described at: https://github.com/unsoup/validator It's good to have a hobby, right? ;-) Thanks again for your advice so far. Cheers, Graham Fundi Software Pty Ltd 2016 ABN 89 009 120 290 This message has been scanned for malware by Websense. www.websense.com

Dear Graham, It may be useful if you can provide us access to the 2 jar files. Either provide us links to download them or you may be able to use the technical support form from our website to upload them: http://oxygenxml.com/techSupport.html Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 14/03/16 16:09, Graham Hannington wrote:
Hi George and Adrian,
Re:
make sure that in the 'META-INF/services' folder from within the .jar the appropriate factory class is specified (use a ZIP archive tool like 7-zip to check).
Yes, you're absolutely right about that requirement, and thanks very much for the advice, but I don't think that's it. That was one of the first things that occurred to me.
The following file in my (non-working) datatype .jar:
META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory
has the same content:
nu.validator.datatype.Html5DatatypeLibraryFactory
as the same file in the .jar that does work. Byte-identical, right down to the x'0A' end-of-line character. And, as I mentioned, they both work in jEdit, which also uses Jing.
If you swear that Oxygen doesn't have a persistent parser cache lurking that might be the culprit, then I guess I'll have to do some more digging. I want to see an error that I can act on.
I think being able to edit XHTML5 in Oxygen - and other validating XML editors that are capable of it - using the "living" v.Nu schemas is a worthy goal. I'm going to persevere.
And, yes, I use 7-Zip to perform surgery on .jar files. Nice tool. But it changes the "order" of files in a .jar as reported by the tf option of the jar utility. I got paranoid about that and, in one permutation of my testing, I used the jar utility to re-create the datatype .jar with the META-INF directory and its files deliberately right at the top of the tf listing. Nope. Made no difference.
If/when I get this working (well, it already is; I mean: working with my own "reproducible" .jar :-) ), I might get back to you about validating XHTML5 that contains custom data-* attributes, using the combination of the v.Nu schemas and your tweaked parser code mentioned in:
https://www.oxygenxml.com/forum/topic7698.html
I sincerely don't mean any offence, but I am curious why Oxygen doesn't offer out-of-the-box support for XHTML5 validation using the "living" XHTML5 schemas from v.Nu. When I started looking into XHTML5 validation, it became clear to me that the v.Nu schemas were the best choice. For some background on my investigation, see:
https://github.com/validator/validator/issues/251
Even if you disagree with Mike(tm) Smith's "canonical" comment (do you?), anyone who goes looking at the HTML5 spec on either the WHATWG or W3C website for information on validating XHTML5 will end up at the Nu Html (sic) Checker (Validator.nu; v.Nu). It makes sense to me for editors that can support the same schemas to do so.
But Oxygen is not alone in this. I've started doing the rounds of the free validating XML editors that I'm aware of, and the commercial ones my employer has paid for on my behalf, and none, so far, have pointed out-of-the-box to the "live" v.Nu schemas on GitHub. Having looked into it, I can see there are some reasons for that, that I'm working on, as described at:
https://github.com/unsoup/validator
It's good to have a hobby, right? ;-)
Thanks again for your advice so far.
Cheers, Graham
Fundi Software Pty Ltd 2016 ABN 89 009 120 290
This message has been scanned for malware by Websense. www.websense.com

Hi George, Thanks very much for the offer. Today, I did what I belatedly realized I should have done before I started musing in public about a phantom parser cache ;-), and tried my datatype .jar on a colleague's "virgin" (no previous such datatype .jar) Oxygen installation. Didn't work. That settles it for me: there's definitely something wrong with my .jar. What, I still don't know. I'll look into it. If I feel I'm at a dead stop, I'll take you up on your offer (thanks again). When I have a working datatype .jar that I can reproduce, I'll make it publicly available, probably via the GitHub repo unsoup/validator. Cheers, Graham Fundi Software Pty Ltd 2016 ABN 89 009 120 290 This message has been scanned for malware by Websense. www.websense.com
participants (4)
-
Ben McGinnes
-
George Bina
-
Graham Hannington
-
Oxygen XML Editor Support (Adrian Buza)