xml « API « Java I/O Q&A





1. Reading a single XML document from a stream using dom4j    stackoverflow.com

I'm trying to read a single XML document from stream at a time using dom4j, process it, then proceed to the next document on the stream. Unfortunately, dom4j's SAXReader (using ...

2. Get the amount of bytes read in by javax.xml.stream.XMLStreamReader    stackoverflow.com

Is there any way to get the amount of bytes read in by the XMLStreamReader, I am using a java.io.FileReader which is passed into the factory that creates the xml reader. ...

3. Getting the inputstream from a classpath resource (XML file)    stackoverflow.com

In Java web application, Suppose if I want to get the InputStream of an XML file, which is placed in the CLASSPATH (i.e. inside the sources folder), how do I do ...

4. how to create an InputStream from a Document or Node    stackoverflow.com

How can I create an InputStream object from a XML Document or Node object to be used in xstream? I need to replace the ??? with some meaningful code. ...

5. Why use BufferedReader in this case?    stackoverflow.com

What is the difference between using a BufferedReader around the StringReader in the following code vs using the StringReader only? By loading up the DOM in line 2 of both ...

6. How to stream XML data using XOM?    stackoverflow.com

Say I want to output a huge set of search results, as XML, into a PrintWriter or an OutputStream, using XOM. The resulting XML would look like this:

<?xml version="1.0" ...

7. Streaming XPath evaluation    stackoverflow.com

Are there any production-ready libraries for streaming XPath expressions evaluation against provided xml-document? My investigations show that most of existing solutions load entire DOM-tree into memory before evaluating xpath expression.

8. best java approach for stream filtering in XML?    stackoverflow.com

I want to take an XML file as input and output the same XML except for some search/replace actions for attributes and text, based on matching certain node characteristics. What's the best ...

9. Convert a string to XML input stream in java    stackoverflow.com

I'm trying to generate a PDF document using FOP and Java. I receive the XML as a string and not as a file. How can I convert this XML string to an XML ...





10. Java: Saving StreamResult to a file    stackoverflow.com

I am doing some data conversion(like csv) to xml with SAX then using transformer in Java. The result is in StreamResult, and I am trying to save this result to ...

11. Convert XmlPullParser instance to XMLStreamReader instance    stackoverflow.com

Short of it is I am using a 3rd party library to parse some xmpp messages. It is giving me an instance of XmlPullParser to parse an atom syndicate feed entity ...

12. XMLStreamReader and a real stream    stackoverflow.com

Update There is no ready XML parser in Java community which can do NIO and XML parsing. This is the closest I found, and it's incomplete: http://wiki.fasterxml.com/AaltoHome I have the ...

13. How to re-read javax.xml.stream.Source object    stackoverflow.com

I need to get some xml Element qname from an javax.xml.stream.Source object first, then fully parse this xml file. How can I do this ? The colon is not a safe ...

14. from OutputStream to a File Stream    stackoverflow.com

I want to save my DOM Document as an XML file. I follow this tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html So, this is my code:

...
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DOMSource source = ...

15. How to convert javax.xml.transform.Source into an InputStream?    stackoverflow.com

How can I convert a javax.xml.transform.Source into a InputStream? The Implementation of Source is javax.xml.transform.dom.DOMSource.

Source inputSource = messageContext.getRequest().getPayloadSource();

16. Filter XML stream using SAX    stackoverflow.com

I have an XML stream I want to parse using SAX. What I actually want to do is simply echo out the XML stream to an output stream, but optionally filter ...





17. Transform XML based on a template with custom logic. Which framework? How to achieve streaming?    stackoverflow.com

I want to modify a XML template with a custom logic, it's similiar to XSLT but has some very own features. The XML template file is clean and ready to expand.

 ...

18. Problem with FileWriter into multiple files in Java    stackoverflow.com

I'm using java with freemarker to generate HTML files through the FTL (the template file) and XML. I got the result in multiple files but each file contains the whole result. ...

19. how to get an instance of an XMLEventAllocator?    stackoverflow.com

I am trying to follow the recommended way of parsing XML with StAX using sun's Cursor-to-Event Example for Java EE 5. You are supposed to traverse the XML via ...

20. Java overwriting files with stream result    stackoverflow.com

I created a simple class to create an XML document. However, if I call the method more than once while creating a document of the same name the file does not overwrite. How ...

21. How to generate a large (30MB+) xml file in java?    stackoverflow.com

The file itself is not that big, should fit in memory. But once you combine that with other overhead factors then starts to become a problem. We are building a DOM ...

22. XMLStreamReader not closing opened xml file    stackoverflow.com

To use XMLStreamReader I am initializing it like -

XMLInputFactory f = XMLInputFactory.newInstance();
XMLStreamReader reader = f.createXMLStreamReader(new FileReader(
        "somefile.xml"));
Iterating over it like -
if (reader.hasNext()) {
  ...

23. Best way to read Namespace from XML stream (using Java)    stackoverflow.com

I was wondering if people had some opinions on the following. I have XML segments like:

<?xml version="1.0" encoding="UTF-8"?>
<clashes:MatchingElementAndAttribute xmlns:clashes="http://example.com/AttribElemClashes" clash="123">
        <clash>strval</clash>
</clashes:MatchingElementAndAttribute>
And I want to be ...

24. deserializing xml file from xstream    stackoverflow.com

I am using Xstream to serializing a Job object. It looks working fine. but deserializing, I have a problem:

Exception in thread "main" com.thoughtworks.xstream.io.StreamException:  : only whitespace content allowed before start tag ...

25. Copying XML File to Write to New XML File in Java    stackoverflow.com

I was wondering if anyone knew if it was possible to use one of the XML parsers in Java to read line-by-line, each of the rows in an XML document and ...

26. Cannot use dom.getElementById or doc.getElementByTagName Http InputStream    stackoverflow.com

I am trying to crawl a web page... I am doing the following:

  1. Open Http connection on the page
  2. Get InputStream
  3. Write to some ByteArrayInputStream
  4. Close the original InputStream
  5. Get the Document Object of the returned HTML ...

27. Conversion of UTF String to InputStream    stackoverflow.com

I am trying to get XML data from a MIDP device to a Servlet. Servlet is obtaining the Data as follows -

DataInputStream dis = new DataInputStream((InputStream) request.getInputStream());
    ...

28. How to read an xml that is in the form of an InputStream    stackoverflow.com

In my web service i'm getting the xml i have to validate against a schema as an InputStream. I have to choose different schema files based if there is a "version" ...

29. reading xml file using FileInputStream    stackoverflow.com

I am reading an XML file using the code given below, but every time I read the XML and print the same, the opening tag of XML is always missing, which ...

30. Create a FileReader from an XMLResponse?    stackoverflow.com

I'm trying to create a FileReader (not a Document) from an XMLResponse like this :

    // Parse XML Response
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
   ...

31. Using XStream to stream an unkown (potentially very large) number of Java objects    stackoverflow.com

I am attempting to use XStream to stream objects between two processes (which are JVMs essentially). I found a similar question was being asked on this forum before (please refer to ...

32. Consume XML Push Data Feed on Open Channel with Java    stackoverflow.com

I am looking for some example Java code and/or utility library for consuming an XML push data feed over http. I already know how to consume and parse a basic XML feed ...

33. Get an InputStream/io.Reader from OMElement object    stackoverflow.com

I have a OMElement object and from that I want to get an InputStream or reader object. What I want is to stream the xml from the OMElement which I have, ...

35. How to stream xml document to inputSource?    coderanch.com

Hello, in my webapp I want to stream an generated xml document to an instance of org.xml.sax.InputSource in order to process it further with an xslt file in an XSLT Transformation. My question: how do I generate the xml file to an stream? The code looks like this: StreamResult streamResult = new StreamResult(PrintWriter); SAXTransformerFactory tf = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); TransformerHandler hd = tf.newTransformerHandler(); ...

36. Downloading XML stream    coderanch.com

We have an xml stream which we retrieve from the DB. We need to allow the user to download this stream as a file onto their local system. How do we convert this stream into a file in memory,which is then allowed to be downloaded by the user to a selected location on his machine.

37. XML Beans - The type javax.xml.stream. XMLStreamReader cannot be resolved.    coderanch.com

Hi, I managed to get XML Beans installed and generated the .jar via scomp. Everything looks good apart from when I try to parse the file. Under the following code "AddressDetailsDocument myParsedDoc = AddressDetailsDocument.Factory.parse(fleInput);" I get the error "The type javax.xml.stream.XMLStreamReader cannot be resolved. It is indirectly referenced from required .class files" Am I missing another .jar file? I am referencing ...

38. Looking for correct data type to take in stream of xml    coderanch.com

Ive been looking into TreeData but not sure it is what I need. I basically have some xml I can get from the web service as a stream or a String. I need some type of data type that is suitable to hold this Stream of xml. Then I am needing to make a tree that uses EL to bind this ...

40. Streaming nested XML file    coderanch.com

Hi All, What are possible approaches for streaming xml documents? I have requirement where is the huge no. (in lacks) of payments information is provided in XML format (nested sructure) and we need to parse and manipulate some fields and finally display the result in webapplication. Any suggestion will be of great help. Regards, Ranbir

41. Convert ByteBuffer data to xml    forums.oracle.com

42. Fileoutputstream in xml    forums.oracle.com

43. javax.xml.stream is not found    forums.oracle.com

44. Continuous XML Stream    forums.oracle.com

Hi All, Sorry if this has been asked before. I'm trying to read XML documents as they come in from a BufferedReader. Its used for communications between two Java applications (Client / Server). This is how I'm parsing the documents as they come in from the server: DocumentBuilder builder = DocumentBuilderFactory.newInstance(). newDocumentBuilder(); Document document = builder.parse(new InputSource(reader)); Because the stream is ...

45. InputStream and XML    forums.oracle.com

Hello, I've written a servlet which takes some XML from the request's input stream, parses it and then does some database-related stuff with the results. My problem is that additional header information is included in the input stream, thus making my XML parser fall over. I do a request.getInputStream() to get the input stream, which I then pass to my SAX ...

46. IMPORT NOT WORKING: package javax.xml.stream does not exist    forums.oracle.com

SampleXMLWriter.java:3: package javax.xml.stream does not exist import javax.xml.stream.XMLOutputFactory; ^ SampleXMLWriter.java:4: package javax.xml.stream does not exist import javax.xml.stream.XMLStreamWriter; ^ SampleXMLWriter.java:5: package javax.xml.stream does not exist import javax.xml.stream.XMLStreamException; ^ SampleXMLWriter.java:26: cannot find symbol symbol : class XMLStreamWriter location: class org.chinthaka.articles.stax.SampleXMLWriter XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStr eamWriter(outStream); ^ SampleXMLWriter.java:26: cannot find symbol symbol : variable XMLOutputFactory location: class org.chinthaka.articles.stax.SampleXMLWriter XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStr eamWriter(outStream); ^ ...

47. Convert a String to a javax.xml.stream.XMLStreamReader    forums.oracle.com

Good Evening! I have an XML document stored as a String in my program and I need to pass the String XML document into a method that is expecting the input to be a javax.xml.stream.XMLStreamReader. So, can anyone point me towards what I need to do to get from String to XMLStreamReader? Thanks, Doug

48. javax.xml.stream import problem???? plz help    forums.oracle.com

hi, i am looking into using stax to write to xml, however i believe i need some classes contained within javax.xml.stream.*; and this is not contained within j2se docs i know, i think it comes with the web services. what i wanted to know is as i am using netbeans what is the best way for me to use these packages ...