You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 'Chris John - NOAA Affiliate' via ERDDAP
More recent versions of ERDDAP™ have instituted a SAX based parser to parse the xml files (from the change log is looks like the parser was first added to ERDDAP™ version 2.25), rather than the hand-rolled one that was in previous versions of ERDDAP™ and is still in the present version as an option. In the long-run the SAX based version is preferred, and there may come a time when it is the only option. The SAX parser is stricter than the original parser, so while your ERDDAP™ xml files may work now they could throw errors when switched to the SAX parser
In recent versions of ERDDAP™ the SAX parser is turned on in the setup.xml file by including:
<useSaxParser>true</useSaxParser>
I believe in the most recent versions this is “true” by default, so if you haven’t turned off the SAX parser and your xml files aren’t throwing any errors for versions 2.25 and later you are good to go.
What can you do to prepare if this isn’t the case?. Attached is a Java program that basically uses the same SAX parser so it should produce similar results. It is important to use this program because I have found that regular xml validators don’t catch some of these problems, and even xmlLint with the “sax” option does not find all of the problems. I found that the SAX parser seems to want to stop on the first error and couldn’t find a way around it, so the code below does two steps - the first just looks for some of the most common problems, that being having an & rather than & and the second is having “—“ in comments. It will then also run the SAX parser until it fails. If and when the program makes it all the way through you should be good to go. The program prints the line number and column of the error as well as the type of error.
If you save the attached file as EnhancedXMLValidatorNew.java, then you do:
Also, if you know Java and can improve this program please do. It works for me so I thought I would share it. And yes you can do similar in other languages but the reason for using Java is because that is what ERDDAP™ is using so it should produce similar results.