java Programming Glossary: stringreader
Validate an XML File Against Multiple Schema Definitions http://stackoverflow.com/questions/1094893/validate-an-xml-file-against-multiple-schema-definitions validator.validate new StreamSource new StringReader xmlContent but this is failing to import all three of the schemas..
Pretty-printing output from javax.xml.transform.Transformer with only standard java api (Indentation and Doctype positioning) http://stackoverflow.com/questions/1264849/pretty-printing-output-from-javax-xml-transform-transformer-with-only-standard-j transformer input Source xmlInput new StreamSource new StringReader Document comment aaa bbb ccc aaa StreamResult xmlOutput new..
How to pretty print XML from Java? http://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java import java.io.IOException import java.io.StringReader import java.io.StringWriter import java.io.Writer Pretty prints.. dbf.newDocumentBuilder InputSource is new InputSource new StringReader in return db.parse is catch ParserConfigurationException e..
Best way to parse an XML String in Java? http://stackoverflow.com/questions/1522874/best-way-to-parse-an-xml-string-in-java Document doc dBuilder.parse new InputSource new StringReader zText doc.getDocumentElement .normalize return doc catch Exception..
Make DocumentBuilder.parse ignore DTD references http://stackoverflow.com/questions/155101/make-documentbuilder-parse-ignore-dtd-references if systemId.contains foo.dtd return new InputSource new StringReader else return null I found that simply returning an empty..
how to disable dtd at runtime in java's xpath? http://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath java.io.File import java.io.IOException import java.io.StringReader import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory.. Ignoring publicId systemId return new InputSource new StringReader Document document builder.parse new File src foo.xml XPathFactory..
Element to string in HTMLDocument http://stackoverflow.com/questions/2882782/element-to-string-in-htmldocument to use the read method of HTMLEditorKit . import java.io.StringReader import javax.swing.text.AttributeSet import javax.swing.text.Element.. htmlKit.createDefaultDocument htmlKit.read new StringReader text htmlDoc 0 Parse ElementIterator iterator new ElementIterator..
Java/JAXB: Unmarshall Xml to specific subclass based on an attribute http://stackoverflow.com/questions/2992234/java-jaxb-unmarshall-xml-to-specific-subclass-based-on-an-attribute demo program to check that everything works import java.io.StringReader import javax.xml.bind.JAXBContext import javax.xml.bind.Marshaller.. Shapes.class Triangle.class Square.class StringReader xml new StringReader shapes shape square specific attribute.. Triangle.class Square.class StringReader xml new StringReader shapes shape square specific attribute 'square stuff' type 'square'..
how to retrieve element value of XML using Java? http://stackoverflow.com/questions/4076910/how-to-retrieve-element-value-of-xml-using-java Document document builder.parse new InputSource new StringReader xml Element rootElement document.getDocumentElement If your..
HTTP request for XML file http://stackoverflow.com/questions/5162063/http-request-for-xml-file is for a URL format. You need to wrap the String in a StringReader before parsing it. It is even better if you can grab the XML..
In Java, how do I parse XML as a String instead of a file? http://stackoverflow.com/questions/562160/in-java-how-do-i-parse-xml-as-a-string-instead-of-a-file InputSource is new InputSource new StringReader xml return builder.parse is also see this similar question ..
Java Properties backslash http://stackoverflow.com/questions/5784895/java-properties-backslash
Generic method in Java without generic argument http://stackoverflow.com/questions/590405/generic-method-in-java-without-generic-argument um context.createUnmarshaller return T um.unmarshal new StringReader xml catch JAXBException je throw new RuntimeException Error.. um context.createUnmarshaller Object obj um.unmarshal new StringReader xml try return clazz.cast obj catch ClassCastException exc ..
HTML to Markdown with Java http://stackoverflow.com/questions/59557/html-to-markdown-with-java mardownXSLT.xslt Source xmlSource new StreamSource new StringReader theHTML Source xsltSource new StreamSource xsltFile TransformerFactory..
Multiple XML “files” in one stream http://stackoverflow.com/questions/6711766/multiple-xml-files-in-one-stream code to unmarshall both from one String Reader reader new StringReader response JAXBContext jcrh JAXBContext.newInstance ResponseHeader.class..
Simplest way to query XML in Java http://stackoverflow.com/questions/807418/simplest-way-to-query-xml-in-java InputSource source new InputSource new StringReader xml String status xpath.evaluate resp status source System.out.println..
NamespaceContext and using namespaces with XPath http://stackoverflow.com/questions/914013/namespacecontext-and-using-namespaces-with-xpath XMLEventReader evtReader factory .createXMLEventReader new StringReader ctxtTemplate while evtReader.hasNext XMLEvent event evtReader.nextEvent.. String value xpath.evaluate expression new InputSource new StringReader xml System.out.println value Neither the implementation returned..
|