How are you configuring the XMLConfiguration()?

Parser parser = new Parser(new XMLConfiguration());


You may want to make your own that knows about the different schemas used
in your file?

There is a lot of the details in the docs
<https://docs.geotools.org/latest/userguide/library/xml/internal/index.html>
.

Searching
<https://github.com/search?q=repo%3Ageotools%2Fgeotools%20SchemaResolver&type=code>
the codebase for SchemaResolver shows a couple examples:

            if (appSchemaResolver != null) {
                this.schemaParser.setResolver(appSchemaResolver);

I have not used this stuff in a bit; it would be helpful if you share your
results and we can improve the docs.
- -
Jody Garnett


On Jan 5, 2025 at 2:05:06 PM, Finn Völkel <finn.vol...@gmail.com> wrote:

> Hi there,
>
> I am trying to parse some 3D city models and am running into issues. All
> geotools dependencies are at 32.1. It follows a standalone XML file I am
> trying to parse with a couple of `xsd` locations in the header.
> https://gist.github.com/FiV0/91098e483ab993a3ef2293c12bd60afc#file-test-xml
> and the way I am trying to parse it
>
> https://gist.github.com/FiV0/91098e483ab993a3ef2293c12bd60afc#file-parserissue-java
>
> There is no error but I am getting a bunch of warnings that some `xsd`
> files can not be resolved and hence the returned result is not typed with
> classes.
> For example:
> WARNING: Error loading schema for namespace:
> http://www.opengis.net/citygml/building/1.0 at location:
> http://repository.gdi-de.org/schemas/adv/citygml/building/1.0/buildingLoD1.xsd
>
> Digging deeper, I tried to parse the schema directly with a custom
> `CashingSchemaResolver` as follows:
>
> https://gist.github.com/FiV0/91098e483ab993a3ef2293c12bd60afc#file-parsexsdfile-java
> This results in a premature end of file error for a referenced schema. See
> https://gist.github.com/FiV0/91098e483ab993a3ef2293c12bd60afc#file-error-txt
>
> My second question concerns how I can actually set a custom schema
> resolver on a parser. I tried to overwrite all kinds of methods on a custom
> configuration, but all to no avail.
> For example how would I set the following on my parser?
> ```
>         SchemaResolver schemaResolver = new SchemaResolver(new
> SchemaCache(new File ("/path/to/schema/catalog"), true));
> ```
>
> Thank you,
> Finn
>
>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to