gpt4 book ai didi

org.n52.svalbard.util.XmlHelper.substituteElement()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 12:45:05 28 4
gpt4 key购买 nike

本文整理了Java中org.n52.svalbard.util.XmlHelper.substituteElement()方法的一些代码示例,展示了XmlHelper.substituteElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlHelper.substituteElement()方法的具体详情如下:
包路径:org.n52.svalbard.util.XmlHelper
类名称:XmlHelper
方法名:substituteElement

XmlHelper.substituteElement介绍

暂无

代码示例

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

protected XmlObject substitute(XmlObject elementToSubstitute, XmlObject substitutionElement) {
  XmlObject substituteElement = XmlHelper.substituteElement(elementToSubstitute, substitutionElement);
  substituteElement.set(substitutionElement);
  return substituteElement;
}

代码示例来源:origin: org.n52.arctic-sea/svalbard

public static XmlObject substituteElement(XmlObject elementToSubstitute, XmlObject substitutionElement) {
  final Node domNode = substitutionElement.getDomNode();
  QName name;
  if (domNode.getNamespaceURI() != null && domNode.getLocalName() != null) {
    final String prefix = getPrefixForNamespace(elementToSubstitute, domNode.getNamespaceURI());
    if (prefix != null && !prefix.isEmpty()) {
      name = new QName(domNode.getNamespaceURI(), domNode.getLocalName(), prefix);
    } else {
      name = new QName(domNode.getNamespaceURI(), domNode.getLocalName());
    }
  } else {
    final QName nameOfElement = substitutionElement.schemaType().getName();
    final String localPart = nameOfElement.getLocalPart().replace(GmlConstants.EN_PART_TYPE, "");
    name = new QName(nameOfElement.getNamespaceURI(), localPart,
        getPrefixForNamespace(elementToSubstitute, nameOfElement.getNamespaceURI()));
  }
  return substituteElement(elementToSubstitute, substitutionElement.schemaType(), name);
}

代码示例来源:origin: org.n52.svalbard/svalbard

public static XmlObject substituteElement(XmlObject elementToSubstitute, XmlObject substitutionElement) {
  final Node domNode = substitutionElement.getDomNode();
  QName name;
  if (domNode.getNamespaceURI() != null && domNode.getLocalName() != null) {
    final String prefix = getPrefixForNamespace(elementToSubstitute, domNode.getNamespaceURI());
    if (prefix != null && !prefix.isEmpty()) {
      name = new QName(domNode.getNamespaceURI(), domNode.getLocalName(), prefix);
    } else {
      name = new QName(domNode.getNamespaceURI(), domNode.getLocalName());
    }
  } else {
    final QName nameOfElement = substitutionElement.schemaType().getName();
    final String localPart = nameOfElement.getLocalPart().replace(GmlConstants.EN_PART_TYPE, "");
    name = new QName(nameOfElement.getNamespaceURI(), localPart,
        getPrefixForNamespace(elementToSubstitute, nameOfElement.getNamespaceURI()));
  }
  return substituteElement(elementToSubstitute, substitutionElement.schemaType(), name);
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

@Override
protected XmlObject createFeature(FeaturePropertyType featurePropertyType, AbstractFeature abstractFeature,
    EncodingContext context) throws EncodingException {
  OperationalActivityPeriodType encodedObject =
      createOperationalActivityPeriod((OperationalActivityPeriod) abstractFeature);
  featurePropertyType.addNewAbstractFeature().set(encodedObject);
  XmlHelper.substituteElement(featurePropertyType.getAbstractFeature(), encodedObject);
  return featurePropertyType;
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

protected void setMetaDataProperty(SFSamplingFeatureType sfssft, AbstractSamplingFeature sampFeat)
      throws EncodingException {
    if (sampFeat.isSetMetaDataProperty()) {
      for (AbstractMetaData abstractMetaData : sampFeat.getMetaDataProperty()) {
        XmlObject encodeObject = encodeObjectToXml(GmlConstants.NS_GML_32, abstractMetaData);
        XmlObject substituteElement = XmlHelper
            .substituteElement(sfssft.addNewMetaDataProperty().addNewAbstractMetaData(), encodeObject);
        substituteElement.set(encodeObject);
      }
    }
  }
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private void setMetaDataProperty(OmObservation sosObservation, OMObservationType xbObservation)
    throws EncodingException {
  if (sosObservation.isSetMetaDataProperty()) {
    for (AbstractMetaData abstractMetaData : sosObservation.getMetaDataProperty()) {
      XmlObject encodeObject = encodeGML(abstractMetaData);
      XmlObject substituteElement = XmlHelper.substituteElement(
          xbObservation.addNewMetaDataProperty().addNewAbstractMetaData(), encodeObject);
      substituteElement.set(encodeObject);
    }
  }
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private void encodeResultQualities(OMObservationType xbObservation, Set<OmResultQuality> resultQuality)
    throws EncodingException {
  for (OmResultQuality quality : resultQuality) {
    AbstractDQElementDocument encodedQuality = (AbstractDQElementDocument) encodeObjectToXml(null, quality,
        EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT));
    DQElementPropertyType addNewResultQuality = xbObservation.addNewResultQuality();
    addNewResultQuality.setAbstractDQElement(encodedQuality.getAbstractDQElement());
    XmlHelper.substituteElement(addNewResultQuality.getAbstractDQElement(),
        encodedQuality.getAbstractDQElement());
  }
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private XmlObject createGeomteryPropertyType(AbstractGeometry element, EncodingContext ctx)
    throws EncodingException {
  GeometryPropertyType geometryPropertyType = GeometryPropertyType.Factory.newInstance();
  if (element.isReferenced()) {
    geometryPropertyType.setHref(element.getGmlId());
  } else {
    AbstractGeometryType xmlObject = createAbstractGeometry(element, ctx);
    geometryPropertyType.setAbstractGeometry(xmlObject);
    XmlHelper.substituteElement(geometryPropertyType.getAbstractGeometry(), xmlObject);
  }
  return geometryPropertyType;
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private ResultStructure createResultStructure(SosResultStructure resultStructure)
    throws EncodingException {
  // TODO move encoding to SWECommonEncoder
  final DataRecordDocument dataRecordDoc;
  if (resultStructure.isEncoded()) {
    try {
      dataRecordDoc = DataRecordDocument.Factory.parse(resultStructure.getXml().get());
    } catch (XmlException ex) {
      throw unsupportedResultStructure(ex);
    }
  } else {
    XmlObject xml = encodeSwe(EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT), resultStructure.get().get());
    if (xml instanceof DataRecordDocument) {
      dataRecordDoc = (DataRecordDocument) xml;
    } else {
      throw unsupportedResultStructure();
    }
  }
  ResultStructure xbResultStructure = ResultStructure.Factory.newInstance(getXmlOptions());
  xbResultStructure.addNewAbstractDataComponent().set(dataRecordDoc.getDataRecord());
  XmlHelper.substituteElement(xbResultStructure.getAbstractDataComponent(), dataRecordDoc.getDataRecord());
  return xbResultStructure;
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private ResultEncoding createResultEncoding(SosResultEncoding resultEncoding)
    throws EncodingException {
  // TODO move encoding to SWECommonEncoder
  final TextEncodingDocument xbEncoding;
  if (resultEncoding.isEncoded()) {
    try {
      xbEncoding = TextEncodingDocument.Factory.parse(resultEncoding.getXml().get());
    } catch (XmlException ex) {
      throw unsupportedResultEncoding(ex);
    }
  } else {
    XmlObject xml = encodeSwe(EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT), resultEncoding.get().get());
    if (xml instanceof TextEncodingDocument) {
      xbEncoding = (TextEncodingDocument) xml;
    } else {
      throw unsupportedResultEncoding();
    }
  }
  ResultEncoding xbResultEncoding = ResultEncoding.Factory.newInstance(getXmlOptions());
  xbResultEncoding.addNewAbstractEncoding().set(xbEncoding.getTextEncoding());
  XmlHelper.substituteElement(xbResultEncoding.getAbstractEncoding(), xbEncoding.getTextEncoding());
  return xbResultEncoding;
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private DataRecordType.Field createField(SweField field)
    throws EncodingException {
  SweAbstractDataComponent element = field.getElement();
  DataRecordType.Field xmlField = DataRecordType.Field.Factory.newInstance(getXmlOptions());
  if (field.isSetName()) {
    xmlField.setName(NcName.makeValid(field.getName().getValue()));
  }
  XmlObject encodeObjectToXml = createAbstractDataComponent(element, EncodingContext.empty());
  XmlObject substituteElement =
      XmlHelper.substituteElement(xmlField.addNewAbstractDataComponent(), encodeObjectToXml);
  substituteElement.set(encodeObjectToXml);
  return xmlField;
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private void encodeShape(ShapeType xbShape, AbstractSamplingFeature sampFeat) throws EncodingException {
  Encoder<XmlObject, Geometry> encoder = getEncoder(GmlConstants.NS_GML_32, sampFeat.getGeometry());
  if (encoder != null) {
    XmlObject xmlObject = encoder.encode(sampFeat.getGeometry(),
        EncodingContext.of(XmlBeansEncodingFlags.GMLID, sampFeat.getGmlId()));
    if (xbShape.isSetAbstractGeometry()) {
      xbShape.getAbstractGeometry().set(xmlObject);
    } else {
      xbShape.addNewAbstractGeometry().set(xmlObject);
    }
    XmlHelper.substituteElement(xbShape.getAbstractGeometry(), xmlObject);
  } else {
    throw new EncodingException("Error while encoding geometry for feature, needed encoder is missing!");
  }
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

encodeObjectToXml(SweConstants.NS_SWE_20, characteristic.getAbstractDataComponent());
  XmlObject substituteElement =
      XmlHelper.substituteElement(c.addNewAbstractDataComponent(), encodeObjectToXml);
  substituteElement.set(encodeObjectToXml);
} else if (characteristic.isSetHref()) {
  c.setName(NcName.makeValid(component.getName().getValue()));
  XmlObject substituteElement =
      XmlHelper.substituteElement(c.addNewAbstractDataComponent(), encodeObjectToXml);
  substituteElement.set(encodeObjectToXml);

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private XmlObject createFeatureCollection(FeatureCollection element, EncodingContext ctx)
    throws EncodingException {
  FeatureCollectionDocument featureCollectionDoc =
      FeatureCollectionDocument.Factory.newInstance(getXmlOptions());
  FeatureCollectionType featureCollection = featureCollectionDoc.addNewFeatureCollection();
  featureCollection.setId(element.getGmlId());
  EncodingContext context =
      ctx.with(XmlBeansEncodingFlags.PROPERTY_TYPE).without(XmlBeansEncodingFlags.DOCUMENT);
  if (element.isSetMembers()) {
    for (AbstractFeature abstractFeature : element.getMembers().values()) {
      featureCollection.addNewFeatureMember().set(createFeaturePropertyType(abstractFeature, context));
    }
  }
  if (ctx.has(XmlBeansEncodingFlags.DOCUMENT)) {
    return featureCollectionDoc;
  }
  FeaturePropertyType featurePropertyType = FeaturePropertyType.Factory.newInstance(getXmlOptions());
  featurePropertyType.addNewAbstractFeature().set(featureCollection);
  return XmlHelper.substituteElement(featurePropertyType.getAbstractFeature(), featurePropertyType);
  // return featureCollection;
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private void addDataComponentOrObservablePropertyType(DataComponentOrObservablePropertyType type, SmlIo sosSMLIO)
    throws EncodingException {
  if (sosSMLIO.isSetHref()) {
    type.setHref(sosSMLIO.getHref());
    if (sosSMLIO.isSetTitle()) {
      type.setTitle(sosSMLIO.getTitle());
    }
  } else if (sosSMLIO.getIoValue() instanceof SweObservableProperty) {
    addValueToObservableProperty(type.addNewObservableProperty(), sosSMLIO.getIoValue());
    // TODO } else if (sosSMLIO.getIoValue() instanceof
    // SmlDataInterface) {
  } else {
    final XmlObject encodeObjectToXml = encodeObjectToXmlSwe20(sosSMLIO.getIoValue());
    XmlObject substituteElement =
        XmlHelper.substituteElement(type.addNewAbstractDataComponent(), encodeObjectToXml);
    substituteElement.set(encodeObjectToXml);
  }
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

if (xml != null && xml instanceof AbstractCRSType) {
  final XmlObject substituteElement =
      XmlHelper.substituteElement(sccrspt.addNewAbstractCRS(), xml);
  substituteElement.set(xml);
} else {

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private Capabilities createCapability(final SmlCapabilities capabilities) throws EncodingException {
  final Capabilities xbCapabilities = Capabilities.Factory.newInstance(getXmlOptions());
  if (capabilities.isSetName()) {
    xbCapabilities.setName(capabilities.getName());
  }
  if (capabilities.isSetAbstractDataRecord() && capabilities.getDataRecord().isSetFields()) {
    final XmlObject encodedDataRecord =
        encodeObjectToXml(SweConstants.NS_SWE_101, capabilities.getDataRecord());
    final XmlObject substituteElement =
        XmlHelper.substituteElement(xbCapabilities.addNewAbstractDataRecord(), encodedDataRecord);
    substituteElement.set(encodedDataRecord);
  } else if (capabilities.isSetHref()) {
    xbCapabilities.setHref(capabilities.getHref());
    if (capabilities.isSetTitle()) {
      xbCapabilities.setTitle(capabilities.getTitle());
    }
  }
  return xbCapabilities;
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

new EncodingContext().with(XmlBeansEncodingFlags.GMLID, absFeature.getGmlId()));
  xbShape.addNewAbstractGeometry().set(xmlObject);
  XmlHelper.substituteElement(xbShape.getAbstractGeometry(), xmlObject);
} else {
  throw new EncodingException("Error while encoding geometry for feature, needed encoder is missing!");

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

XmlHelper.substituteElement(c.addNewAbstractDataComponent(), encodeObjectToXml);
substituteElement.set(encodeObjectToXml);
    XmlHelper.substituteElement(capability.addNewAbstractDataComponent(), encodeObjectToXml);
substituteElement.set(encodeObjectToXml);

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

CurvePropertyType xbCurveMember = xbMultiCurve.addNewCurveMember();
  xbCurveMember.addNewAbstractCurve().set(xbLineString);
  XmlHelper.substituteElement(xbCurveMember.getAbstractCurve(), xbLineString);
  GeometryPropertyType xbGeometryProperty = GeometryPropertyType.Factory.newInstance(getXmlOptions());
  xbGeometryProperty.addNewAbstractGeometry().set(xbMultiCurve);
  XmlHelper.substituteElement(xbGeometryProperty.getAbstractGeometry(), xbMultiCurve);
  return xbGeometryProperty;
} else {

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com