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


Java QName.getLocalName方法代码示例

本文整理汇总了Java中net.sf.saxon.s9api.QName.getLocalName方法的典型用法代码示例。如果您正苦于以下问题:Java QName.getLocalName方法的具体用法?Java QName.getLocalName怎么用?Java QName.getLocalName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.saxon.s9api.QName的用法示例。


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

示例1: getOptionValue

import net.sf.saxon.s9api.QName; //导入方法依赖的package包/类
protected String getOptionValue(QName name)
{
   String key = name.getLocalName();
   if (name.getNamespaceURI()!=null) {
      key = name.getClarkName();
   }
   Object o = getRequest().getAttributes().get(key);
   if (o!=null) {
      return o.toString();
   }
   o = getContext().getAttributes().get(key);
   if (o!=null) {
      return o.toString();
   }
   return getContext().getParameters().getFirstValue(key);
}
 
开发者ID:alexmilowski,项目名称:xproclet,代码行数:17,代码来源:XProcResource.java

示例2: getOptionValue

import net.sf.saxon.s9api.QName; //导入方法依赖的package包/类
protected String getOptionValue(Request request,QName name)
{
   String key = name.getLocalName();
   if (name.getNamespaceURI()!=null) {
      key = name.getClarkName();
   }
   Object o = request.getAttributes().get(key);
   if (o!=null) {
      return o.toString();
   }
   o = getContext().getAttributes().get(key);
   if (o!=null) {
      return o.toString();
   }
   return getContext().getParameters().getFirstValue(key);
}
 
开发者ID:alexmilowski,项目名称:xproclet,代码行数:17,代码来源:XProcHelper.java

示例3: getAssertionValue

import net.sf.saxon.s9api.QName; //导入方法依赖的package包/类
String getAssertionValue(String text, XdmNode paramsVar) {
  if (text.indexOf("$") < 0) {
    return text;
  }
  String newText = text;
  XdmNode params = (XdmNode) paramsVar.axisIterator(Axis.CHILD).next();
  XdmSequenceIterator it = params.axisIterator(Axis.CHILD);
  while (it.hasNext()) {
    XdmNode n = (XdmNode) it.next();
    QName qname = n.getNodeName();
    if (qname != null) {
      String tagname = qname.getLocalName();
      if (tagname.equals("param")) {
                  String name = n.getAttributeValue(LOCALNAME_QNAME);
        String label = getLabel(n);
        newText = StringUtils.replaceAll(newText,
                "{$" + name + "}", label);
      }
    }
  }
  newText = StringUtils.replaceAll(newText, "{$context}", contextLabel);
  return newText;
}
 
开发者ID:opengeospatial,项目名称:teamengine,代码行数:24,代码来源:TECore.java

示例4: constructDatatype

import net.sf.saxon.s9api.QName; //导入方法依赖的package包/类
protected Datatype constructDatatype(final QName qn) throws ValidationException {
    String localName = qn.getLocalName();
    final boolean isAtomic = NS_XSD.equals(qn.getNamespaceURI());
    final boolean allowsMultiple = localName.endsWith("+") | localName.endsWith("*");
    final boolean allowsEmpty = localName.endsWith("?") | localName.endsWith("*");
    if(isAtomic) {
        return constructAtomicDatatype(qn, allowsEmpty, allowsMultiple);
    } else {
        return constructNodeDatatype( qn, allowsEmpty, allowsMultiple);
    }
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:12,代码来源:DatatypeFactory.java

示例5: constructNodeDatatype

import net.sf.saxon.s9api.QName; //导入方法依赖的package包/类
/**
 * Here, only <tt>element()</tt> and <tt>document</tt> are supported.
 * @param qn
 * @param allowsEmpty
 * @param allowsMultiple
 * @return A document fragment
 */
private Datatype constructNodeDatatype(final QName qn, final boolean allowsEmpty, final boolean allowsMultiple) throws ValidationException {
    String localName = qn.getLocalName();
    String typeName = (allowsEmpty | allowsMultiple) ? localName.substring(0, localName.length()) : localName;
    typeName = typeName.trim();
    typeName= typeName.replaceAll("[ ]*\\(", "(");
    if(typeName.startsWith("element(")) {
        return constructElementParserDatatype(qn, allowsEmpty, allowsMultiple);
    } else if(typeName.startsWith("document(")) {
        return constructDocumentParserDatatype(qn, allowsEmpty, allowsMultiple);
    } else {
        throw new ValidationException("Only document() and element() are supported for node types");
    }
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:21,代码来源:DatatypeFactory.java

示例6: constructAtomicDatatype

import net.sf.saxon.s9api.QName; //导入方法依赖的package包/类
private Datatype constructAtomicDatatype(final QName qn, final boolean allowsEmpty, final boolean allowsMultiple) {
    String localName = qn.getLocalName();
    StructuredQName baseType = new StructuredQName(qn.getPrefix(), qn.getNamespaceURI(), (allowsMultiple|allowsEmpty) ? localName.substring(0, localName.length()-1) : localName);
    BuiltInAtomicType theType = null;
    for(BuiltInAtomicType type:ATOMIC_TYPES) {
        if(type.getStructuredQName().equals(baseType)) {
            theType = type;
            break;
        }
    }
    if(theType==null) {
        throw new IllegalArgumentException("Unable to determine datatype of "+qn.getEQName());
    }
    final StringConverter converter = theType.getStringConverter(conversionRules);
    return new Datatype() {
        @Override
        public boolean isAtomic() { return true; }
        @Override
        public boolean allowsMultiple() { return allowsMultiple; }
        @Override
        public boolean allowsEmpty() { return allowsEmpty; }
        @Override
        public XdmValue convert(String input, Configuration configuration) throws ValidationException {
            if(input==null && allowsEmpty()) return XdmValue.wrap(null);
            else if(input==null) throw new ValidationException(qn.toString()+" does not allow empty sequence");
            if(allowsMultiple()) {
                String sValue = input.trim();
                if(sValue.startsWith("(") && sValue.endsWith(")")) {
                    sValue = sValue.substring(1, sValue.length()-1);
                }
                String[] values = sValue.split("[ ]*,[ ]*");
                if(values.length>1) {
                    XdmValue xValue = null;
                    // certainly could be optimized, but I do not expect having 1000 values in a parameter definition...
                    for(String value:values) {
                        XdmValue ret = XdmValue.wrap(converter.convertString(value).asAtomic());
                        if(xValue==null) {
                            xValue = ret;
                        } else {
                            xValue= xValue.append(ret);
                        }
                    }
                    return xValue;
                } else if(values.length==1) {
                    return XdmValue.wrap(converter.convertString(values[0]).asAtomic());
                } else {
                    throw new ValidationException("can not cast "+input+" to "+qn);
                }
            } else {
                return XdmValue.wrap(converter.convertString(input).asAtomic());
            }
        }
    };
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:55,代码来源:DatatypeFactory.java

示例7: constructDocumentParserDatatype

import net.sf.saxon.s9api.QName; //导入方法依赖的package包/类
private Datatype constructDocumentParserDatatype(final QName qn, final boolean allowsEmpty, final boolean allowsMultiple) throws ValidationException {
    String localName= qn.getLocalName();
    if(localName.endsWith("*") || localName.endsWith("+")) {
        throw new ValidationException("Multiple documents are not allowed");
    }
    return new Datatype() {
        @Override
        public boolean isAtomic() { return false; }
        @Override
        public boolean allowsMultiple() { return allowsMultiple; }
        @Override
        public boolean allowsEmpty() { return allowsEmpty; }
        @Override
        public XdmValue convert(String input, Configuration configuration) throws ValidationException {
            Source source = null;
            try {
                configuration.getURIResolver().resolve(input, null);
            } catch(TransformerException ex0) {
                InputStream is = null;
                try {
                    URI uri = new URI(input);
                    is = uri.toURL().openStream();
                } catch (URISyntaxException | IOException ex1) {
                    File f = new File(input);
                    if(f.exists() && f.isFile()) {
                        try {
                            is= new FileInputStream(f);
                        } catch (FileNotFoundException ex2) {
                            // can not happens, checked before
                        }
                    }
                }
                if(is==null) {
                    throw new ValidationException("Unable to load document "+input);
                }
                source = new StreamSource(is);
            }
            DocumentBuilder builder = new Processor(configuration).newDocumentBuilder();
            try {
                return builder.build(source);
            } catch (SaxonApiException ex) {
                throw new ValidationException("Unable to load document "+input,ex);
            }
        }
    };
}
 
开发者ID:cmarchand,项目名称:gaulois-pipe,代码行数:47,代码来源:DatatypeFactory.java


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