<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki2.sitebuilt.net/index.php?action=history&amp;feed=atom&amp;title=Xml</id>
	<title>Xml - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki2.sitebuilt.net/index.php?action=history&amp;feed=atom&amp;title=Xml"/>
	<link rel="alternate" type="text/html" href="https://wiki2.sitebuilt.net/index.php?title=Xml&amp;action=history"/>
	<updated>2026-05-06T15:04:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>https://wiki2.sitebuilt.net/index.php?title=Xml&amp;diff=5989&amp;oldid=prev</id>
		<title>Tim: Created page with &quot;==xml and db== http://www.rpbourret.com/xml/XMLAndDatabases.htm  What techniques have you tried already? With java, there are 2 main ways of reading XML documents:  1. DOM - D...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki2.sitebuilt.net/index.php?title=Xml&amp;diff=5989&amp;oldid=prev"/>
		<updated>2013-01-17T15:25:33Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==xml and db== http://www.rpbourret.com/xml/XMLAndDatabases.htm  What techniques have you tried already? With java, there are 2 main ways of reading XML documents:  1. DOM - D...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==xml and db==&lt;br /&gt;
http://www.rpbourret.com/xml/XMLAndDatabases.htm&lt;br /&gt;
&lt;br /&gt;
What techniques have you tried already? With java, there are 2 main ways of reading XML documents:&lt;br /&gt;
&lt;br /&gt;
1. DOM - Document Object Model interface. This loads the XML document into main memory. With the Document Object Model, you can build documents, navigate their structure, and add, modify, or delete elements and content. Basically the DOM specifies an abstract datatype for XML logical structure. In Java the API for this is known as JAXP&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/j2se/1.5.0/docs/...e-summary.html&lt;br /&gt;
&lt;br /&gt;
An example of reading in a doc could be:&lt;br /&gt;
&lt;br /&gt;
Expand|Select|Wrap|Line Numbers&lt;br /&gt;
&lt;br /&gt;
   1. public void readDoc() {&lt;br /&gt;
   2.   try {&lt;br /&gt;
   3.  &lt;br /&gt;
   4.    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();&lt;br /&gt;
   5.    DocumentBuilder builder = factory.newDocumentBuilder();&lt;br /&gt;
   6.    doc = builder.parse( new File(&amp;quot;myXMLFile.xml&amp;quot;) );&lt;br /&gt;
   7.  &lt;br /&gt;
   8.   }&lt;br /&gt;
   9.   catch (FactoryConfigurationError fce){&lt;br /&gt;
  10.     System.err.println(&amp;quot;Could not create DocumentBuilderFactory&amp;quot;);&lt;br /&gt;
  11.   }&lt;br /&gt;
  12.   catch (ParserConfigurationException pce) { &lt;br /&gt;
  13.     System.out.println(&amp;quot;Could not locate a JAXP parser&amp;quot;); &lt;br /&gt;
  14.   }&lt;br /&gt;
  15.   catch (SAXException se) {&lt;br /&gt;
  16.     System.out.println(&amp;quot;XML file is not well-formed.&amp;quot;);&lt;br /&gt;
  17.   }&lt;br /&gt;
  18.   catch (IOException ioe) { &lt;br /&gt;
  19.     System.out.println(&lt;br /&gt;
  20.     &amp;quot;Due to an IOException, the parser could not read the XML file&amp;quot;&lt;br /&gt;
  21.     ); &lt;br /&gt;
  22.   }&lt;br /&gt;
  23. }&lt;br /&gt;
  24.  &lt;br /&gt;
&lt;br /&gt;
doc is the object which holds the xml document in.&lt;br /&gt;
&lt;br /&gt;
obviously you'd need to import all relevant packages etc.&lt;br /&gt;
&lt;br /&gt;
Expand|Select|Wrap|Line Numbers&lt;br /&gt;
&lt;br /&gt;
   1.  &lt;br /&gt;
   2. import javax.xml.parsers.DocumentBuilder;&lt;br /&gt;
   3. import javax.xml.parsers.DocumentBuilderFactory;&lt;br /&gt;
   4. import javax.xml.parsers.FactoryConfigurationError;&lt;br /&gt;
   5. import javax.xml.parsers.ParserConfigurationException;&lt;br /&gt;
   6.  &lt;br /&gt;
   7. import org.xml.sax.SAXException;&lt;br /&gt;
   8. import org.xml.sax.SAXParseException;&lt;br /&gt;
   9.  &lt;br /&gt;
  10. import java.io.File;&lt;br /&gt;
  11. import java.io.IOException;&lt;br /&gt;
  12.  &lt;br /&gt;
  13. import org.w3c.dom.*;&lt;br /&gt;
  14.  &lt;br /&gt;
  15.  &lt;br /&gt;
&lt;br /&gt;
2. The second way in java is to use the SAXP API, which doesn't load the XML file into memory. This is quicker than JAXP, and is useful when you know the structure of the xml file isn't going to change etc.&lt;br /&gt;
&lt;br /&gt;
http://java.sun.com/j2se/1.5.0/docs/...SAXParser.html&lt;br /&gt;
&lt;br /&gt;
Finally, to send it to mySQL, you need to open a connection String to the mySQL database, and then run whatever queries you want. You can use a system ODBC driver, or Sun's own JDBC driver if you haven't got the first one.&lt;br /&gt;
&lt;br /&gt;
This isn't comprehensive, but should give you enough to start.....&lt;br /&gt;
&lt;br /&gt;
mharrison&lt;br /&gt;
Reply&lt;/div&gt;</summary>
		<author><name>Tim</name></author>
	</entry>
</feed>