# Including both XML code and Java code in a document using lstlisting package

I am writing a document which has both java and xml codes, I managed to highlight my java code but unfortunately I was unable to do the same with xml, so far I have tried more than one way either by including the style set or by modifying the lstlisting file and add key words, I dont know what is the issue exactly my xml code still not highlighted !!!! I appreciate any support Thanks in advance !

As you haven't supplied a minimal working example it is not clear what you have tried, but doesn't specifying the language for each listing environment do what you want? For example, you can highlight the following java and xml code snippets like this

by typing:

\documentclass{article}
\usepackage{listings,color}
\begin{document}

\begin{lstlisting}[language=java]
public class HelloWorld
{
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
\end{lstlisting}

\begin{lstlisting}[language=xml]
<?xml version="1.0" encoding="UTF-8"?>