• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NcNameResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createCleanNCName

import org.n52.oxf.xml.NcNameResolver; //导入依赖的package包/类
/**
 * @return result[0] := newName<br /> result[1] := originaleName
 */
private String[] createCleanNCName(final Resource res) {
	// implement check for NCName compliance and remove bad values
	String name = res.getName();
	final String origName = new String(name);
	// clean rest of string using Constants.UNICODE_REPLACER
	final char[] foiNameChars = name.toCharArray();
	for (int i = 0; i < foiNameChars.length; i++) {
		final char c = foiNameChars[i];
		if (!NcNameResolver.isNCNameChar(c)) {
			foiNameChars[i] = Configuration.UNICODE_REPLACER;
		}
	}
	name = String.valueOf(foiNameChars);
	// check if name is only containing "_"
	final Matcher matcher = Configuration.UNICODE_ONLY_REPLACER_LEFT_PATTERN.matcher(name);
	if (matcher.matches()) {
		// if yes -> change to "className" + res.getUri().hashCode()
		name = res.getClass().getSimpleName().toLowerCase() + res.getUri().hashCode();
	}
	final String[] result = { name, origName };
	return result;
}
 
开发者ID:52North,项目名称:sos-importer,代码行数:26,代码来源:DataFile.java


示例2: getOffering

import org.n52.oxf.xml.NcNameResolver; //导入依赖的package包/类
public Offering getOffering(final Sensor s) {
	final Offering off = configuration.getOffering(s);
	if (!NcNameResolver.isNCName(off.getName())) {
		final String[] a = createCleanNCName(off);
		off.setName(a[0]);
		if (!a[0].equals(a[1])) {
			LOG.debug(String.format("Offering name changed to match NCName production: '%s' to '%s'",
					a[1],
					a[0]));
		}
	}
	return off;
}
 
开发者ID:52North,项目名称:sos-importer,代码行数:14,代码来源:DataFile.java


示例3: addResult

import org.n52.oxf.xml.NcNameResolver; //导入依赖的package包/类
private void addResult(final SweArrayObservationParameters obsParameter) {
	final DataArrayDocument xbDataArrayDoc = DataArrayDocument.Factory.newInstance();
	final DataArrayType xbDataArray = xbDataArrayDoc.addNewDataArray1();
	// count
	xbDataArray.addNewElementCount().addNewCount().setValue(BigInteger.valueOf(timeseries.size()));
	// element type
	final DataRecordType xbDataRecord = DataRecordType.Factory.newInstance();
	// phentime
	final Field xbPhenTime = xbDataRecord.addNewField();
	xbPhenTime.setName("phenomenonTime");
	final TimeType xbTimeWithUom = TimeType.Factory.newInstance();
	xbTimeWithUom.setDefinition("http://www.opengis.net/def/property/OGC/0/PhenomenonTime");
	xbTimeWithUom.addNewUom().setHref("http://www.opengis.net/def/uom/ISO-8601/0/Gregorian");
	xbPhenTime.addNewAbstractDataComponent().set(xbTimeWithUom);
	xbPhenTime
		.getAbstractDataComponent()
		.substitute(XMLConstants.QN_SWE_2_0_TIME, TimeType.type);
	// obsProp
	final Field xbObsProperty = xbDataRecord.addNewField();
	xbObsProperty.setName(NcNameResolver.fixNcName(getObservedProperty().getName()));
	final QuantityType xbQuantityWithUom = QuantityType.Factory.newInstance();
	xbQuantityWithUom.setDefinition(getObservedProperty().getUri());
	xbQuantityWithUom.addNewUom().setCode(getUnitOfMeasurementCode());
	xbObsProperty.addNewAbstractDataComponent().set(xbQuantityWithUom);
	xbObsProperty
		.getAbstractDataComponent()
		.substitute(XMLConstants.QN_SWE_2_0_QUANTITY, QuantityType.type);

	final ElementType xbElementType = xbDataArray.addNewElementType();
	xbElementType.setName("definition");
	xbElementType.addNewAbstractDataComponent().set(xbDataRecord);
	xbElementType
		.getAbstractDataComponent()
		.substitute(XMLConstants.QN_SWE_2_0_DATA_RECORD, DataRecordType.type);

	// encoding
	final TextEncodingType textEncoding = TextEncodingType.Factory.newInstance();
	// token
	textEncoding.setTokenSeparator(tokenSeparator);
	// block seperator
	textEncoding.setBlockSeparator(blockSeparator);
	xbDataArray.addNewEncoding().addNewAbstractEncoding().set(textEncoding);
	xbDataArray
		.getEncoding().getAbstractEncoding()
		.substitute(XMLConstants.QN_SWE_2_0_TEXT_ENCODING, TextEncodingType.type);

	// values
	xbDataArray.addNewValues().set(createValuesString());
	obsParameter.addObservationValue(xbDataArrayDoc.xmlText());
}
 
开发者ID:52North,项目名称:sos-importer,代码行数:51,代码来源:TimeSeries.java


示例4: unwrapSensorMLFrom

import org.n52.oxf.xml.NcNameResolver; //导入依赖的package包/类
public static SensorMLDocument unwrapSensorMLFrom(XmlObject xmlObject) throws XmlException, XMLHandlingException, IOException {
    if (SoapUtil.isSoapEnvelope(xmlObject)) {
        xmlObject = SoapUtil.stripSoapEnvelope(xmlObject);
    }
    if (xmlObject instanceof SensorMLDocument) {
        return (SensorMLDocument) xmlObject;
    }
    if (xmlObject instanceof DescribeSensorResponseDocument) {
        DescribeSensorResponseDocument responseDoc = (DescribeSensorResponseDocument) xmlObject;
        DescribeSensorResponseType response = responseDoc.getDescribeSensorResponse();
        DescribeSensorResponseType.Description[] descriptionArray = response.getDescriptionArray();
        if (descriptionArray.length == 0) {
            LOGGER.warn("No SensorDescription available in response!");
        }
        else {
            for (DescribeSensorResponseType.Description description : descriptionArray) {
                SensorDescriptionType.Data dataDescription = description.getSensorDescription().getData();
                String namespace = "declare namespace gml='http://www.opengis.net/gml'; ";
                for (XmlObject xml : dataDescription.selectPath(namespace + "$this//*/@gml:id")) {
                    XmlCursor cursor = xml.newCursor();
                    String gmlId = cursor.getTextValue();
                    if ( !NcNameResolver.isNCName(gmlId)) {
                        cursor.setTextValue(NcNameResolver.fixNcName(gmlId));
                    }
                }
                XmlObject object = XmlObject.Factory.parse(dataDescription.xmlText());
                if (object instanceof SystemDocumentImpl) {
                    SensorMLDocument smlDoc = SensorMLDocument.Factory.newInstance();
                    SensorMLDocument.SensorML.Member member = smlDoc.addNewSensorML().addNewMember();
                    member.set(XMLBeansParser.parse(object.newInputStream()));
                    return smlDoc;
                }

                return SensorMLDocument.Factory.parse(dataDescription.newInputStream());
            }
        }
    }

    LOGGER.warn("Failed to unwrap SensorML from '{}'. Return an empty description.", xmlObject.xmlText());
    return SensorMLDocument.Factory.newInstance();
}
 
开发者ID:52North,项目名称:SensorWebClient,代码行数:42,代码来源:DescribeSensorParser.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ViewServiceSet类代码示例发布时间:2022-05-16
下一篇:
Java IsEqualsToImpl类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap