You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by mp...@apache.org on 2002/02/16 16:45:59 UTC

cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform XmlToData.java

mpoeschl    02/02/16 07:45:59

  Modified:    src/java/org/apache/torque/engine/database/transform
                        XmlToData.java
  Log:
  attributes.getLocalName() always returns '' so use getQName() to fix TorqueDataSQLTask
  
  Revision  Changes    Path
  1.4       +17 -13    jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/XmlToData.java
  
  Index: XmlToData.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/XmlToData.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XmlToData.java	29 Jan 2002 04:50:28 -0000	1.3
  +++ XmlToData.java	16 Feb 2002 15:45:59 -0000	1.4
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -84,15 +84,15 @@
   import org.xml.sax.helpers.DefaultHandler;
   
   /**
  - * A Class that is used to parse an input
  - * xml schema file and creates and AppData java structure.
  + * A Class that is used to parse an input xml schema file and creates and
  + * AppData java structure. <br>
    * It uses apache Xerces to do the xml parsing.
    *
    * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
    * @author <a href="mailto:fedor.karpelevitch@home.com">Fedor Karpelevitch</a>
  - * @version $Id: XmlToData.java,v 1.3 2002/01/29 04:50:28 jmcnally Exp $
  + * @version $Id: XmlToData.java,v 1.4 2002/02/16 15:45:59 mpoeschl Exp $
    */
   public class XmlToData extends DefaultHandler implements EntityResolver
   {
  @@ -105,7 +105,9 @@
   
       private static SAXParserFactory saxFactory;
   
  -    static {
  +
  +    static
  +    {
           saxFactory = SAXParserFactory.newInstance();
           saxFactory.setValidating(true);
       }
  @@ -123,7 +125,6 @@
           errorMessage = "";
       }
   
  -
       /**
        *
        */
  @@ -160,8 +161,6 @@
           return data;
       }
   
  -
  -
       /**
        * Handles opening elements of the xml file.
        */
  @@ -170,6 +169,7 @@
       {
           try
           {
  +            System.out.println("start: " + rawName);
               if (rawName.equals("dataset"))
               {
                   //ignore <dataset> for now.
  @@ -178,10 +178,10 @@
               {
                   Table table = database.getTableByJavaName(rawName);
                   Vector columnValues = new Vector();
  -                for (int i=0; i<attributes.getLength(); i++)
  +                for (int i = 0; i < attributes.getLength(); i++)
                   {
                       Column col = table
  -                        .getColumnByJavaName(attributes.getLocalName(i));
  +                        .getColumnByJavaName(attributes.getQName(i));
                       String value = attributes.getValue(i);
                       columnValues.add(new ColumnValue(col, value));
                   }
  @@ -233,7 +233,6 @@
                              " Msg: " + spe.getMessage());
       }
   
  -
       /**
        * called by the XML parser
        *
  @@ -241,8 +240,7 @@
        */
       public InputSource resolveEntity(String publicId, String systemId)
       {
  -        if (dataDTD != null &&
  -            dtdFileName.equals(systemId))
  +        if (dataDTD != null && dtdFileName.equals(systemId))
           {
               System.out.println("Resolver: used " + dtdFile.getPath());
               return dataDTD;
  @@ -274,6 +272,9 @@
           return new InputSource();
       }
   
  +    /**
  +     *
  +     */
       public class DataRow
       {
           private Table table;
  @@ -296,6 +297,9 @@
           }
       }
   
  +    /**
  +     *
  +     */
       public class ColumnValue
       {
           private Column col;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>