That would suggest that the "builder" variable is null. There is no other way that line of code could throw a NullPointerException.
Of course that can't possibly be the case in the code you posted. So either you posted some other code, or you are mistaken about where the exception is being thrown. Seeing the stack trace would help.
builder value is not null. I printed that. Here is the stack trace:
builder : oracle.xml.parser.schema.XSDBuilder@10b4b2f java.lang.NullPointerException at oracle.xml.parser.schema.XSDBuilder.parseComplexTypeContent(XSDBuilder.java:1372) at oracle.xml.parser.schema.XSDBuilder.parseComplexType(XSDBuilder.java:1210) at oracle.xml.parser.schema.XSDBuilder.parseTopLevelElem(XSDBuilder.java:625) at oracle.xml.parser.schema.XSDBuilder.buildSchema(XSDBuilder.java:486) at oracle.xml.parser.schema.XSDBuilder.build(XSDBuilder.java:304) at oracle.xml.parser.schema.XSDBuilder.build(XSDBuilder.java:286) at utility.DOMValidator.validateSchema(DOMValidator.java:40) at utility.DOMValidator.main(DOMValidator.java:168)
As I thought, you were mistaken about where the exception was being thrown. So given what you just posted, either the "url" variable contains a null reference, or when you read from the URL it refers to, you get something that is in error in some way.
I want to validate the XML with the XSD and find all the XML elements which have error and append a corresponding <error></error> tag in those elements and return the whole request XML back to the client.