Sign in to follow this  
Followers 0
Jose Lozano

Validating GPX

8 posts in this topic

Hi everybody,

I've been working with GPX for a month so far and I manage to validate my GPX files against the schema. However, as you probably now, this schema has the <extensions> tag to extend the funcionality. Well, what I need is to validate that part against my own schema. I'm using Java. I thought already about forming another xml document pasting all those parts inside the "extensions" tags together, but I'm sure there must be a better way.

Thanks in advance!

Share this post


Link to post
Share on other sites

If you use another schema inside <extensions>, you need to declare that schema and namespace in the top of the GPX file. The SAXCount validation described in the link above will then validate your GPX document against both the GPX 1.1 schema and your extension schema.

I don't know of a Java way to do this, but the MSXML parser has an option to validate on open.

Share this post


Link to post
Share on other sites
If you use another schema inside <extensions>, you need to declare that schema and namespace in the top of the GPX file. The SAXCount validation described in the link above will then validate your GPX document against both the GPX 1.1 schema and your extension schema.

I don't know of a Java way to do this, but the MSXML parser has an option to validate on open.

I've tried that already. That command-line tool validates only against the GPX schema. If I deliberately change tags inside <extensions> it says it's correct; meaning it is not validating that part against the second schema.

Anyway, I'm just taking those fragments away and pasting them into another document, a pity cause I think it's a quite bad solution, but still... at least it works hehe.

Thanks a lot Dan for your answers.

Share this post


Link to post
Share on other sites

Then you are doing something wrong, because I use SAXCount to validate GPX against three different included schemas, and I've caught many errors in <extensions> this way. Sorry I can't be more helpful, but this method DOES work if your schemas are all declared correctly at the top of the GPX file.

Share this post


Link to post
Share on other sites
I've tried that already. That command-line tool validates only against the GPX schema. If I deliberately change tags inside <extensions> it says it's correct; meaning it is not validating that part against the second schema.

Hmm. Let me try something (if I have time :unsure: ); MSXML is useable through COM/ActiveX and I've used it successfully though not yet with multiple namespaces.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0