Java 怎么从XML命名空间中给定的限定名获取前缀

2019年7月21日19:55:04Java 怎么从XML命名空间中给定的限定名获取前缀已关闭评论 394 806字阅读2分41秒

1.简介

Java 怎么从XML命名空间中给定的限定名获取前缀?——请看下文。

2.示例代码

/**
 * 版权所有 编程十万个怎么办(www.tah1986.com)
 */


   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http:

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

 */


public class Main {
    
    public static String getPrefix(String s) {
        int i = s.indexOf(':');
        return (i == -1 || i == s.length() - 1) ? null : s.substring(0, i);
    }
}

 
继续阅读
编程十万个怎么办