[ A blank line here will cause the error ]
{{theTime}}
Search This Blog
Total Pageviews
Showing posts with label java-xml. Show all posts
Showing posts with label java-xml. Show all posts
SAXException: The Processing Instruction Target Matching "[xX][mM][lL]" is Not Allowed
This means first line of the source xml file might be blank.
Method to build Document using xml file.
import javax.xml.parsers ;
private Document buildXmlDocument(File file) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance() ;
DocumentBuilder builder = null ;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
Document doc = null;
try {
doc = builder.parse(file);
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return doc ;
}
private Document buildXmlDocument(File file) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance() ;
DocumentBuilder builder = null ;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
Document doc = null;
try {
doc = builder.parse(file);
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return doc ;
}
Subscribe to:
Posts (Atom)
Optimizing Java Applications for Low-Latency Microservices
Introduction Microservices architecture has become a go-to for building scalable, modular systems, but achieving low latency in Java-based...