Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1089eac8 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- improved dealing with predefined vocabulary in parser

parent 463de613
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
/*
* $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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment