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