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"/>

Here's what I have so far:

MapValues mv = new MapValues("output")
        new FieldColumnPair( new FieldName("gender"), "shortForm" )
        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.

Thanks for your help!


1 Answer 1


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");
Element longForm = document.createElement("longForm");
row = row.withContent(shortForm, longForm);
  • $\begingroup$ @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. $\endgroup$ Nov 13, 2014 at 15:12
  • $\begingroup$ Ah, row can have any content: dmg.org/v4-2-1/Taxonomy.html#xsdElement_row Let me delete/fix comments then. $\endgroup$
    – Sean Owen
    Nov 13, 2014 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.