java-xmlbuilder icon indicating copy to clipboard operation
java-xmlbuilder copied to clipboard

Don't save correct xml

Open ogbozoyan opened this issue 1 year ago • 2 comments

Hi, java-xmlbuilder version used

<dependency>
			<groupId>com.jamesmurty.utils</groupId>
			<artifactId>java-xmlbuilder</artifactId>
			<version>1.3</version>
		</dependency>

While debugging i checked what contain my XMLBuilder2 object and throughout the process xml tree was correct, but when i'm saving in file

Properties outputProperties = new Properties();
outputProperties.put(javax.xml.transform.OutputKeys.METHOD, "xml");
outputProperties.put(javax.xml.transform.OutputKeys.INDENT, "yes");
outputProperties.put("{http://xml.apache.org/xslt}indent-amount", "2");
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
 PrintWriter writer = new PrintWriter(new FileOutputStream(entity.getId()+"test.xml"));
xmlBuilder2.toWriter(writer,outputProperties);

i got only

XMLBuilder2 xmlBuilder = XMLBuilder2.create("feed")
                .e("feed_version").t("2")
                .up();//feed_version

<feed> <feed_version>2</feed_version> </feed>

all other concatenated tags with attributes just being ignored

ogbozoyan avatar Feb 19 '23 11:02 ogbozoyan