# How can I create a custom tag in JPMML?

I'm trying to create a logistic regression model in jpmml, then write the PMML to a file. The problem I'm having, is that I can't find any way to create a custom tag, such as "shortForm" and "longForm" in the following example:

<MapValues outputColumn="longForm">
<FieldColumnPair field="gender" column="shortForm"/>
<InlineTable>
<row><shortForm>m</shortForm><longForm>male</longForm>
</row>
<row><shortForm>f</shortForm><longForm>female</longForm>
</row>
</InlineTable>
</MapValues>


Here's what I have so far:

MapValues mv = new MapValues("output")
.withFieldColumnPairs(
new FieldColumnPair( new FieldName("gender"), "shortForm" )
).withInlineTable(
new InlineTable().withRows(
new Row().with???( new ??? )
)))


In short, I am asking for an API call I can use to instantiate the "shortForm" element in the example, and attach it to the "row" object. I've been all through the API, examples, and Google/SO, and can't find a thing.

You can/should use a generic Java Architecture for XML Binding (JAXB) approach.

Simply put, call Row#withContent(Object...) with instances of org.w3c.dom.Element that represent the desired XML content.

For example:

Document document = documentBuilder.newDocument();
Element shortForm = document.createElement("shortForm");
shortForm.setTextContent("m");
Element longForm = document.createElement("longForm");
longForm.setTextContent("male");
row = row.withContent(shortForm, longForm);

• @SeanOwen - if it prints the specified output, that will be valid PMML (it's an example from the spec). That's all I'm worried about. – Dan Ahlquist Nov 13 '14 at 15:12
• Ah, row can have any content: dmg.org/v4-2-1/Taxonomy.html#xsdElement_row Let me delete/fix comments then. – Sean Owen Nov 13 '14 at 15:43