1 /*
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Oct 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 // Sep 14, 2000:
23 // Fixed comments to preserve whitespaces and add a line break
1885 * If the URI has been mapped to a prefix, returns the
1886 * prefix, otherwise returns null.
1887 *
1888 * @param namespaceURI The namespace URI
1889 * @return The namespace prefix if known, or null
1890 */
1891 protected String getPrefix( String namespaceURI )
1892 {
1893 String prefix;
1894
1895 if ( _prefixes != null ) {
1896 prefix = _prefixes.get( namespaceURI );
1897 if ( prefix != null )
1898 return prefix;
1899 }
1900 if ( _elementStateCount == 0 ) {
1901 return null;
1902 }
1903 for ( int i = _elementStateCount ; i > 0 ; --i ) {
1904 if ( _elementStates[ i ].prefixes != null ) {
1905 prefix = (String) _elementStates[ i ].prefixes.get( namespaceURI );
1906 if ( prefix != null )
1907 return prefix;
1908 }
1909 }
1910 return null;
1911 }
1912
1913 /**
1914 * The method modifies global DOM error object
1915 *
1916 * @param message
1917 * @param severity
1918 * @param type
1919 * @return a DOMError
1920 */
1921 protected DOMError modifyDOMError(String message, short severity, String type, Node node){
1922 fDOMError.reset();
1923 fDOMError.fMessage = message;
1924 fDOMError.fType = type;
1925 fDOMError.fSeverity = severity;
|
1 /*
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Nov 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 // Sep 14, 2000:
23 // Fixed comments to preserve whitespaces and add a line break
1885 * If the URI has been mapped to a prefix, returns the
1886 * prefix, otherwise returns null.
1887 *
1888 * @param namespaceURI The namespace URI
1889 * @return The namespace prefix if known, or null
1890 */
1891 protected String getPrefix( String namespaceURI )
1892 {
1893 String prefix;
1894
1895 if ( _prefixes != null ) {
1896 prefix = _prefixes.get( namespaceURI );
1897 if ( prefix != null )
1898 return prefix;
1899 }
1900 if ( _elementStateCount == 0 ) {
1901 return null;
1902 }
1903 for ( int i = _elementStateCount ; i > 0 ; --i ) {
1904 if ( _elementStates[ i ].prefixes != null ) {
1905 prefix = _elementStates[ i ].prefixes.get( namespaceURI );
1906 if ( prefix != null )
1907 return prefix;
1908 }
1909 }
1910 return null;
1911 }
1912
1913 /**
1914 * The method modifies global DOM error object
1915 *
1916 * @param message
1917 * @param severity
1918 * @param type
1919 * @return a DOMError
1920 */
1921 protected DOMError modifyDOMError(String message, short severity, String type, Node node){
1922 fDOMError.reset();
1923 fDOMError.fMessage = message;
1924 fDOMError.fType = type;
1925 fDOMError.fSeverity = severity;
|