document « XML file « Java I/O Q&A

1. Can I create an XML document from dtd file in Java?

I have a simple DTD file with elements and attributes specifications. Can i create a suitable XML file (with DOM) parsing this DTD with Java and no external APIs? Thanks in ...

2. How to efficiently parse concatenated XML documents from a file

I have a file that consists of concatenated valid XML documents. I'd like to separate individual XML documents efficiently. Contents of the concatenated file will look like this, thus the concatenated file ...

3. Replacing XML in File from "Document" in Java

after processing my first steps in working with XML in java I am now at the point where I want to update some data in my XML/GPX file... Reaplacing it in my ...

4. Parse a badly formatted XML document (like an HTML file)

After the parse, I would like to remove dangerous code and write it out again properly formatted. The purpose is to prevent scripts from entering through an email but still allow the ...

5. How to save parsed and changed DOM document in xml file?

I have xml-file. I need to read it, make some changes and write new changed version to some new destination. I managed to read, parse and patch this file (with DocumentBuilderFactory, DocumentBuilder, ...

6. Need to find corrupt document(docx file format)

I am using xslt to convert my html to docx file format(which is in open office xml format). When i open some generated docx file in word, its showing error(may be ...

7. How to put String text without converting content to xml file in Java?

I need to put String content to xml in Java. I use this kind of code to insert information in xml:

Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File ("file.xml"));
DOMSource source = new DOMSource (doc);

Node ...

8. How to parse multiple, consecutive xml files in one document?

I have a big text file that is a sequence of XML-valid documents that looks something like this:

   <TEXT> ... </TEXT>
    <TEXT> ...

9. Error writing XML Document to file in Java

I am trying to write org.w3c.dom.Document to a file. I get the Document from

String URL = "http://...."
DOMParser parser = new DOMParser();
Document doc = null;
try {
    parser.parse(new InputSource(URL));

10. Saving a styled document to XML file


12. Parsing an XML document from a string - not a file

Hello, I was wondering if it is possible to parse XML using dom, where the input XML is a string, and not an actual file. I was hoping to be able to bypass creating a file. So like String xmlDoc = "

13. Document object of xml file question.

14. use xml file to create a word/pdf document

Without knowing any details, I would guess that you have a couple of options; Parse the xml using SAX or some similar tool and use the data recovered to create the document using an existing API; HWPF for example would allow you to create a simple Word documnet or, if you were much braver, you could use the SWT to 'drive' ...