bundles/org.eclipse.packagedrone.repo.xml/src/org/eclipse/packagedrone/repo/xml/XmlFiles.java
public static boolean isXml ( final Path path ) throws IOException
    {
        final XmlToolsFactory xml = Activator.getXmlToolsFactory ();
        final XMLInputFactory xin = xml.newXMLInputFactory ();

        try ( InputStream stream = new BufferedInputStream ( Files.newInputStream ( path ) ) )
        {
            try
            {
                final XMLStreamReader reader = xin.createXMLStreamReader ( stream );
                reader.next ();
                return true;
            }
            catch ( final XMLStreamException e )
            {
                return false;
            }
        }
    }
public static boolean isXml ( final Path path ) throws IOException
    {
        final XmlToolsFactory xml = Activator.getXmlToolsFactory ();
        final XMLInputFactory xin = xml.newXMLInputFactory ();

        try ( InputStream stream = new BufferedInputStream ( Files.newInputStream ( path ) ) )
        {
            try
            {
                final XMLStreamReader reader = xin.createXMLStreamReader ( stream );
                reader.next ();
                return true;
            }
            catch ( final XMLStreamException e )
            {
                return false;
            }
        }
    }
public static boolean isXml ( final Path path ) throws IOException { final XmlToolsFactory xml = Activator . getXmlToolsFactory ( ) ; final XMLInputFactory xin = xml . newXMLInputFactory ( ) ; try ( InputStream stream = new BufferedInputStream ( Files . newInputStream ( path ) ) ) { try { final XMLStreamReader reader = xin . createXMLStreamReader ( stream ) ; reader . next ( ) ; return true ; } catch ( final XMLStreamException e ) { return false ; } } }
Test if this file is an XML file

@param path
the path to check
@return <code>true</code> if this is an XML file
@throws IOException
if the probing fails
Test if this file is an XML file