0

The SAXParseException message is:

org.xml.sax.SAXParseException; systemId: file:///home/IdeaProjects/RGAME/FullPHSHuman.xml; lineNumber: 8; columnNumber: 11; cvc-complex-type.2.4.a: Invalid content was found starting with element 'PHSHumanSubjectsAndClinicalTrialsInfo:HumanSubjectsIndicator1'. One of '{"http://apply.grants.gov/forms/PHSHumanSubjectsAndClinicalTrialsInfo-V1.0":HumanSubjectsIndicator}' is expected.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)

A method to: 'PHSHumanSubjectsAndClinicalTrialsInfo-V1.0:HumanSubjectsIndicator' <- getElementNameFromExceptionMessage()

Other than pattern matching, is there a way to get the missing element name from the exception message? The message might be getting formed internally somewhere. Thus the question.

mark42inbound
  • 364
  • 1
  • 4
  • 19
  • Do not repost your question when you don't like the [**answer**](https://stackoverflow.com/a/47632939/290085) you previously received. – kjhughes Dec 04 '17 at 13:23
  • @kjhughes, I have not received an answer that I dislike. In fact, there's no response to my comment. This question is totally independent of the one you've tagged in the comment. There's no relevance to the fundamental concepts of both questions. Just the same statements in both places does not NECESSARILY prove it is a duplicate. Do understand the questions first! – mark42inbound Dec 04 '17 at 13:33
  • There is no response to your comment because there, like here, **you're asking again despite having been told the answer**, which you evidently hope will change by asking again. (The answer is "no." Michael Kay even goes on to explain thoughtfully why the answer is "no": *The reason most schema processors don't give you this information is because of the way they work internally...*) – kjhughes Dec 04 '17 at 13:41
  • @kjhughes, perhaps you failed to even read the question totally. In the original question, I have not even mentioned extracting the element name from the SAXParseException. It was that just after posting the question, I thought of another way to solved the question and came up with this another question. I'm not sure that Michal Kay has read my comments in response. Still, the fundamental concepts are INDEPENDENT. Is it so difficult to understand the relevance? Instead, please answer the question. – mark42inbound Dec 04 '17 at 14:19
  • **There is no API for determining the missing element name.** Your first question was reasonable and has been fully answered. At best, this question is a duplicate of that one; throughout your question and several comments, you've failed to explain otherwise. At worst, it's a weak question that you could answer yourself by reading the [**documentation for SAXParseException**](https://docs.oracle.com/javase/7/docs/api/org/xml/sax/SAXParseException.html). This is my last comment on the matter. Good luck. – kjhughes Dec 04 '17 at 15:07

0 Answers0