I build a DOM document with this Code:
private org.w3c.dom.Document createXml(WorkObject workObject, String hierarchy, String dateFormat) {
XMLBuilder2 builder = XMLBuilder2.create(hierarchy);
Map<String, Object> localVariables = workObject.getLocalVariablesMap();
builder = createXmlFromMap(localVariables, builder, dateFormat);
Properties outputProperties = new Properties();
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "no");
String xmlString = builder.asString(outputProperties);
LOG.debug("XML string: " + xmlString);
org.w3c.dom.Document xmlDoc = builder.getDocument();
LOG.debug("DOM root element: " + xmlDoc.getDocumentElement().getTagName());
return xmlDoc;
}
the builder.asString()call returns the expected XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<myVar>a value</myVar>
<docId>GEAR-b3384419-36f8-48fc-b194-c937e7afc0dd</docId>
</root>
The output of the last LOG statement is root as expected.
But when I use this code, the xmlDoc seems to be something weird...
when passing the xmlDoc to this constructor:
private org.w3c.dom.Document mXmlDoc;
public XmlMailMergeDataSet(org.w3c.dom.Document xmlDoc) {
mXmlDoc = xmlDoc;
}
When debugging in IDEA, the value of xmlDoc and mXmlDoc then is [#document: null]
Unfortunaly, I can not debug further to see what happens then since the code where the XmlMailMergeDataSet then is passed to is not open source.
Am I missing something obvious here?
No comments:
Post a Comment