how to get schema url using java class

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

how to get schema url using java class

Post by shikhar_472 »

Hi Team,

How to get the document specific SCHEMA URL using java method is there any way
image.png
image.png (6.36 KiB) Viewed 325 times
Please see the highlighted value in image
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: how to get schema url using java class

Post by Radu »

Hi,

I did something like this recently using the XML catalog support in Oxygen.
So let's say in the Schema field I place "http://some/location/", then in an Oxygen plugin I can add a priority URI resolver to map the initial schema location to another schema location:

Code: Select all

 pluginWorkspace.getXMLUtilAccess().addPriorityURIResolver(new URIResolver() {
      @Override
      public Source resolve(String href, String base) throws TransformerException {
        if(SCHEMA_URI_REF.equals(href)) {
          URL schemaRef = getClass().getResource(SCHEMA_LOCATION);
          if(schemaRef != null) {
            return new StreamSource(schemaRef.toString());
          }
        }
        return null;
      }
    });
https://www.oxygenxml.com/InstData/Edit ... IResolver-

so in this way I take control in the Java code over the final location of the schema.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply