@SuppressWarnings("WeakerAccess") protected CTGroupShape getSpTree(){ if(_spTree == null) { XmlObject root = getXmlObject(); XmlObject[] sp = root.selectPath( "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:spTree"); if(sp.length == 0) { throw new IllegalStateException("CTGroupShape was not found"); } _spTree = (CTGroupShape)sp[0]; } return _spTree; }
/** * As there's no xmlbeans hierarchy, but XSLF works with subclassing, not all * child classes work with a {@link CTShape} object, but often contain the same * properties. This method is the generalized form of selecting and casting those * properties. * * @param resultClass the requested result class * @param xquery the simple (xmlbean) xpath expression to the property * @return the xml object at the xpath location, or null if not found */ @SuppressWarnings({"unchecked", "WeakerAccess"}) protected <T extends XmlObject> T selectProperty(Class<T> resultClass, String xquery) { XmlObject[] rs = getXmlObject().selectPath(xquery); if (rs.length == 0) { return null; } return (resultClass.isInstance(rs[0])) ? (T)rs[0] : null; }
public boolean fetch(XSLFShape shape) { XmlObject[] o = shape.getXmlObject().selectPath( "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " + "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " + ".//p:txBody/a:lstStyle/a:lvl" + (_level + 1) + "pPr" ); if (o.length == 1) { CTTextParagraphProperties props = (CTTextParagraphProperties) o[0]; return fetch(props); } return false; }
public boolean fetch(XSLFShape shape) { XmlObject[] o = shape.getXmlObject().selectPath( "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " + "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " + ".//p:txBody/a:bodyPr" ); if (o.length == 1) { CTTextBodyProperties props = (CTTextBodyProperties) o[0]; return fetch(props); } return false; }
private int getRawValue(String elem) { String query = "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' $this//a:" + elem; XmlObject[] obj; // first ask the context color and if not found, ask the actual color bean if (_phClr != null){ obj = _phClr.selectPath(query); if (obj.length == 1){ Node attr = obj[0].getDomNode().getAttributes().getNamedItem("val"); if(attr != null) { return Integer.parseInt(attr.getNodeValue()); } } } obj = _xmlObject.selectPath(query); if (obj.length == 1){ Node attr = obj[0].getDomNode().getAttributes().getNamedItem("val"); if(attr != null) { return Integer.parseInt(attr.getNodeValue()); } } return -1; }
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; }
for(XmlObject obj : root.selectPath("$this/xml/*")) { Node nd = obj.getDomNode(); QName qname = new QName(nd.getNamespaceURI(), nd.getLocalName());
pictTextObjs.addAll(Arrays.asList(r.getDrawingArray())); for (XmlObject o : pictTextObjs) { XmlObject[] ts = o.selectPath("declare namespace w='http://schemas.openxmlformats.org/wordprocessingml/2006/main' .//w:t"); for (XmlObject t : ts) { NodeList kids = t.getDomNode().getChildNodes();
private Color toColor(XmlObject obj, XSLFTheme theme) { Color color = null; for (XmlObject ch : obj.selectPath("*")) { if (ch instanceof CTHslColor) { CTHslColor hsl = (CTHslColor)ch;
public XmlObject[] selectPath(String path, XmlOptions options) { return underlyingXmlObject().selectPath(path, options); }
public XmlObject[] selectPath(String path) { return underlyingXmlObject().selectPath(path); }
private static boolean wsdlContainsEncoded(XmlObject wsdldoc) { // search for any <soap:body use="encoded"/> etc. XmlObject[] useAttrs = wsdldoc.selectPath( "declare namespace soap='http://schemas.xmlsoap.org/wsdl/soap/' " + ".//soap:body/@use|.//soap:header/@use|.//soap:fault/@use"); for (int i = 0; i < useAttrs.length; i++) { if ("encoded".equals(((SimpleValue)useAttrs[i]).getStringValue())) return true; } return false; }
private static void putMappingsFromWsdl(Map result, URI source, URI target, DefinitionsDocument.Definitions wdoc) { XmlObject[] types = wdoc.getTypesArray(); for (int i = 0; i < types.length; i++) { SchemaDocument.Schema[] schemas = (SchemaDocument.Schema[])types[i].selectPath("declare namespace xs='http://www.w3.org/2001/XMLSchema' xs:schema"); for (int j = 0; j < schemas.length; j++) putMappingsFromSchema(result, source, target, schemas[j]); } TImport[] imports = wdoc.getImportArray(); for (int i = 0; i < imports.length; i++) putNewMapping(result, source, target, imports[i].getLocation()); } }
for (int j = 0; j < types.length; j++) XmlObject[] schemas = types[j].selectPath("declare namespace xs=\"http://www.w3.org/2001/XMLSchema\" xs:schema"); if (schemas.length == 0)
} else if (sh instanceof XSLFGraphicFrame) { XSLFGraphicFrame frame = (XSLFGraphicFrame) sh; XmlObject[] sp = frame.getXmlObject().selectPath( "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:oleObj"); if (sp != null) {
protected CTGroupShape getSpTree(){ if(_spTree == null) { XmlObject root = getXmlObject(); XmlObject[] sp = root.selectPath( "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:spTree"); if(sp.length == 0) throw new IllegalStateException("CTGroupShape was not found"); _spTree = (CTGroupShape)sp[0]; } return _spTree; }
public boolean fetch(XSLFShape shape) { XmlObject[] o = shape.getXmlObject().selectPath( "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " + "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " + ".//p:txBody/a:lstStyle/a:lvl" + (_level + 1) + "pPr" ); if (o.length == 1) { CTTextParagraphProperties props = (CTTextParagraphProperties) o[0]; return fetch(props); } return false; }
public boolean fetch(XSLFShape shape) { XmlObject[] o = shape.getXmlObject().selectPath( "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " + "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " + ".//p:txBody/a:bodyPr" ); if (o.length == 1) { CTTextBodyProperties props = (CTTextBodyProperties) o[0]; return fetch(props); } return false; }
public boolean fetch(XSLFSimpleShape shape) { XmlObject[] o = shape.getXmlObject().selectPath( "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " + "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " + ".//p:txBody/a:bodyPr" ); if (o.length == 1) { CTTextBodyProperties props = (CTTextBodyProperties) o[0]; return fetch(props); } return false; }
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)); } }