List of usage examples for java.io StringReader StringReader
public StringReader(String s)
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); System.out.println(xmlDoc.getInputEncoding()); }
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); DOMImplementation impl = xmlDoc.getImplementation(); }
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); System.out.println(xmlDoc.getStrictErrorChecking()); }
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); xmlDoc.normalizeDocument();/*ww w . j a v a 2 s .c o m*/ }
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); System.out.println(xmlDoc.getXmlEncoding()); }
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); xmlDoc.setDocumentURI("http://java2s.com"); }
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); xmlDoc.setStrictErrorChecking(true); }
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); System.out.println(xmlDoc.getXmlVersion()); }
From source file:Main.java
License:asdf
public static void main(String args[]) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); // Create the parser Document xmlDoc = builder.parse(new InputSource(new StringReader(xmlString))); System.out.println(xmlDoc.getXmlStandalone()); }
From source file:StringIOApp.java
public static void main(String args[]) throws IOException { StringWriter outStream = new StringWriter(); String s = "This is a test."; for (int i = 0; i < s.length(); ++i) outStream.write(s.charAt(i));/*from w ww . ja va2 s. c o m*/ System.out.println("outstream: " + outStream); System.out.println("size: " + outStream.toString().length()); StringReader inStream; inStream = new StringReader(outStream.toString()); int ch = 0; StringBuffer sb = new StringBuffer(""); while ((ch = inStream.read()) != -1) sb.append((char) ch); s = sb.toString(); System.out.println(s.length() + " characters were read"); System.out.println("They are: " + s); }