[Castore-commits] TransFilesParser.java 1.3.2.2 1.3.2.3
Stéphane Bouchet
sbouchet at adullact1.hosting.cri74.org
Lun 6 Mar 12:14:21 CET 2006
Update of /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/retro
In directory adullact1:/tmp/cvs-serv11835/src/java/fr/emn/castor/documents/retro
Modified Files:
Tag: v1_1_branch
TransFilesParser.java
Log Message:
correction bug du parsing XML
Index: TransFilesParser.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/retro/TransFilesParser.java,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -d -r1.3.2.2 -r1.3.2.3
*** TransFilesParser.java 21 Dec 2005 17:40:31 -0000 1.3.2.2
--- TransFilesParser.java 6 Mar 2006 11:14:18 -0000 1.3.2.3
***************
*** 49,55 ****
import javax.xml.parsers.FactoryConfigurationError;
- import javax.xml.parsers.ParserConfigurationException;
- import javax.xml.parsers.SAXParser;
- import javax.xml.parsers.SAXParserFactory;
import org.apache.commons.logging.Log;
--- 49,52 ----
***************
*** 60,63 ****
--- 57,61 ----
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+ import org.xml.sax.helpers.XMLReaderFactory;
import fr.emn.castor.common.Constants;
***************
*** 81,107 ****
private static Log log = LogFactory.getLog(TransFilesParser.class);
! public TransFilesParser(final String file) {
this.s4sFilesDetails = new ArrayList();
try {
! String path = Constants.CASTOR_S4S_PATH +Constants.FILE_SEPARATOR
! + file;
InputStream in = new FileInputStream(path);
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
- saxParserFactory.setValidating(false);
- SAXParser saxParser = saxParserFactory.newSAXParser();
InputSource source = new InputSource(in);
source.setSystemId(path);
! this.xmlReader = saxParser.getXMLReader();
this.xmlReader.setContentHandler(this);
this.xmlReader.setErrorHandler(this);
this.xmlReader.parse(source);
-
} catch (FileNotFoundException e) {
log.error(e.getMessage(), e);
} catch (FactoryConfigurationError e) {
log.error(e.getMessage(), e);
- } catch (ParserConfigurationException e) {
- log.error(e.getMessage(), e);
} catch (SAXException e) {
log.error(e.getMessage(), e);
--- 79,100 ----
private static Log log = LogFactory.getLog(TransFilesParser.class);
! public TransFilesParser (final String file) {
this.s4sFilesDetails = new ArrayList();
try {
! String path = Constants.CASTOR_S4S_PATH
! + Constants.FILE_SEPARATOR + file;
InputStream in = new FileInputStream(path);
InputSource source = new InputSource(in);
source.setSystemId(path);
! this.xmlReader = XMLReaderFactory
! .createXMLReader(Constants.XML_SAX_PARSER);
this.xmlReader.setContentHandler(this);
this.xmlReader.setErrorHandler(this);
this.xmlReader.parse(source);
} catch (FileNotFoundException e) {
log.error(e.getMessage(), e);
} catch (FactoryConfigurationError e) {
log.error(e.getMessage(), e);
} catch (SAXException e) {
log.error(e.getMessage(), e);
***************
*** 113,129 ****
/**
- * @see org.xml.sax.ContentHandler#characters(char[], int, int)
- */
- public final void characters(final char[] text, final int start,
- final int length) {
- // il n'y a pas de texte a lire.
- }
-
- /**
* @see org.xml.sax.ContentHandler#endElement(java.lang.String,
* java.lang.String, java.lang.String)
*/
! public final void endElement(final String uri, final String localName,
! final String qName) throws SAXException {
// on rajoute le workflow lu a la liste
if (qName.equals("file")) {
--- 106,115 ----
/**
* @see org.xml.sax.ContentHandler#endElement(java.lang.String,
* java.lang.String, java.lang.String)
*/
! public final void endElement(
! final String uri, final String localName, final String qName)
! throws SAXException {
// on rajoute le workflow lu a la liste
if (qName.equals("file")) {
***************
*** 144,150 ****
* java.lang.String, java.lang.String, org.xml.sax.Attributes)
*/
! public final void startElement(final String uri, final String localName,
! final String qName, final Attributes attributes)
! throws SAXException {
if (qName.equals("files")) {
this.s4sFilesDetails = new ArrayList();
--- 130,136 ----
* java.lang.String, java.lang.String, org.xml.sax.Attributes)
*/
! public final void startElement(
! final String uri, final String localName, final String qName,
! final Attributes attributes) throws SAXException {
if (qName.equals("files")) {
this.s4sFilesDetails = new ArrayList();
***************
*** 152,164 ****
this.currentFile = new HashMap();
this.currentFile.put(DocumentsConstants.S4S_FILE_XML, attributes
! .getValue("pathXML"));
! this.currentFile.put(DocumentsConstants.S4S_FILE_XSLT, attributes
.getValue("pathXSLT"));
this.currentFile.put(DocumentsConstants.S4S_LABEL, attributes
! .getValue("name"));
this.currentFile.put(DocumentsConstants.S4S_COMMENT, attributes
! .getValue("comment"));
this.currentFile.put(DocumentsConstants.S4S_REF, attributes
! .getValue("ref"));
}
--- 138,151 ----
this.currentFile = new HashMap();
this.currentFile.put(DocumentsConstants.S4S_FILE_XML, attributes
! .getValue("pathXML"));
! this.currentFile.put(
! DocumentsConstants.S4S_FILE_XSLT, attributes
.getValue("pathXSLT"));
this.currentFile.put(DocumentsConstants.S4S_LABEL, attributes
! .getValue("name"));
this.currentFile.put(DocumentsConstants.S4S_COMMENT, attributes
! .getValue("comment"));
this.currentFile.put(DocumentsConstants.S4S_REF, attributes
! .getValue("ref"));
}
Plus d'informations sur la liste de diffusion Castore-commits