Page 1 of 1
how to get schema url using java class
Posted: Wed Jun 21, 2023 4:51 pm
by shikhar_472
Hi Team,
How to get the document specific SCHEMA URL using java method is there any way
image.png
Please see the highlighted value in image
Re: how to get schema url using java class
Posted: Thu Jun 22, 2023 6:41 am
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