当前位置: 首页>>代码示例>>Java>>正文


Java NamespaceMappings类代码示例

本文整理汇总了Java中org.apache.xml.serializer.NamespaceMappings的典型用法代码示例。如果您正苦于以下问题:Java NamespaceMappings类的具体用法?Java NamespaceMappings怎么用?Java NamespaceMappings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NamespaceMappings类属于org.apache.xml.serializer包,在下文中一共展示了NamespaceMappings类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ensureNamespaceDeclDeclared

import org.apache.xml.serializer.NamespaceMappings; //导入依赖的package包/类
/**
 * This function checks to make sure a given prefix is really
 * declared.  It might not be, because it may be an excluded prefix.
 * If it's not, it still needs to be declared at this point.
 * TODO: This needs to be done at an earlier stage in the game... -sb
 *
 * NEEDSDOC @param dtm
 * NEEDSDOC @param namespace
 *
 * @throws org.xml.sax.SAXException
 */
public static void ensureNamespaceDeclDeclared(
    SerializationHandler handler,
    DTM dtm,
    int namespace)
    throws org.xml.sax.SAXException
{

    String uri = dtm.getNodeValue(namespace);
    String prefix = dtm.getNodeNameX(namespace);

    if ((uri != null && uri.length() > 0) && (null != prefix))
    {
        String foundURI;
        NamespaceMappings ns = handler.getNamespaceMappings();
        if (ns != null)
        {

            foundURI = ns.lookupNamespace(prefix);
            if ((null == foundURI) || !foundURI.equals(uri))
            {
                handler.startPrefixMapping(prefix, uri, false);
            }
        }
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:37,代码来源:SerializerUtils.java

示例2: resolvePrefix

import org.apache.xml.serializer.NamespaceMappings; //导入依赖的package包/类
/**
 * Resolve the namespace into a prefix.  At this level, if no prefix exists, 
 * then return a manufactured prefix.
 *
 * @param rhandler The current result tree handler.
 * @param prefix The probable prefix if already known.
 * @param nodeNamespace  The namespace, which should not be null.
 *
 * @return The prefix to be used.
 */
protected String resolvePrefix(SerializationHandler rhandler,
                               String prefix, String nodeNamespace)
  throws TransformerException
{

  if (null != prefix && (prefix.length() == 0 || prefix.equals("xmlns")))
  {
    // Since we can't use default namespace, in this case we try and 
    // see if a prefix has already been defined or this namespace.
    prefix = rhandler.getPrefix(nodeNamespace);

    // System.out.println("nsPrefix: "+nsPrefix);           
    if (null == prefix || prefix.length() == 0 || prefix.equals("xmlns"))
    {
      if(nodeNamespace.length() > 0)
      {
          NamespaceMappings prefixMapping = rhandler.getNamespaceMappings();
          prefix = prefixMapping.generateNextPrefix();
      }
      else
        prefix = "";
    }
  }
  return prefix;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:36,代码来源:ElemAttribute.java

示例3: setNamespaceMappings

import org.apache.xml.serializer.NamespaceMappings; //导入依赖的package包/类
public void setNamespaceMappings(NamespaceMappings mappings) {
  mySerializationHandler.setNamespaceMappings(mappings);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TracingSerializationHandler.java

示例4: getNamespaceMappings

import org.apache.xml.serializer.NamespaceMappings; //导入依赖的package包/类
public NamespaceMappings getNamespaceMappings() {
  return mySerializationHandler.getNamespaceMappings();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TracingSerializationHandler.java

示例5: setNamespaceMappings

import org.apache.xml.serializer.NamespaceMappings; //导入依赖的package包/类
public void setNamespaceMappings(NamespaceMappings arg0) {
	xmlStream.setNamespaceMappings(arg0);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:4,代码来源:XHTMLSerializer2.java

示例6: getNamespaceMappings

import org.apache.xml.serializer.NamespaceMappings; //导入依赖的package包/类
public NamespaceMappings getNamespaceMappings() {
	return xmlStream.getNamespaceMappings();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:4,代码来源:XHTMLSerializer2.java


注:本文中的org.apache.xml.serializer.NamespaceMappings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。