public static void write( XMLWriter xmlWriter, Xpp3Dom dom, boolean escape ) { // TODO: move to XMLWriter? xmlWriter.startElement( dom.getName() ); String[] attributeNames = dom.getAttributeNames(); for ( String attributeName : attributeNames ) { xmlWriter.addAttribute( attributeName, dom.getAttribute( attributeName ) ); } Xpp3Dom[] children = dom.getChildren(); for ( Xpp3Dom aChildren : children ) { write( xmlWriter, aChildren, escape ); } String value = dom.getValue(); if ( value != null ) { if ( escape ) { xmlWriter.writeText( value ); } else { xmlWriter.writeMarkup( value ); } } xmlWriter.endElement(); }
private static void writeValueStrategy( String valueStrategy, XMLWriter writer ) throws ModelloException { if ( !"off".equals( valueStrategy ) ) { if ( !VALUE_STRATEGY_LIST.contains( valueStrategy ) ) { throw new ModelloException( "The JDO mapping generator does not support the specified " + "value-strategy '" + valueStrategy + "'. " + "Supported types: " + VALUE_STRATEGY_LIST ); } writer.addAttribute( "value-strategy", valueStrategy ); } }
private XMLWriter initializeRootElement(Writer w, String schemaVersion, String workflowName) { XMLWriter writer = initializeXmlWriter(w, null); writer.startElement(WORKFLOW_ELEMENT); writer.addAttribute("xmlns", "uri:oozie:workflow:" + schemaVersion); writer.addAttribute("name", workflowName); return writer; }
protected static void writeAttribute( XMLWriter writer, String key, boolean value ) { writer.startElement( "booleanAttribute" ); writer.addAttribute( "key", key ); writer.addAttribute( "value", "" + value ); writer.endElement(); }
protected static void writeAttribute( XMLWriter writer, String key, String value ) { writer.startElement( "stringAttribute" ); writer.addAttribute( "key", key ); writer.addAttribute( "value", value ); writer.endElement(); }
private static void writeValueStrategy( String valueStrategy, XMLWriter writer ) throws ModelloException { if ( !"off".equals( valueStrategy ) ) { if ( !VALUE_STRATEGY_LIST.contains( valueStrategy ) ) { throw new ModelloException( "The JDO mapping generator does not support the specified " + "value-strategy '" + valueStrategy + "'. " + "Supported types: " + VALUE_STRATEGY_LIST ); } writer.addAttribute( "value-strategy", valueStrategy ); } }
/** * @param writer */ protected void writeContextRoot( XMLWriter writer ) { writer.startElement( ELT_PROPERTY ); writer.addAttribute( ATTR_NAME, ATTR_CONTEXT_ROOT ); writer.addAttribute( ATTR_VALUE, config.getContextName() ); writer.endElement(); // property }
/** * @param writer */ private void writeClasspathContainers(XMLWriter writer) { // ---------------------------------------------------------------------- // Container classpath entries // ---------------------------------------------------------------------- for (Object o : config.getClasspathContainers()) { writer.startElement(ELT_CLASSPATHENTRY); writer.addAttribute(ATTR_KIND, "con"); //$NON-NLS-1$ writer.addAttribute(ATTR_PATH, (String) o); writer.endElement(); // name } }
private static void writePropertiesElement( XMLWriter w ) { w.startElement( "xs:complexType" ); w.startElement( "xs:sequence" ); w.startElement( "xs:any" ); w.addAttribute( "minOccurs", "0" ); w.addAttribute( "maxOccurs", "unbounded" ); w.addAttribute( "processContents", "skip" ); w.endElement(); w.endElement(); w.endElement(); }
private void writeAttributes(PlexusConfiguration c, XMLWriter w) throws IOException { String[] names = c.getAttributeNames(); for (int i = 0; i < names.length; i++) { w.addAttribute(names[i], c.getAttribute(names[i], null)); } }
private void appendEnd(XMLWriter writer) { writer.startElement("end"); writer.addAttribute("name", "end"); writer.endElement(); }
private void appendStart(XMLWriter writer) { writer.startElement("start"); writer.addAttribute("to", "java-node"); writer.endElement(); }
private void doWriteElement(XMLWriter writer, String element, String attributeName, String attributeValue) { writer.startElement(element); writer.addAttribute(attributeName, attributeValue); writer.endElement(); }
private void writeAttributes( PlexusConfiguration c, XMLWriter w ) throws IOException { String[] names = c.getAttributeNames(); for ( String name : names ) { w.addAttribute( name, c.getAttribute( name, null ) ); } }
protected static void writeAttribute( XMLWriter writer, String key, String[] values ) { writer.startElement( "listAttribute" ); writer.addAttribute( "key", key ); for (String value : values) { writer.startElement("listEntry"); writer.addAttribute("value", value); writer.endElement(); } writer.endElement(); }
/** * Writes facet <code>fixed</code> element with attribute <code>facet</code> set to the value of argument * <code>facetName</code>. * * @param writer * @param facetName */ private void writeFacetFixedElement( XMLWriter writer, String facetName ) { writer.startElement( ELT_FIXED ); writer.addAttribute( ATTR_FACET, facetName ); writer.endElement(); }
private static void writeCharElement( XMLWriter w ) { // a char, described as a simpleType base on string with a length restriction to 1 w.startElement( "xs:simpleType" ); w.startElement( "xs:restriction" ); w.addAttribute( "base", "xs:string" ); w.startElement( "xs:length" ); w.addAttribute( "value", "1" ); w.addAttribute( "fixed", "true" ); w.endElement(); w.endElement(); w.endElement(); }
private void appendKill(XMLWriter writer) { writer.startElement("kill"); writer.addAttribute("name", "fail"); doWriteElement(writer, "message", "Java failed, error message[${wf:errorMessage(wf:lastErrorNode())}]"); writer.endElement(); }
/** * @param writer */ protected void writeContextRoot( XMLWriter writer ) { writer.startElement( ELT_PROPERTY ); writer.addAttribute( ATTR_CONTEXT_ROOT, config.getContextName() ); writer.endElement(); // property }
/** * write the website-config file. * * @param writer wher to write to */ private void writeModuleTypeFacetCore( XMLWriter writer ) { writer.startElement( WEBSITE_CONFIG_WEBSITE ); writer.addAttribute( WEBSITE_CONFIG_VERSION, "600" ); writer.startElement( WEBSITE_CONFIG_STRUCTURE ); writer.endElement(); writer.endElement(); } }