Java Doc for XmlLoad.java in  » Database-DBMS » Quadcap-Embeddable-Database » com » quadcap » sql » tools » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » Quadcap Embeddable Database » com.quadcap.sql.tools 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.quadcap.sql.tools.XmlLoad

XmlLoad
public class XmlLoad implements DocumentHandler,ErrorHandler(Code)
This class implements the reverse functionality of XmlDump -- it loads a database with the data contained in the specified XML file.
author:
   Stan Bailes


Field Summary
final static  intCOLUMN
    
final static  intDATABASE
    
final static  intDDL
    
final static  intDML
    
final static  intTABLE
    
final static  intXML
    
 StringcolumnName
    
 Connectionconn
    
 StringBufferdata
    
static  byte[]hexMap
    
 Locatorlocator
    
 Parserparser
    
 ResultSetMetaDatarm
    
 ResultSetrs
    
 intstate
    
 Statementstmt
    
 StringtableName
    

Constructor Summary
public  XmlLoad()
     No-argument constructor.
public  XmlLoad(Connection conn)
    

Method Summary
public  voidcharacters(char[] ch, int start, int length)
     SAX parser callback to handle character data found in the parsed document.
public  voidendDocument()
     SAX parser callback function that is called when the end of the document is reached.
public  voidendElement(String name)
     SAX parser callback function called for the end of an element.
public  voiderror(SAXParseException exception)
     SAX parser callback to handle XML Parser errors.
public  voidfatalError(SAXParseException exception)
     SAX parser callback to handle XML Parser fatal errors.
public  ConnectiongetConnection()
    
public  voidignorableWhitespace(char[] ch, int start, int length)
     SAX parser callback for ignorable whitespace.
public  voidload(InputStream is)
     Load the XML document from the specified input stream, importing the data contained therein into the database referenced by the current connection.
public  voidload(Reader r)
     Load the XML document from the specified reader, importing the data contained therein into the database referenced by the current connection.
public static  voidmain(String[] args)
     A main program which supports the command-line invocation of either the Loader or XmlLoad functions.
 byte[]makeBytes(String val)
    
public  SAXExceptionmakeException(String s)
    
 ObjectmakeObject(int jdbcType, String val)
    
final static  voidprintException(Throwable t)
    
public  voidprocessingInstruction(String target, String data)
     SAX parser callback for processing instructions.
public  voidsetConnection(Connection conn)
    
public  voidsetDocumentLocator(Locator locator)
     SAX parser callback used to receive a document locator.
public  voidstartDocument()
     SAX parser callback for document start.
public  voidstartElement(String name, AttributeList attrs)
     SAX parser callback for the start of an element.
public  voidwarning(SAXParseException exception)
     SAX parser callback to handle XML Parser fatal errors.

Field Detail
COLUMN
final static int COLUMN(Code)



DATABASE
final static int DATABASE(Code)



DDL
final static int DDL(Code)



DML
final static int DML(Code)



TABLE
final static int TABLE(Code)



XML
final static int XML(Code)



columnName
String columnName(Code)



conn
Connection conn(Code)



data
StringBuffer data(Code)



hexMap
static byte[] hexMap(Code)



locator
Locator locator(Code)



parser
Parser parser(Code)



rm
ResultSetMetaData rm(Code)



rs
ResultSet rs(Code)



state
int state(Code)



stmt
Statement stmt(Code)



tableName
String tableName(Code)




Constructor Detail
XmlLoad
public XmlLoad() throws Exception(Code)
No-argument constructor. The new object needs a database connection before it can do anything useful.
exception:
  Exception - may be thrown if there's a problem constructingthe XML parser.



XmlLoad
public XmlLoad(Connection conn) throws Exception(Code)
Construct a new XmlLoad object bound to the specified connection
Parameters:
  conn - the database connection
exception:
  Exception - may be thrown if there's a problem constructingthe XML parser.




Method Detail
characters
public void characters(char[] ch, int start, int length) throws SAXException(Code)
SAX parser callback to handle character data found in the parsed document.
Parameters:
  ch - the buffer containing the parsed characters.
Parameters:
  star - the buffer position of the first character
Parameters:
  length - the number of characters
exception:
  SAXException - may be thrown if this data representsa database value and there's a SQL exception thrown whiletrying to update the underlying resultset object with thisdata.



endDocument
public void endDocument()(Code)
SAX parser callback function that is called when the end of the document is reached. This implementation does nothing.



endElement
public void endElement(String name) throws SAXException(Code)
SAX parser callback function called for the end of an element. If this element represents the <database> element, we finish up by closing the active statement. If this element represents a table row element, we insert the current row. Otherwise, we do nothing.
Parameters:
  name - the name of this element
exception:
  SAXException - may be thrown to wrap any underlying databaseexception.



error
public void error(SAXParseException exception)(Code)
SAX parser callback to handle XML Parser errors. This implementation just prints them to System.err.
Parameters:
  exception - the exception generated by the parser.



fatalError
public void fatalError(SAXParseException exception)(Code)
SAX parser callback to handle XML Parser fatal errors. This implementation just prints them to System.err.
Parameters:
  exception - the exception generated by the parser.



getConnection
public Connection getConnection()(Code)
Get the loader's database connection the current database connection



ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length)(Code)
SAX parser callback for ignorable whitespace. We just ignore it
Parameters:
  ch - the buffer containing the parsed characters.
Parameters:
  star - the buffer position of the first character
Parameters:
  length - the number of characters



load
public void load(InputStream is) throws Exception(Code)
Load the XML document from the specified input stream, importing the data contained therein into the database referenced by the current connection. The input document should be a well-formed XML <database> document.
Parameters:
  is - the input stream containing the XML document.
exception:
  Exception - may be thrown if there's a parse error ora database error.



load
public void load(Reader r) throws Exception(Code)
Load the XML document from the specified reader, importing the data contained therein into the database referenced by the current connection. The input document should be a well-formed XML <database> document.
Parameters:
  r - the input reader containing the XML document.
exception:
  Exception - may be thrown if there's a parse error ora database error.



main
public static void main(String[] args)(Code)
A main program which supports the command-line invocation of either the Loader or XmlLoad functions. This function accepts one or more file names as arguments.

For each file name that ends with the ".sql" extension, the Loader.loadFile() method is invoked to execute the SQL commands in the file.

For each file name that ends with the ".xml" or ".xml.gz" extension, the XmlLoad.load() method is invoked to load the XML data from that file into the database.
Parameters:
  args - database-name file ...




makeBytes
byte[] makeBytes(String val)(Code)



makeException
public SAXException makeException(String s)(Code)



makeObject
Object makeObject(int jdbcType, String val) throws SAXException(Code)



printException
final static void printException(Throwable t)(Code)



processingInstruction
public void processingInstruction(String target, String data)(Code)
SAX parser callback for processing instructions. This implementation does nothing.
Parameters:
  target - the processing instruction target.
Parameters:
  data - the processing instruction data.



setConnection
public void setConnection(Connection conn) throws SQLException(Code)
Set the loader's database connection
Parameters:
  conn - the new database connection
exception:
  SQLException - may be thrown



setDocumentLocator
public void setDocumentLocator(Locator locator)(Code)
SAX parser callback used to receive a document locator.
Parameters:
  locator - the parser's locator object.



startDocument
public void startDocument()(Code)
SAX parser callback for document start. This implementation does nothing.



startElement
public void startElement(String name, AttributeList attrs) throws SAXException(Code)
SAX parser callback for the start of an element. If this element represents a table row, and the table is different from the last table seen, we establish an updatable ResultSet for the new table which can be used to insert new rows into the table. If this element represents a table row, we move to the insert row. If this element represents a column, we remember the column name.
Parameters:
  name - the element name
Parameters:
  attrs - the element's attributes
exception:
  SAXException - may be thrown to wrap an underlying databaseerror, or if there is a problem with the XML document itself.



warning
public void warning(SAXParseException exception)(Code)
SAX parser callback to handle XML Parser fatal errors. This implementation just prints them to System.err.
Parameters:
  exception - the exception generated by the parser.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.