Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior when uri has null value #13

Open
acarolgon opened this issue Nov 11, 2022 · 1 comment
Open

Behavior when uri has null value #13

acarolgon opened this issue Nov 11, 2022 · 1 comment

Comments

@acarolgon
Copy link

When using saxon I had some problems with nullPointer

java.lang.NullPointerException: null
	at net.sf.saxon.event.ReceivingContentHandler.getNodeName(ReceivingContentHandler.java:529) ~[Saxon-HE-11.4.jar:?]
	at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:375) ~[Saxon-HE-11.4.jar:?]

Shouldn't the null value have the same behavior as empty string?

@michaelhkay
Copy link
Member

You've raised the question in a rather strange place - the place for Saxon questions is the forum at saxonica.plan.io. This GitHub repository relates to the obsolete product Saxon-CE, which was a predecessor to SaxonJS.

The Java method ReceivingContentHandler.startElement() implements the interface org.xml.sax.ContentHandler.startElement(), and there's nothing in the Javadoc for that interface that suggests any of the arguments can be null. In fact, it clearly indicates that absent values are represented as a zero-length string.

There are some complications with this interface, because it's designed as a callback for XML parsers, and the way the arguments are supplied is supposed to depend on how the XML parser is configured. But we don't necessarily know how the XML parser was configured (and the caller might not even be an XML parser), so we have to make assumptions. It's also a very performance-critical interface so we can't afford to validate everything passed across. But despite the fact that the interface spec allows lots of variations in what's passed across, none of those variations suggest that null values should be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants