Closed codeape2 closed 2 years ago
- disclaimer: I'm a JAXB noob
- I use
org.entur.netex.NetexParser
andNetexEntitiesIndex
Using the Line->Route relation as example:
- I can go from Route to Line using
route.getLineRef()
This is under JAXB only possible under a very specify XSD-KeyRef contstraint, it will then work automatically, but this does not work for NeTEx due to id+version (or ref+version+nameOfRefClass) read: compound keys.
- Question: Is there a simple way to go the other way. I.e. from a Line, getting all the routes for the line?
line.getRoutes()
returnsnull
You mention NetexParser and NetexEntitiesIndex, I have never seen them. Typically under Java I am creating a HashMap<String, ...>.
- Or do I have to iterate through routes using LineRef as predicate? Is using XPath queries a better way?
That works very well in Python (xsData). But with JAXB doing XPath integrated is "difficult".
You mention NetexParser and NetexEntitiesIndex, I have never seen them. Typically under Java I am creating a HashMap<String, ...>.
NetexParser
etc. is defined in https://github.com/entur/netex-parser-java
That works very well in Python (xsData). But with JAXB doing XPath integrated is "difficult".
I guess then for my use case the I will simply skip using JAXB stuff and handle the NeTEx XML files directly using javax.xml
.
Thanks!
I guess then for my use case the I will simply skip using JAXB stuff and handle the NeTEx XML files directly using
javax.xml
.
I would advise strongly against that.
org.entur.netex.NetexParser
andNetexEntitiesIndex
Using the Line->Route relation as example:
route.getLineRef()
line.getRoutes()
returnsnull