Refine search
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) { Node parent = getParent(); Element element = this.document.createElementNS(uri, qName); for (int i = 0; i < attributes.getLength(); i++) { String attrUri = attributes.getURI(i); String attrQname = attributes.getQName(i); String value = attributes.getValue(i); if (!attrQname.startsWith("xmlns")) { element.setAttributeNS(attrUri, attrQname, value); } } element = (Element) parent.appendChild(element); this.elements.add(element); }
@Override public void marshalParams(XMLStructure parent, XMLCryptoContext context) throws MarshalException { LOG.log(POILogger.DEBUG, "marshallParams(parent,context)"); DOMStructure domParent = (DOMStructure) parent; Element parentNode = (Element)domParent.getNode(); Document doc = parentNode.getOwnerDocument(); for (String sourceId : this.sourceIds) { Element el = doc.createElementNS(OO_DIGSIG_NS, "mdssi:RelationshipReference"); el.setAttributeNS(XML_NS, "xmlns:mdssi", OO_DIGSIG_NS); el.setAttribute("SourceId", sourceId); parentNode.appendChild(el); } }
public Element encode(Object object, Document document, Element value) throws Exception { FunctionName function = (FunctionName) object; value.appendChild(document.createTextNode(function.getName())); value.setAttributeNS("", "nArgs", function.getArgumentCount() + ""); return value; } }
int iconPadding, ProcessDiagramSVGGraphics2D svgGenerator) { Element gTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_G_TAG); gTag.setAttributeNS(null, "transform", "translate(" + (imageX - 8) + "," + (imageY - 6) + ")"); Element polygonTag1 = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_POLYGON_TAG); polygonTag1.setAttributeNS(null, "points", "14 8 14 22 7 15 "); polygonTag1.setAttributeNS(null, "fill", this.getFillValue()); polygonTag1.setAttributeNS(null, "stroke", this.getStrokeValue()); polygonTag1.setAttributeNS(null, "stroke-width", this.getStrokeWidth()); polygonTag1.setAttributeNS(null, "stroke-linecap", "butt"); polygonTag1.setAttributeNS(null, "stroke-linejoin", "miter"); polygonTag1.setAttributeNS(null,
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) { Node parent = getParent(); Element element = this.document.createElementNS(uri, qName); for (int i = 0; i < attributes.getLength(); i++) { String attrUri = attributes.getURI(i); String attrQname = attributes.getQName(i); String value = attributes.getValue(i); if (!attrQname.startsWith("xmlns")) { element.setAttributeNS(attrUri, attrQname, value); } } element = (Element) parent.appendChild(element); this.elements.add(element); }
static Element functionName(Document document, Node parent, String name, int nargs) { Element function = element(document, parent, new QName(OGC.NAMESPACE, "FunctionName")); function.setAttributeNS("", "nArgs", nargs + ""); function.appendChild(document.createTextNode(name)); return function; }
int iconPadding, ProcessDiagramSVGGraphics2D svgGenerator) { Element gTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_G_TAG); gTag.setAttributeNS(null, "transform", "translate(" + (imageX - 8) + "," + (imageY - 6) + ")"); Element polygonTag1 = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_POLYGON_TAG); polygonTag1.setAttributeNS(null, "points", "14 8 14 22 7 15 "); polygonTag1.setAttributeNS(null, "fill", this.getFillValue()); polygonTag1.setAttributeNS(null, "stroke", this.getStrokeValue()); polygonTag1.setAttributeNS(null, "stroke-width", this.getStrokeWidth()); polygonTag1.setAttributeNS(null, "stroke-linecap", "butt"); polygonTag1.setAttributeNS(null, "stroke-linejoin", "miter"); polygonTag1.setAttributeNS(null,
/** * Method createDSctx * * @param doc * @param prefix * @param namespace * @return the element. */ public static Element createDSctx(Document doc, String prefix, String namespace) { if (prefix == null || prefix.trim().length() == 0) { throw new IllegalArgumentException("You must supply a prefix"); } Element ctx = doc.createElementNS(null, "namespaceContext"); ctx.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix.trim(), namespace); return ctx; }
static Element functionName(Document document, Node parent, String name, int nargs) { Element function = element(document, parent, new QName(OGC.NAMESPACE, "Function_Name")); function.setAttributeNS("", "nArgs", nargs + ""); function.appendChild(document.createTextNode(name)); return function; }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); Element newEl = getInstance().getMetadata().createElementNS(uri, qName); for (int i = 0; i < attributes.getLength(); i++) { newEl.setAttributeNS( attributes.getURI(i), attributes.getQName(i), attributes.getValue(i) ); } current.appendChild(newEl); current = newEl; }
/** * This method creates an Element in a given namespace with a given localname. * It uses the {@link ElementProxy#getDefaultPrefix} method to decide whether * a particular prefix is bound to that namespace. * <BR /> * This method was refactored out of the constructor. * * @param doc * @param namespace * @param localName * @return The element created. */ public static Element createElementForFamily(Document doc, String namespace, String localName) { Element result = null; String prefix = ElementProxy.getDefaultPrefix(namespace); if (namespace == null) { result = doc.createElementNS(null, localName); } else { if (prefix == null || prefix.length() == 0) { result = doc.createElementNS(namespace, localName); result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns", namespace); } else { result = doc.createElementNS(namespace, prefix + ":" + localName); result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix, namespace); } } return result; }
for (Attribute attribute : attributes) esimple.setAttributeNS(attribute.getNamespace(), attribute.getName(), attribute.getValue()); parent.appendChild(esimple); parent.appendChild(asimple); asimple.appendChild(econtainer);
public void drawIcon(final int imageX, final int imageY, final int iconPadding, final ProcessDiagramSVGGraphics2D svgGenerator) { Element gTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_G_TAG); gTag.setAttributeNS(null, "transform", "translate(" + (imageX - 7) + "," + (imageY - 7) + ")"); Element pathTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_PATH_TAG); pathTag.setAttributeNS(null, "d", this.getDValue()); pathTag.setAttributeNS(null, "style", this.getStyleValue()); pathTag.setAttributeNS(null, "fill", this.getFillValue()); pathTag.setAttributeNS(null, "stroke", this.getStrokeValue()); gTag.appendChild(pathTag); svgGenerator.getExtendDOMGroupManager().addElement(gTag); }
protected Element createElementForFamilyLocal( String namespace, String localName ) { Document doc = getDocument(); Element result = null; if (namespace == null) { result = doc.createElementNS(null, localName); } else { String baseName = this.getBaseNamespace(); String prefix = ElementProxy.getDefaultPrefix(baseName); if (prefix == null || prefix.length() == 0) { result = doc.createElementNS(namespace, localName); result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns", namespace); } else { result = doc.createElementNS(namespace, prefix + ":" + localName); result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix, namespace); } } return result; }
//add the Category Element Category = doc.createElement("category"); Rows.appendChild(Category); if(excel.getCategory() != null){ Category.appendChild(doc.createTextNode(excel.getCategory())); } else { Category.setAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:nil", "true"); }
public void drawIcon(final int imageX, final int imageY, final int iconPadding, final ProcessDiagramSVGGraphics2D svgGenerator) { Element gTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_G_TAG); gTag.setAttributeNS(null, "transform", "translate(" + (imageX - 1) + "," + (imageY - 2) + ")"); Element pathTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_PATH_TAG); pathTag.setAttributeNS(null, "d", this.getDValue()); pathTag.setAttributeNS(null, "fill", this.getFillValue()); pathTag.setAttributeNS(null, "stroke", this.getStrokeValue()); pathTag.setAttributeNS(null, "stroke-widthh", this.getStrokeWidth()); gTag.appendChild(pathTag); svgGenerator.getExtendDOMGroupManager().addElement(gTag); }
public void startElement(String namespace, String localName, String qName, Attributes attrs) final Element tmp = (Element)_document.createElementNS(namespace, qName); tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, (String) _namespaceDecls.elementAt(i)); tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix, (String) _namespaceDecls.elementAt(i)); tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i), attrs.getValue(i));
Element defs = doc.createElementNS(svgNS, "defs"); Element fontface = doc.createElementNS(svgNS, "font-face"); fontface.setAttributeNS(null, "font-family", "DroidSansRegular"); Element fontfacesrc = doc.createElementNS(svgNS, "font-face-src"); Element fontfaceuri = doc.createElementNS(svgNS, "font-face-uri"); fontfaceuri.setAttributeNS(svgNS, "xlink:href", "fonts/DroidSans-webfont.svg#DroidSansRegular"); Element fontfaceformat = doc.createElementNS(svgNS, "font-face-format"); fontfaceformat.setAttributeNS(svgNS, "string", "svg"); fontfaceuri.appendChild(fontfaceformat); fontfacesrc.appendChild(fontfaceuri); fontface.appendChild(fontfacesrc); defs.appendChild(fontface); svgRoot.appendChild(defs);
public void drawIcon(final int imageX, final int imageYo, final int iconPadding, final ProcessDiagramSVGGraphics2D svgGenerator) { Element gTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_G_TAG); gTag.setAttributeNS(null, "transform", "translate(" + (imageX) + "," + (imageYo) + ")"); Element pathTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_PATH_TAG); pathTag.setAttributeNS(null, "d", this.getDValue()); pathTag.setAttributeNS(null, "fill", this.getFillValue()); pathTag.setAttributeNS(null, "stroke", this.getStrokeValue()); gTag.appendChild(pathTag); svgGenerator.getExtendDOMGroupManager().addElement(gTag); }
static class LoggingErrorListener implements ErrorListener { // See http://www.cafeconleche.org/slides/sd2003west/xmlandjava/346.html boolean strict; public LoggingErrorListener(boolean strict) { } public void warning(TransformerException exception) { log.warn(exception.getMessage(), exception); // Don't throw an exception and stop the processor // just for a warning; but do log the problem } public void error(TransformerException exception) throws TransformerException { log.error(exception.getMessage(), exception); // XSLT is not as draconian as XML. There are numerous errors // which the processor may but does not have to recover from; // e.g. multiple templates that match a node with the same // priority. If I do not want to allow that, I'd throw this // exception here. if (strict) { throw exception; }