1 /*
2 * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1713 */
1714 private String getAttrPrefix(String uri) {
1715 if (fAttrNamespace != null) {
1716 return fAttrNamespace.get(uri);
1717 }
1718 return null;
1719 }
1720 private void addAttrNamespace(String prefix, String uri) {
1721 if (fAttrNamespace == null) {
1722 fAttrNamespace = new HashMap<>();
1723 }
1724 fAttrNamespace.put(prefix, uri);
1725 }
1726 /**
1727 * @param uri
1728 * @return
1729 */
1730 private boolean isDefaultNamespace(String uri) {
1731 String defaultNamespace = fInternalNamespaceContext.getURI(DEFAULT_PREFIX);
1732
1733 if (uri.equals(defaultNamespace)) {
1734 return true;
1735 }
1736
1737 return false;
1738 }
1739
1740 /**
1741 * @param prefix
1742 * @param uri
1743 * @return
1744 */
1745 private boolean checkUserNamespaceContext(String prefix, String uri) {
1746 if (fNamespaceContext.userContext != null) {
1747 String tmpURI = fNamespaceContext.userContext.getNamespaceURI(prefix);
1748
1749 if ((tmpURI != null) && tmpURI.equals(uri)) {
1750 return true;
1751 }
1752 }
1753
1754 return false;
1755 }
1756
1757 /**
|
1 /*
2 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1713 */
1714 private String getAttrPrefix(String uri) {
1715 if (fAttrNamespace != null) {
1716 return fAttrNamespace.get(uri);
1717 }
1718 return null;
1719 }
1720 private void addAttrNamespace(String prefix, String uri) {
1721 if (fAttrNamespace == null) {
1722 fAttrNamespace = new HashMap<>();
1723 }
1724 fAttrNamespace.put(prefix, uri);
1725 }
1726 /**
1727 * @param uri
1728 * @return
1729 */
1730 private boolean isDefaultNamespace(String uri) {
1731 String defaultNamespace = fInternalNamespaceContext.getURI(DEFAULT_PREFIX);
1732
1733 return uri != null && uri.equals(defaultNamespace);
1734 }
1735
1736 /**
1737 * @param prefix
1738 * @param uri
1739 * @return
1740 */
1741 private boolean checkUserNamespaceContext(String prefix, String uri) {
1742 if (fNamespaceContext.userContext != null) {
1743 String tmpURI = fNamespaceContext.userContext.getNamespaceURI(prefix);
1744
1745 if ((tmpURI != null) && tmpURI.equals(uri)) {
1746 return true;
1747 }
1748 }
1749
1750 return false;
1751 }
1752
1753 /**
|