1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.codehaus.plexus.util.xml;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.io.Reader;
24 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
25 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
26
27
28
29
30 public class Xpp3DomBuilder {
31 private static final boolean DEFAULT_TRIM = true;
32
33 public static Xpp3Dom build(Reader reader) throws XmlPullParserException, IOException {
34 return build(reader, null);
35 }
36
37
38
39
40 public static Xpp3Dom build(Reader reader, InputLocationBuilder locationBuilder)
41 throws XmlPullParserException, IOException {
42 return build(reader, DEFAULT_TRIM, locationBuilder);
43 }
44
45 public static Xpp3Dom build(InputStream is, String encoding) throws XmlPullParserException, IOException {
46 return build(is, encoding, DEFAULT_TRIM);
47 }
48
49 public static Xpp3Dom build(InputStream is, String encoding, boolean trim)
50 throws XmlPullParserException, IOException {
51 return new Xpp3Dom(org.apache.maven.internal.xml.Xpp3DomBuilder.build(is, encoding, trim));
52 }
53
54 public static Xpp3Dom build(Reader reader, boolean trim) throws XmlPullParserException, IOException {
55 return build(reader, trim, null);
56 }
57
58
59
60
61 public static Xpp3Dom build(Reader reader, boolean trim, InputLocationBuilder locationBuilder)
62 throws XmlPullParserException, IOException {
63 return new Xpp3Dom(org.apache.maven.internal.xml.Xpp3DomBuilder.build(
64 reader, trim, locationBuilder != null ? locationBuilder::toInputLocation : null));
65 }
66
67 public static Xpp3Dom build(XmlPullParser parser) throws XmlPullParserException, IOException {
68 return build(parser, DEFAULT_TRIM);
69 }
70
71 public static Xpp3Dom build(XmlPullParser parser, boolean trim) throws XmlPullParserException, IOException {
72 return build(parser, trim, null);
73 }
74
75
76
77
78 public static Xpp3Dom build(XmlPullParser parser, boolean trim, InputLocationBuilder locationBuilder)
79 throws XmlPullParserException, IOException {
80 return new Xpp3Dom(org.apache.maven.internal.xml.Xpp3DomBuilder.build(
81 parser, trim, locationBuilder != null ? locationBuilder::toInputLocation : null));
82 }
83
84
85
86
87
88
89 public interface InputLocationBuilder {
90 Object toInputLocation(XmlPullParser parser);
91 }
92 }