private List<CTPicture> getCTPictures(XmlObject o) { List<CTPicture> pics = new ArrayList<>(); XmlObject[] picts = o.selectPath("declare namespace pic='" + CTPicture.type.getName().getNamespaceURI() + "' .//pic:pic"); for (XmlObject pict : picts) { if (pict instanceof XmlAnyTypeImpl) { // Pesky XmlBeans bug - see Bugzilla #49934 try { pict = CTPicture.Factory.parse(pict.toString(), DEFAULT_XML_OPTIONS); } catch (XmlException e) { throw new POIXMLException(e); } } if (pict instanceof CTPicture) { pics.add((CTPicture) pict); } } return pics; }
public void deliverMessage(String topic, NotificationType notificationType, XmlObject messageObj) { System.out.println("Received a notification of type[" + notificationType + "] for the topic[" + topic); System.out.println("The notification message is:"); System.out.println(messageObj.toString()); }
public static String documentToString(Document doc) throws XmlException { XmlObject xmlObj = XmlObject.Factory.parse(doc); return xmlObj.toString(); } }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SubscribeOptions other = (SubscribeOptions) obj; return Objects.equal(this.publicationIdentifier, other.publicationIdentifier) && Objects.equal(this.terminationTime, other.terminationTime) && Objects.equal(this.filter != null ? this.filter.toString() : null, other.filter != null ? other.filter.toString() : null) && Objects.equal(this.filterLanguageId, other.filterLanguageId) && Objects.equal(this.deliveryDefinition, other.deliveryDefinition) && Objects.equal(this.deliveryParameters, other.deliveryParameters) && Objects.equal(this.contentType, other.contentType); }
public void deliverMessage(String topic, NotificationType notificationType, XmlObject messageObj) { System.out.println("Received a notification of type[" + notificationType + "] for the topic[" + topic); System.out.println("The notification message is:"); System.out.println(messageObj.toString()); if (subscription != null && Listener.finalNotification.equals(messageObj.toString())) { try { subscription.destroy(); } catch (RemoteException e) { e.printStackTrace(); } System.out.println("Ending the subscription and exiting"); System.exit(0); } }
public int notify(XmlObject notification) { return notify(notification.toString()); }
public XmlObject getRegisterDocument() { StringBuilder sb = new StringBuilder(); try ( InputStream in = getClass().getResourceAsStream("template_registerpublisher.xml"); BufferedReader br = new BufferedReader(new InputStreamReader(in, DEFAULT_ENCODING)); ) { while (br.ready()) { sb.append(br.readLine()); } } catch (IOException e) { LOG.warn(e.getMessage(), e); } try { document = XmlObject.Factory.parse( sb.toString().replace("${sensorml}", sensorML.toString()). replace("${topic}", "default")); } catch (XmlException e) { LOG.warn(e.getMessage(), e); } return this.document; }
private List<CTPicture> getCTPictures(XmlObject o) { List<CTPicture> pics = new ArrayList<>(); XmlObject[] picts = o.selectPath("declare namespace pic='" + CTPicture.type.getName().getNamespaceURI() + "' .//pic:pic"); for (XmlObject pict : picts) { if (pict instanceof XmlAnyTypeImpl) { // Pesky XmlBeans bug - see Bugzilla #49934 try { pict = CTPicture.Factory.parse(pict.toString(), DEFAULT_XML_OPTIONS); } catch (XmlException e) { throw new POIXMLException(e); } } if (pict instanceof CTPicture) { pics.add((CTPicture) pict); } } return pics; }
private List<CTPicture> getCTPictures(XmlObject o) { List<CTPicture> pictures = new ArrayList<CTPicture>(); XmlObject[] picts = o.selectPath("declare namespace pic='"+CTPicture.type.getName().getNamespaceURI()+"' .//pic:pic"); for(XmlObject pict : picts) { if(pict instanceof XmlAnyTypeImpl) { // Pesky XmlBeans bug - see Bugzilla #49934 try { pict = CTPicture.Factory.parse( pict.toString() ); } catch(XmlException e) { throw new POIXMLException(e); } } if(pict instanceof CTPicture) { pictures.add((CTPicture)pict); } } return pictures; }
@Override public boolean isApplicable(InputType input) { if(input.getReference().isSetBody()) { XmlObject xo = input.getReference().getBody(); return xo.toString().contains("http://www.opengis.net/wcs/1.1.1"); }else{ String dataURLString = input.getReference().getHref(); return (dataURLString.contains("=GetCoverage") && dataURLString.contains("=1.1.1")); } }
private void read(InputStream is) throws Exception { XmlObject obj = XmlObject.Factory.parse(is); for (XmlObject def : obj.selectPath("*/*")) { String name = def.getDomNode().getLocalName(); CTCustomGeometry2D geom = CTCustomGeometry2D.Factory.parse(def.toString()); if(containsKey(name)) { System.out.println("Duplicate definoition of " + name) ; } put(name, new CustomGeometry(geom)); } }
/** * Escapes the reserved characters in a value of an attribute * * @param value Unescaped text * @return The escaped text */ public String escapeAttributeValue(Object value) { String text = ScriptRuntime.toString(value); if (text.length() == 0) return ""; XmlObject xo = XmlObject.Factory.newInstance(); XmlCursor cursor = xo.newCursor(); cursor.toNextToken(); cursor.beginElement("a"); cursor.insertAttributeWithValue("a", text); cursor.dispose(); String elementText = xo.toString(); int begin = elementText.indexOf('"'); int end = elementText.lastIndexOf('"'); return elementText.substring(begin + 1, end); }
/** * Escapes the reserved characters in a value of a text node * * @param value Unescaped text * @return The escaped text */ public String escapeTextValue(Object value) { if (value instanceof XMLObjectImpl) { return ((XMLObjectImpl)value).toXMLString(0); } String text = ScriptRuntime.toString(value); if (text.length() == 0) return text; XmlObject xo = XmlObject.Factory.newInstance(); XmlCursor cursor = xo.newCursor(); cursor.toNextToken(); cursor.beginElement("a"); cursor.insertChars(text); cursor.dispose(); String elementText = xo.toString(); int begin = elementText.indexOf('>') + 1; int end = elementText.lastIndexOf('<'); return (begin < end) ? elementText.substring(begin, end) : ""; }
/*package*/ XSLFTable(CTGraphicalObjectFrame shape, XSLFSheet sheet){ super(shape, sheet); XmlObject[] rs = shape.getGraphic().getGraphicData() .selectPath("declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' ./a:tbl"); if (rs.length == 0) { throw new IllegalStateException("a:tbl element was not found in\n " + shape.getGraphic().getGraphicData()); } // Pesky XmlBeans bug - see Bugzilla #49934 // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas if(rs[0] instanceof XmlAnyTypeImpl){ try { rs[0] = CTTable.Factory.parse(rs[0].toString()); }catch (XmlException e){ throw new POIXMLException(e); } } _table = (CTTable) rs[0]; _rows = new ArrayList<XSLFTableRow>(_table.sizeOfTrArray()); for(CTTableRow row : _table.getTrList()) _rows.add(new XSLFTableRow(row, this)); }
public void unsubscribe(Subscription sub) { SESResponse resp = null; try { resp = sub.getManager().sendHttpPostRequest( sub.getUnSubscribeDocument().toString(), UNSUBSCRIBE_ACTION); } catch (Exception e) { sub.setException(e); } if (resp != null) { sub.parseResponse(resp.getResponseBody()); } }
public void destroyRegistration(Publisher pub) { SESResponse resp = null; try { resp = pub.getManager().sendHttpPostRequest( pub.getDestroyRegistrationDocument().toString(), UNSUBSCRIBE_ACTION); } catch (Exception e) { pub.setException(e); } if (resp != null) { pub.parseResponse(resp.getResponseBody()); } }
public Subscription subscribe(SubscriptionConstraints con) { Subscription sub = new Subscription(con); SESResponse resp = null; try { resp = this.brokerConnector.sendHttpPostRequest( con.getSubscriptionDocument().toString(), SUBSCRIBE_ACTION); } catch (Exception e) { sub.setException(e); } if (resp != null) { sub.parseResponse(resp.getResponseBody()); } return sub; }
public Publisher registerPublisher(XmlObject sensorML) { Publisher pub = new Publisher(sensorML); SESResponse resp = null; try { resp = this.brokerConnector.sendHttpPostRequest( pub.getRegisterDocument().toString(), REGISTER_PUBLISHER_ACTION); } catch (Exception e) { pub.setException(e); } if (resp != null) { pub.parseResponse(resp.getResponseBody()); } return pub; }
log.debug(xmldata.toString());
o = CTTable.Factory.parse(o.toString()); } catch (XmlException e) { throw new POIXMLException(e);