on 11-21-2008 12:22 PM
Hi,
i want to use SAX parser for MessageMapping. XML looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<msgInf_Invoice>
<row>
<DOCUMENT>
<?xml version="1.0" encoding="utf-8"?><INVOICE>....
</row>
</document>
<row>
<DOCUMENT>
<?xml version="1.0" encoding="utf-8"?><INVOICE>....
</row>
</document>
</msgInf_Invoice>
As you can see, I'm using JDBC adapter on sender site, and customer simply appends messages into CLOB field in DB. XML is not valid because, there are many occurrences of
<?xml version="1.0" encoding="utf-8"?>
(how many messages, so many times + one from XI at the beginning. When I try SAX parser it dumps, because of validation.
Is there any way to switch off validation in SAX parser, or perhaps is there way to change InputStream of parser to correct and then use full functionality of it?
thx
Hi
Use like this
import these
import java.io.*;
import org.xml.sax.*;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
example use
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
out = new OutputStreamWriter (System.out, "UTF8");
SAXParser saxParser = factory.newSAXParser();
saxParser.parse( new File(XML_FILE_NAME), new MapChange() );
} catch (Throwable err) {
err.printStackTrace ();
}
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I figured out, problem is that XML from CLOB contains > instead > and so on. Obviously SAX parser cann't understand < and < in same document. OK, i can replace that but potentially there is problem with large messages, how to keep good performance? Any idea? How to do fastest string replacing in Java?
thx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.