Skip to content

validation via xml catalog fails #8464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eduarddrenth opened this issue Apr 28, 2025 · 9 comments · May be fixed by #8489
Open

validation via xml catalog fails #8464

eduarddrenth opened this issue Apr 28, 2025 · 9 comments · May be fixed by #8489
Labels
kind:bug Bug report or fix XML

Comments

@eduarddrenth
Copy link

Apache NetBeans version

Apache NetBeans 25

What happened

  • add an xml catalog file via settings
    • open a valid xml file that should be vaildated using the catalog
    • the file does not validate
      instead you see for example:
XML validation started.
Checking file:/home/eduard/rita/tei-aangepast/E1-BEm.xml...
cvc-elt.1.a: Cannot find the declaration of element 'TEI'. [4] 
XML validation finished.

Language / Project Type / NetBeans Component

xml, xslt

How to reproduce

see above

Did this work correctly in an earlier version?

No / Don't know

Operating System

ubuntu 24

JDK

java-21-openjdk-amd64

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

Not sure if I am able to contribute, but I have plenty of java and xml experience

Are you willing to submit a pull request?

Yes

@eduarddrenth eduarddrenth added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Apr 28, 2025
@mbien mbien added the XML label Apr 28, 2025
@mbien
Copy link
Member

mbien commented Apr 28, 2025

would be worth checking if the behavior is different on JDK 17 or older NB versions, since Java changed some defaults of the xml APIs in recent releases.

@matthiasblaesing
Copy link
Contributor

Validated XML against XSD today with a master build from a few week ago. Worked. This need precise steps to reproduce. And I mean starting from a clean user dir, where to download which XSD, demonstration XML. From my POV XML validation works as it should.

@neilcsmith-net neilcsmith-net added the pending-response Awaiting further information to be supplied label Apr 28, 2025
@eduarddrenth
Copy link
Author

would be worth checking if the behavior is different on JDK 17 or older NB versions, since Java changed some defaults of the xml APIs in recent releases.

Tested this, it does not help. I'll attach files

@eduarddrenth
Copy link
Author

Validated XML against XSD today with a master build from a few week ago. Worked. This need precise steps to reproduce. And I mean starting from a clean user dir, where to download which XSD, demonstration XML. From my POV XML validation works as it should.

The xsd's with catalog:

xsd.zip

The xml that should validate:

E1-BEm.zip

@matthiasblaesing
Copy link
Contributor

Validation works, saving does not.

  1. I downloaded both zip and put contents into the folder /home/matthias/Downloads/test/:
    matthias@enterprise:~/src/netbeans$ ls -lh /home/matthias/Downloads/test/
    insgesamt 1016K
    -rw-rw-r-- 1 matthias matthias 721K Feb  7 09:03 corpora_linguistics.xsd
    -rw-rw-r-- 1 matthias matthias 259K Apr 26 07:59 E1-BEm.xml
    -rw-rw-r-- 1 matthias matthias 1,1K Apr 28 12:38 fa_tei_catalog.xml
    -rw-rw-r-- 1 matthias matthias  22K Feb  7 09:03 t.xsd
    -rw-rw-r-- 1 matthias matthias 2,3K Feb  7 09:03 xml.xsd
    matthias@enterprise:~/src/netbeans$
    
  2. Run NetBeans with a clean user + cachedir nbbuild/netbeans/bin/netbeans --userdir xml-userdir --cachedir xml-cachedir
  3. In "Tools -> Plugins -> Installed" select "Java SE" and activate the cluster
  4. Go to "Tools -> DTDs and XML Schemas"
  5. Choose "Add catalog"
  6. Choose "OASIS Catalog Resolver" as Type
  7. Enter file:/home/matthias/Downloads/test/fa_tei_catalog.xml as Catalog URL
  8. Leave "Prefer Public ID" selected and confirm with "OK"
  9. Close Dialog "DTDs and XML Schemas"
  10. Open E1-BEm.xml
  11. Right click into document choose "Validate XML`

I get:

XML validation started.
Checking file:/home/matthias/Downloads/test/E1-BEm.xml...
Referenced entity at "file:/home/matthias/Downloads/test/corpora_linguistics.xsd".
Referenced entity at "file:/home/matthias/Downloads/test/t.xsd".
Referenced entity at "file:/home/matthias/Downloads/test/xml.xsd".
XML validation finished.
  1. Stop NetBeans, start again as in step 2
  2. Check "Tools -> DTDs and XML Schemas"

=> Catalog is not there anymore

@matthiasblaesing matthiasblaesing removed the needs:triage Requires attention from one of the committers label Apr 28, 2025
@matthiasblaesing
Copy link
Contributor

Problem is there since at least NB 9 (I suspect this never worked).

@eduarddrenth
Copy link
Author

I can confirm that when choosing OASIS catalog resolver, validation works, also when running netbeans with non-empty user and cache dirs. When choosing XML catalog, validation does not work.

@matthiasblaesing matthiasblaesing removed the pending-response Awaiting further information to be supplied label May 5, 2025
@matthiasblaesing matthiasblaesing linked a pull request May 5, 2025 that will close this issue
@matthiasblaesing
Copy link
Contributor

@eduarddrenth a fix is available from #8489, which should cover the problems raised here. A dev/nightly build is available from the checks page or directly: https://github.com/apache/netbeans/suites/38113223012/artifacts/3064311337. It would be great if you could test it.

@eduarddrenth
Copy link
Author

Tested with the dev build. Validation works with oasis catalog (which is now the default when adding a catalog). After closing and reopening netbeans, validation still works.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix XML
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants