Skip to content

Package: NameSpaceHandler

NameSpaceHandler

nameinstructionbranchcomplexitylinemethod
NameSpaceHandler()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getNsURIs()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
startPrefixMapping(String, String)
M: 0 C: 22
100%
M: 1 C: 5
83%
M: 1 C: 3
75%
M: 0 C: 5
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * johannes - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.spi.view.migrator;
15:
16: import java.util.ArrayList;
17: import java.util.List;
18:
19: import org.eclipse.emf.ecore.util.ExtendedMetaData;
20: import org.xml.sax.SAXException;
21: import org.xml.sax.helpers.DefaultHandler;
22:
23: /**
24: * Content handler for extraction of namespace URIs from a view model using SAX.
25: *
26: * @since 1.8
27: */
28: public class NameSpaceHandler extends DefaultHandler {
29:
30:         /** Namespace URIs. */
31:         private final List<String> namespaceURIs = new ArrayList<String>();
32:
33:         /**
34:          * {@inheritDoc}
35:          *
36:          * @see org.xml.sax.helpers.DefaultHandler#startPrefixMapping(java.lang.String, java.lang.String)
37:          */
38:         @Override
39:         public void startPrefixMapping(String prefix, String uri) throws SAXException {
40:                 super.startPrefixMapping(prefix, uri);
41:•                if (!uri.equals(ExtendedMetaData.XMI_URI) && !uri.equals(ExtendedMetaData.XML_SCHEMA_URI)
42:•                        && !uri.equals(ExtendedMetaData.XSI_URI)) {
43:                         namespaceURIs.add(uri);
44:                 }
45:         }
46:
47:         /** @return the namespace URIs. */
48:         public List<String> getNsURIs() {
49:                 return namespaceURIs;
50:         }
51: }