/** * Set direction of this message in the exchange. * * @param theDirection Direction of this message in the exchange */ public void setDirection(Direction theDirection) { XmlCursor cursor = getBean().newCursor(); QName name = cursor.getName(); QName newName = new QName(name.getNamespaceURI(), theDirection == Direction.IN ? INFAULT : OUTFAULT); cursor.setName(newName); cursor.dispose(); }
/** * Set direction of this message in the exchange. * * @param theDirection Direction of this message in the exchange */ public void setDirection(Direction theDirection) { XmlCursor cursor = getBean().newCursor(); QName name = cursor.getName(); QName newName = new QName(name.getNamespaceURI(), theDirection == Direction.IN ? INFAULT : OUTFAULT); cursor.setName(newName); cursor.dispose(); }
/** * Set direction of this message in the exchange. * <p> * Direction is encoded in name of the XML element representing this component. * * @param theDirection Direction of this message in the exchange */ public void setDirection(Direction theDirection) { XmlCursor cursor = getBean().newCursor(); QName name = cursor.getName(); QName newName = new QName(name.getNamespaceURI(), theDirection == Direction.IN ? INPUT : OUTPUT); cursor.setName(newName); cursor.dispose(); }
/** * Set direction of this message in the exchange. The direction property * of a message reference (fault or normal) is inferred from the name * of the XML element containing it. This means that we have to drill into * the actual XML to rename the <input/output> element appropriately. * This is accomplished in XmlBeans using the so-called XmlCursor. * * @param theDirection Direction of this message in the exchange */ public void setDirection(Direction theDirection) { XmlCursor cursor = getBean().newCursor(); QName name = cursor.getName(); QName newName = new QName(name.getNamespaceURI(), theDirection == Direction.IN ? INPUT : OUTPUT); cursor.setName(newName); cursor.dispose(); }
public void convertElement(XmlCursor cursor, XmlCursor end) { end.toCursor(cursor); end.toEndToken(); while (cursor.hasNextToken() && cursor.isLeftOf(end)) { if (cursor.isStart()) { String localPart = cursor.getName().getLocalPart(); cursor.setName(new QName(CLUSTERING_WADI_NS, localPart)); if (localPart.equals(CLUSTER_ELEMENT_NAME) || localPart.equals(BACKING_STRATEGY_FACTORY_ELEMENT_NAME)) { convertChildrenToNamingNS(cursor); cursor.toEndToken(); } } cursor.toNextToken(); } }
private void renameContentsElementNames(final Contents xbContents) { for (final Offering offering : xbContents.getContents().getOfferingArray()) { final XmlCursor cursor = offering.getAbstractOffering().newCursor(); cursor.setName(Sos2Constants.QN_OBSERVATION_OFFERING); cursor.removeAttribute(W3CConstants.QN_XSI_TYPE); if (cursor.toChild(Sos2Constants.QN_SOS_OBSERVED_AREA)) { cursor.setName(Sos2Constants.QN_SOS_OBSERVED_AREA); cursor.toParent(); cursor.setName(Sos2Constants.QN_SOS_PHENOMENON_TIME); cursor.toParent(); cursor.setName(Sos2Constants.QN_SOS_RESULT_TIME); cursor.toParent(); cursor.setName(Sos2Constants.QN_SOS_RESPONSE_FORMAT); while (cursor.toNextSibling(Sos2Constants.QN_SOS_RESPONSE_FORMAT)) { cursor.setName(Sos2Constants.QN_SOS_RESPONSE_FORMAT); cursor.setName(Sos2Constants.QN_SOS_OBSERVATION_TYPE); while (cursor.toNextSibling(Sos2Constants.QN_SOS_OBSERVATION_TYPE)) { cursor.setName(Sos2Constants.QN_SOS_OBSERVATION_TYPE); cursor.setName(Sos2Constants.QN_SOS_FEATURE_OF_INTEREST_TYPE); while (cursor.toNextSibling(Sos2Constants.QN_SOS_FEATURE_OF_INTEREST_TYPE)) { cursor.setName(Sos2Constants.QN_SOS_FEATURE_OF_INTEREST_TYPE);
protected void convertToNamingNS(XmlCursor cursor, XmlCursor end) { end.toCursor(cursor); end.toEndToken(); while (cursor.hasNextToken() && cursor.isLeftOf(end)) { if (cursor.isStart()) { String localPart = cursor.getName().getLocalPart(); cursor.setName(new QName(NAMING_NS, localPart)); } cursor.toNextToken(); } }
/** * * @param name */ void setLocalName(String localName) { XmlCursor cursor = newCursor(); try { if(cursor.isStartdoc()) cursor.toFirstContentToken(); if(cursor.isText() || cursor.isComment()) return; javax.xml.namespace.QName qname = cursor.getName(); cursor.setName(new javax.xml.namespace.QName( qname.getNamespaceURI(), localName, qname.getPrefix())); } finally { cursor.dispose(); } }
cursor.setName(newInstance); QName qName = new QName("http://www.w3.org/2001/XMLSchema-instance", "type"); cursor.removeAttribute(qName);
boolean isAFC = cursor.toChild(new QName(GmlConstants.NS_GML, GmlConstants.EN_ABSTRACT_FEATURE_COLLECTION)); if (isAFC) { cursor.setName(new QName(GmlConstants.NS_GML, GmlConstants.EN_FEATURE_COLLECTION));
/** * * @param name */ void setName(QName qname) { XmlCursor cursor = newCursor(); try { if(cursor.isStartdoc()) cursor.toFirstContentToken(); if(cursor.isText() || cursor.isComment()) return; if(cursor.isProcinst()) { String localName = qname.localName(); cursor.setName(new javax.xml.namespace.QName(localName)); } else { String prefix = qname.prefix(); if (prefix == null) { prefix = ""; } cursor.setName(new javax.xml.namespace.QName( qname.uri(), qname.localName(), prefix)); } } finally { cursor.dispose(); } }
boolean isAFC = cursor.toChild(new QName(GmlConstants.NS_GML, GmlConstants.EN_ABSTRACT_FEATURE_COLLECTION)); if (isAFC) { cursor.setName(new QName(GmlConstants.NS_GML, GmlConstants.EN_FEATURE_COLLECTION));
private XmlObject createTimeGeometricPrimitivePropertyType(TimePeriod timePeriod) throws EncodingException { TimeGeometricPrimitivePropertyType xbTimeGeometricPrimitiveProperty = TimeGeometricPrimitivePropertyType.Factory.newInstance(getXmlOptions()); if (timePeriod.isSetStart() && timePeriod.isSetEnd()) { xbTimeGeometricPrimitiveProperty.addNewTimeGeometricPrimitive() .set(encodeObjectToXml(GmlConstants.NS_GML, timePeriod)); } // TODO check GML 311 rename nodename of geometric primitive to // gml:timePeriod XmlCursor timeCursor = xbTimeGeometricPrimitiveProperty.newCursor(); boolean hasTimePrimitive = timeCursor.toChild(new QName(GmlConstants.NS_GML, GmlConstants.EN_ABSTRACT_TIME_GEOM_PRIM)); if (hasTimePrimitive) { timeCursor.setName(new QName(GmlConstants.NS_GML, GmlConstants.EN_TIME_PERIOD)); } timeCursor.dispose(); return xbTimeGeometricPrimitiveProperty; }
private XmlObject createTimeGeometricPrimitivePropertyType(final TimePeriod timePeriod) throws OwsExceptionReport { final TimeGeometricPrimitivePropertyType xbTimeGeometricPrimitiveProperty = TimeGeometricPrimitivePropertyType.Factory.newInstance(XmlOptionsHelper.getInstance().getXmlOptions()); if (timePeriod.isSetStart() && timePeriod.isSetEnd()) { xbTimeGeometricPrimitiveProperty.addNewTimeGeometricPrimitive() .set(CodingHelper.encodeObjectToXml(GmlConstants.NS_GML, timePeriod)); } // TODO check GML 311 rename nodename of geometric primitive to // gml:timePeriod final XmlCursor timeCursor = xbTimeGeometricPrimitiveProperty.newCursor(); final boolean hasTimePrimitive = timeCursor.toChild(new QName(GmlConstants.NS_GML, GmlConstants.EN_ABSTRACT_TIME_GEOM_PRIM)); if (hasTimePrimitive) { timeCursor.setName(new QName(GmlConstants.NS_GML, GmlConstants.EN_TIME_PERIOD)); } timeCursor.dispose(); return xbTimeGeometricPrimitiveProperty; }
protected void changeNS (String oldURI, String newURI) { XmlCursor curs = newCursor(); while (curs.toParent()) { /* Goto the top of the document */ } TokenType tt = curs.currentTokenType(); if (tt.isStartdoc()) { tt = curs.toFirstContentToken(); } if (tt.isStart()) { do { if (tt.isStart() || tt.isAttr() || tt.isNamespace()) { javax.xml.namespace.QName currQName = curs.getName(); if (oldURI.equals(currQName.getNamespaceURI())) { curs.setName(new javax.xml.namespace.QName(newURI, currQName.getLocalPart())); } } tt = curs.toNextToken(); } while (!tt.isEnddoc() && !tt.isNone()); } curs.dispose(); }
/** * * @param ns */ void setNamespace(Namespace ns) { XmlCursor cursor = newCursor(); try { if(cursor.isStartdoc()) cursor.toFirstContentToken(); if(cursor.isText() || cursor.isComment() || cursor.isProcinst()) return; String prefix = ns.prefix(); if (prefix == null) { prefix = ""; } cursor.setName(new javax.xml.namespace.QName( ns.uri(), localName(), prefix)); } finally { cursor.dispose(); } }