@@ -72,11 +72,12 @@ public class XmlSchemaParser
72
72
* Validate the document against a given schema. Error will be written to {@link java.lang.System#err}
73
73
*
74
74
* @param xsdFilename schema to validate against.
75
- * @param in document to be validated.
75
+ * @param is source from which schema is read. Ideally it will have the systemId property set to resolve
76
+ * relative references.
76
77
* @param options to be applied during parsing.
77
78
* @throws Exception if an error occurs when parsing the document or schema.
78
79
*/
79
- public static void validate (final String xsdFilename , final InputStream in , final ParserOptions options )
80
+ public static void validate (final String xsdFilename , final InputSource is , final ParserOptions options )
80
81
throws Exception
81
82
{
82
83
final DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
@@ -91,15 +92,32 @@ public static void validate(final String xsdFilename, final InputStream in, fina
91
92
factory .setFeature ("http://apache.org/xml/features/xinclude/fixup-base-uris" , false );
92
93
}
93
94
94
- factory .newDocumentBuilder ().parse (in );
95
+ factory .newDocumentBuilder ().parse (is );
95
96
}
96
97
97
98
/**
98
- * Take an {@link InputSource} and parse it generating map of template ID to Message objects, types, and schema.
99
+ * Wraps the {@link InputStream} into an {@link InputSource} and delegates to
100
+ * {@link #validate(String, InputSource, ParserOptions)}.
99
101
* <p>
100
- * Exceptions are passed back up for any problems.
102
+ * <b>Note:</b> this method does not set the {@link InputSource#setSystemId(java.lang.String)} property.
103
+ * However, it is recommended to use the {@link #validate(String, InputSource, ParserOptions)} method directly.
101
104
*
102
- * @param is inputSource from which schema is read. Ideally it will have the systemId property set to resolve relative references
105
+ * @param xsdFilename schema to validate against.
106
+ * @param in document to be validated.
107
+ * @param options to be applied during parsing.
108
+ * @throws Exception if an error occurs when parsing the document or schema.
109
+ */
110
+ public static void validate (final String xsdFilename , final InputStream in , final ParserOptions options )
111
+ throws Exception
112
+ {
113
+ validate (xsdFilename , new InputSource (in ), options );
114
+ }
115
+
116
+ /**
117
+ * Take an {@link InputSource} and parse it generating map of template ID to Message objects, types, and schema.
118
+ *
119
+ * @param is source from which schema is read. Ideally it will have the systemId property set to resolve
120
+ * relative references.
103
121
* @param options to be applied during parsing.
104
122
* @return {@link MessageSchema} encoding for the schema.
105
123
* @throws Exception on parsing error.
@@ -135,13 +153,11 @@ public static MessageSchema parse(final InputSource is, final ParserOptions opti
135
153
}
136
154
137
155
/**
138
- * Wraps an {@link InputStream} into an {@link InputSource} and delegates to
139
- * {@link #parse(org.xml.sax.InputSource, uk.co.real_logic.sbe.xml.ParserOptions) }.
140
- * <p>Note: this method does not the the {@link InputSource#setSystemId(java.lang.String) } property, however. It is recommended to use the
141
- * {@link #parse(org.xml.sax.InputSource, uk.co.real_logic.sbe.xml.ParserOptions) } method directly.</p>
142
- *
156
+ * Wraps the {@link InputStream} into an {@link InputSource} and delegates to
157
+ * {@link #parse(InputSource, ParserOptions)}.
143
158
* <p>
144
- * Exceptions are passed back up for any problems.
159
+ * <b>Note:</b> this method does not set the {@link InputSource#setSystemId(java.lang.String)} property.
160
+ * However, it is recommended to use the {@link #parse(InputSource, ParserOptions)} method directly.
145
161
*
146
162
* @param in stream from which schema is read.
147
163
* @param options to be applied during parsing.
0 commit comments