View Javadoc
1   package gboat2.base.bridge.util.xml;
2   
3   import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
4   
5   /**
6    * XML 命名空间与其前缀映射关系的实现
7    * 
8    * @author <a href="mailto:[email protected]">何明旺</a>
9    * @since 3.0
10   * @date 2014年4月1日
11   */
12  class NamespacePrefixMapperImpl extends NamespacePrefixMapper {
13  
14      @Override
15      public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
16          if ("http://www.w3.org/2001/XMLSchema-instance".equals(namespaceUri))
17              return "xsi";
18  
19          if ("http://i2b2.mgh.harvard.edu/message".equals(namespaceUri))
20              return "i2b2";
21  
22          return suggestion;
23      }
24  
25      @Override
26      public String[] getPreDeclaredNamespaceUris() {
27          return new String[] {};
28      }
29  }