diff --git a/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java b/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java index c140e98bf582ea5d458c566239389d195ebaca8e..7c7698e197c25affe96f4c6f024e5ab50faeaa47 100644 --- a/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java +++ b/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java @@ -4,7 +4,7 @@ * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Copyright (C) 2005 Digital Enterprise Research Insitute (DERI) Galway * Sourceforge version 1.6 - 2008 - then OmwgElement - * Copyright (C) INRIA, 2008-2010, 2012 + * Copyright (C) INRIA, 2008-2010, 2012, 2014 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -211,14 +211,18 @@ public enum SyntaxElement { * @throws NullPointerException * if the string is null */ - public static SyntaxElement getElementByName(final String s) { - if (s == null) { - throw new NullPointerException("The string must not be null"); + public static SyntaxElement getElementByName( final String s ) { + if ( s == null ) throw new NullPointerException("The string must not be null"); + for ( SyntaxElement e : SyntaxElement.values() ) { + if ( s.equals( e.getName() ) ) return e; } + return null; + } + + public static SyntaxElement getSyntaxElement( final Namespace ns, final String s ) { + if ( s == null ) throw new NullPointerException("The string must not be null"); for ( SyntaxElement e : SyntaxElement.values() ) { - if ( s.equals( e.getName() ) ) { - return e; - } + if ( ns == e.getNamespace() && s.equals( e.getName() ) ) return e; } return null; } diff --git a/src/fr/inrialpes/exmo/align/parser/XMLParser.java b/src/fr/inrialpes/exmo/align/parser/XMLParser.java index 9d48978d69776505723ec2885c6414e3244f600e..bd8d94cbc75b8868f21fd12182e2ef637be5b713 100644 --- a/src/fr/inrialpes/exmo/align/parser/XMLParser.java +++ b/src/fr/inrialpes/exmo/align/parser/XMLParser.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2003-2005, 2007-2013 + * Copyright (C) INRIA, 2003-2005, 2007-2014 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -330,9 +330,6 @@ public class XMLParser extends DefaultHandler { curronto = onto1; } else if (pName.equals("uri2")) { // Legacy } else if (pName.equals("uri1")) { // Legacy - } else if (pName.equals( SyntaxElement.TYPE.name )) { - } else if (pName.equals( SyntaxElement.LEVEL.name )) { - } else if (pName.equals( SyntaxElement.XML.name )) { } else if (pName.equals( SyntaxElement.ALIGNMENT.name )) { alignLevel = parseLevel; parseLevel = 2; // for embeded (RDF is usually 1) @@ -344,7 +341,9 @@ public class XMLParser extends DefaultHandler { alignment.setExtension( Namespace.ALIGNMENT.uri, Annotations.ID, about ); }; } else { - logger.warn( "Unknown element name : {}", pName ); + // This should avoid all the stuff before + if ( SyntaxElement.getSyntaxElement( Namespace.ALIGNMENT, pName ) == null ) + logger.warn( "Unknown element name : {}", pName ); }; } else if ( namespaceURI.equals( Namespace.SOAP_ENV.prefix )) { //"http://schemas.xmlsoap.org/soap/envelope/")) { // Ignore SOAP namespace