Browse files

Fixes #111 - improve build(String) documentation for SAXBuilder

  • Loading branch information...
1 parent 101f2e1 commit 1fca9491ac4e8d081055bb3661e3d998c0f2a998 @rolfl rolfl committed Apr 7, 2013
Showing with 11 additions and 1 deletion.
  1. +11 −1 core/src/java/org/jdom2/input/SAXBuilder.java
View
12 core/src/java/org/jdom2/input/SAXBuilder.java
@@ -1234,8 +1234,18 @@ public Document build(final Reader characterStream, final String systemId)
/**
* <p>
- * This builds a document from the supplied URI.
+ * This builds a document from the supplied URI. The URI is typically a file name, or a URL.
+ * Do not use this method for parsing XML content that is in a Java String variable.
+ * <p>
+ * <ul>
+ * <li><Strong>Right:</Strong> <code>....build("path/to/file.xml");</code>
+ * <li><Strong>Right:</Strong> <code>....build("http://my.example.com/xmlfile");</code>
+ * <li><Strong>Wrong:</Strong> <code>....build("&lt;root>data&lt/root>");</code>
+ * </ul>
* </p>
+ * If your XML content is in a Java String variable and you want to parse it, then use:<br/>
+ * <code> ....build(new StringReader("&lt;root>data&lt/root>"));</code>
+ * <p>
*
* @param systemId
* URI for the input

0 comments on commit 1fca949

Please sign in to comment.