Injection attacks are considered to impact the most widespread vulnerabilities in web applications by Open Web Application Security Project (OWASP). XML is used as an alternative technology to database systems to store data in XML format, which can be queried to produce the desired results. XPath is a query language for XML which has injection issues similar to SQL. XPath can be used by the attacker to exploit the vulnerabilities in web applications by injecting malicious XPath query. If the web service is injected with malicious XML code, then it affects all the applications which integrate the infected web service. In this paper, we propose a solution, which uses count-based validation technique and Long Short-Term Memory (LSTM) modular neural networks to identify and classify atypical behavior in user input. Once the atypical user input is identified, the attacker is redirected to sham resources to protect the critical data. Our experiment results in over 90% accuracy in classification of input vectors. Our results also show that use of modular neural network results in improved response time of the web application compared to single neural network.