Skip to content

Commit

Permalink
Use caching writers when writing xsd / xdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Feb 21, 2024
1 parent 447e717 commit 58ef19c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -56,9 +57,9 @@
import org.codehaus.modello.plugins.xml.metadata.XmlFieldMetadata;
import org.codehaus.modello.plugins.xml.metadata.XmlModelMetadata;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.io.CachingWriter;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.codehaus.plexus.util.xml.XMLWriter;
import org.codehaus.plexus.util.xml.XmlStreamWriter;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

Expand Down Expand Up @@ -115,7 +116,7 @@ private void generateXdoc(Properties parameters) throws IOException {
f = new File(directory, xdocFileName);
}

Writer writer = new XmlStreamWriter(f);
Writer writer = new CachingWriter(f, StandardCharsets.UTF_8);

XMLWriter w = new PrettyPrintXMLWriter(writer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
Expand All @@ -43,9 +44,9 @@
import org.codehaus.modello.plugins.xml.metadata.XmlAssociationMetadata;
import org.codehaus.modello.plugins.xml.metadata.XmlFieldMetadata;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.io.CachingWriter;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.codehaus.plexus.util.xml.XMLWriter;
import org.codehaus.plexus.util.xml.XmlStreamWriter;

/**
* @author <a href="mailto:brett@codehaus.org">Brett Porter</a>
Expand Down Expand Up @@ -93,7 +94,7 @@ private void generateXsd(Properties parameters) throws IOException, ModelloExcep
f = new File(directory, xsdFileName);
}

Writer writer = new XmlStreamWriter(f);
Writer writer = new CachingWriter(f, StandardCharsets.UTF_8);

try {
XMLWriter w = new PrettyPrintXMLWriter(writer);
Expand Down

0 comments on commit 58ef19c

Please sign in to comment.