- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.n52.svalbard.util.XmlHelper
类的一些代码示例,展示了XmlHelper
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlHelper
类的具体详情如下:
包路径:org.n52.svalbard.util.XmlHelper
类名称:XmlHelper
[英]XML utility class TODO add javadoc to public methods.
[中]XML实用程序类用于将javadoc添加到公共方法。
代码示例来源:origin: org.n52.sensorweb.sos/hibernate-common
private String checkXml(String xml)
throws DecodingException {
XmlHelper.parseXmlString(xml);
if (xml.startsWith("<?xml")) {
return xml.substring(xml.indexOf(">") + 1);
}
return xml;
}
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
public static DecoderKey getDecoderKey(final XmlObject doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc), doc.getClass());
}
代码示例来源: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.arctic-sea/svalbard
/**
* Check if attribute or node namespace is a GML id.
*
* @param attr
* Attribure to check
* @param nodeNamespace
* Node namespace
* @return <code>true</code>, if attribute or node is a GML id
*/
private static boolean checkAttributeForGmlId(Attr attr, String nodeNamespace) {
final String attrNamespace = attr.getNamespaceURI();
if (GmlConstants.GML_ID_WITH_PREFIX.equals(attr.getName())) {
return true;
} else {
if (!Strings.isNullOrEmpty(attrNamespace)) {
return isNotNullAndEqualsNSs(attrNamespace, getGmlNSs());
} else {
return isNotNullAndEqualsNSs(nodeNamespace, getGmlNSs());
}
}
}
代码示例来源:origin: org.n52.svalbard/svalbard
final Attr attr = (Attr) attributes.item(i);
if (attr.getLocalName().equals(GmlConstants.AN_ID)) {
if (checkAttributeForGmlId(attr, nodeNamespace)) {
if (oldGmlID == null) {
oldGmlID = attr.getValue();
if (children != null) {
for (int i = 0, len = children.getLength(); i < len; i++) {
updateGmlIDs(children.item(i), gmlID, oldGmlID);
代码示例来源:origin: org.n52.arctic-sea/svalbard
/**
* @param doc the XML document to validate.
* @return <code>true</code> if the given xml document is valid, else an exception is thrown.
* @throws DecodingException thrown if the given xml document is invalid.
*/
public static boolean validateDocument(XmlObject doc) throws DecodingException {
validateDocument(doc, DecodingException::new);
return true;
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
try {
XmlObject feature = XmlObject.Factory.parse(sampFeat.getXml());
if (XmlHelper.getNamespace(feature).equals(WaterMLConstants.NS_WML_20)) {
if (feature instanceof MonitoringPointDocument) {
monitoringPointDoc = (MonitoringPointDocument) feature;
monitoringPointDoc.setSFSpatialSamplingFeature((MonitoringPointType) feature);
XmlHelper.updateGmlIDs(monitoringPointDoc.getDomNode(), absFeature.getGmlId(), null);
return monitoringPointDoc;
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
protected XmlObject substitute(XmlObject elementToSubstitute, XmlObject substitutionElement) {
XmlObject substituteElement = XmlHelper.substituteElement(elementToSubstitute, substitutionElement);
substituteElement.set(substitutionElement);
return substituteElement;
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
@Override
public XmlObject encode(final Object response, final EncodingContext additionalValues) throws EncodingException {
XmlObject encodedObject = null;
if (response instanceof AbstractSensorML) {
encodedObject = createSensorDescription((AbstractSensorML) response);
// }
// FIXME workaround? if of type UnknowProcedureType try to parse the
// description string, UNIT is missing "NOT_DEFINED"?!
// else if (response instanceof SosProcedureDescriptionUnknownType)
// {
// final String procDescXMLString = ((SosProcedureDescription)
// response).getXml();
// final AbstractSensorML sensorDesc = new AbstractSensorML();
// sensorDesc.setXml(procDescXMLString);
// encodedObject = createSensorDescriptionFromString(sensorDesc);
} else {
throw new UnsupportedEncoderInputException(this, response);
}
// check if all gml:id are unique
XmlHelper.makeGmlIdsUnique(encodedObject.getDomNode());
XmlHelper.validateDocument(encodedObject, EncodingException::new);
return encodedObject;
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
try {
final XmlObject feature = XmlObject.Factory.parse(sampFeat.getXml(), getXmlOptions());
if (XmlHelper.getNamespace(feature).equals(SfConstants.NS_SAMS)) {
XmlHelper.updateGmlIDs(feature.getDomNode().getFirstChild(), absFeature.getGmlId(), null);
if (feature instanceof SFSpatialSamplingFeatureType) {
xbSampFeatDoc.setSFSpatialSamplingFeature((SFSpatialSamplingFeatureType) feature);
return feature;
} else {
return encodeObjectToXml(XmlHelper.getNamespace(feature), absFeature);
代码示例来源:origin: org.n52.svalbard/svalbard
/**
* Recurse through a node and its children and make all gml:ids unique
*
* @param node
* The root node
*/
public static void makeGmlIdsUnique(final Node node) {
makeGmlIdsUnique(node, new HashMap<>());
}
代码示例来源:origin: org.n52.svalbard/svalbard
Attr attr = (Attr) attributes.item(i);
if (attr.getLocalName().equals(GmlConstants.AN_ID)) {
if (checkAttributeForGmlId(attr, nodeNamespace)) {
final String gmlId = attr.getValue();
if (foundIds.containsKey(gmlId)) {
if (children != null) {
for (int i = 0, len = children.getLength(); i < len; i++) {
makeGmlIdsUnique(children.item(i), foundIds);
代码示例来源:origin: org.n52.svalbard/svalbard
public static void fixNamespaceForXsiType(final XmlObject object, final QName value) {
final XmlCursor cursor = object.newCursor();
while (cursor.hasNextToken()) {
if (cursor.toNextToken().isStart()) {
final String xsiType = cursor.getAttributeText(W3CConstants.QN_XSI_TYPE);
if (xsiType != null) {
final String[] toks = xsiType.split(":");
String localName;
if (toks.length > 1) {
localName = toks[1];
} else {
localName = toks[0];
}
if (localName.equals(value.getLocalPart())) {
cursor.setAttributeText(W3CConstants.QN_XSI_TYPE,
Joiner.on(":").join(XmlHelper.getPrefixForNamespace(object, value.getNamespaceURI()),
value.getLocalPart()));
}
}
}
}
cursor.dispose();
}
代码示例来源:origin: org.n52.series-api/proxy-dao
try {
abstractFeature = XmlObject.Factory.parse(
XmlHelper.getNodeFromNodeList(sampledFeature.getDomNode().getChildNodes()));
} catch (XmlException xmle) {
throw new DecodingException("Error while parsing feature request!", xmle);
代码示例来源:origin: org.n52.svalbard/svalbard
public static boolean validateDocument(XmlObject doc) throws DecodingException {
validateDocument(doc, DecodingException::new);
return true;
}
代码示例来源: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
@Override
public XmlObject encode(Object objectToEncode, EncodingContext additionalValues) throws EncodingException {
XmlObject encodedObject = null;
try {
if (objectToEncode instanceof AbstractSensorML) {
AbstractSensorML description = (AbstractSensorML) objectToEncode;
if (description.isSetXml()) {
encodedObject = XmlObject.Factory.parse(((AbstractSensorML) objectToEncode).getXml());
addValuesToXmlObject(encodedObject, (AbstractSensorML) objectToEncode);
encodedObject = checkForAdditionalValues(encodedObject, additionalValues);
} else {
encodedObject = encodeDescription(description, additionalValues);
}
} else {
throw new UnsupportedEncoderInputException(this, objectToEncode);
}
} catch (XmlException xmle) {
throw new EncodingException(xmle);
}
// check if all gml:id are unique
XmlHelper.makeGmlIdsUnique(encodedObject.getDomNode());
XmlHelper.validateDocument(encodedObject, EncodingException::new);
return encodedObject;
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
try {
final XmlObject feature = XmlObject.Factory.parse(specimen.getXml(), getXmlOptions());
XmlHelper.updateGmlIDs(feature.getDomNode().getFirstChild(), specimen.getGmlId(), null);
if (XmlHelper.getNamespace(feature).equals(SfConstants.NS_SPEC) && feature instanceof SFSpecimenType) {
sfsd.setSFSpecimen((SFSpecimenType) feature);
addName(sfsd.getSFSpecimen(), specimen);
代码示例来源:origin: org.n52.arctic-sea/svalbard
/**
* Recurse through a node and its children and make all gml:ids unique
*
* @param node
* The root node
*/
public static void makeGmlIdsUnique(final Node node) {
makeGmlIdsUnique(node, new HashMap<>());
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
final Attr attr = (Attr) attributes.item(i);
if (attr.getLocalName().equals(GmlConstants.AN_ID)) {
if (checkAttributeForGmlId(attr, nodeNamespace)) {
if (oldGmlID == null) {
oldGmlID = attr.getValue();
if (children != null) {
for (int i = 0, len = children.getLength(); i < len; i++) {
updateGmlIDs(children.item(i), gmlID, oldGmlID);
本文整理了Java中org.n52.svalbard.util.XmlHelper类的一些代码示例,展示了XmlHelper类的具体用法。这些代码示例主要来源于Github/Stackoverflow
本文整理了Java中org.n52.svalbard.decode.XmlNamespaceDecoderKey类的一些代码示例,展示了XmlNamespaceDecoderKey类的具体用法。这些代
本文整理了Java中org.n52.svalbard.util.XmlHelper.getNamespace()方法的一些代码示例,展示了XmlHelper.getNamespace()的具体用法。这
本文整理了Java中org.n52.svalbard.util.XmlHelper.makeGmlIdsUnique()方法的一些代码示例,展示了XmlHelper.makeGmlIdsUnique(
本文整理了Java中org.n52.svalbard.util.XmlHelper.validateDocument()方法的一些代码示例,展示了XmlHelper.validateDocument(
本文整理了Java中org.n52.svalbard.util.XmlHelper.getPrefixForNamespace()方法的一些代码示例,展示了XmlHelper.getPrefixFor
本文整理了Java中org.n52.svalbard.util.XmlHelper.isNotNullAndEqualsNSs()方法的一些代码示例,展示了XmlHelper.isNotNullAnd
本文整理了Java中org.n52.svalbard.util.XmlHelper.parseXmlString()方法的一些代码示例,展示了XmlHelper.parseXmlString()的具体
本文整理了Java中org.n52.svalbard.util.XmlHelper.getGmlNSs()方法的一些代码示例,展示了XmlHelper.getGmlNSs()的具体用法。这些代码示例主
本文整理了Java中org.n52.svalbard.util.XmlHelper.checkAttributeForGmlId()方法的一些代码示例,展示了XmlHelper.checkAttrib
本文整理了Java中org.n52.svalbard.util.XmlHelper.updateGmlIDs()方法的一些代码示例,展示了XmlHelper.updateGmlIDs()的具体用法。这
本文整理了Java中org.n52.svalbard.util.XmlHelper.substituteElement()方法的一些代码示例,展示了XmlHelper.substituteElemen
本文整理了Java中org.n52.svalbard.decode.XmlNamespaceDecoderKey.getType()方法的一些代码示例,展示了XmlNamespaceDecoderKe
本文整理了Java中org.n52.svalbard.decode.XmlNamespaceDecoderKey.()方法的一些代码示例,展示了XmlNamespaceDecoderKey.()的具体
本文整理了Java中org.n52.svalbard.decode.XmlNamespaceDecoderKey.getNamespace()方法的一些代码示例,展示了XmlNamespaceDeco
本文整理了Java中org.n52.svalbard.decode.XmlNamespaceDecoderKey.getSimilarity()方法的一些代码示例,展示了XmlNamespaceDec
我是一名优秀的程序员,十分优秀!