Presentation is loading. Please wait.

Presentation is loading. Please wait.

When I opened the XML (note elements only in a DTD), I selected as an XML list and I got the following. This was customer3a.xml and note it said it was.

Similar presentations


Presentation on theme: "When I opened the XML (note elements only in a DTD), I selected as an XML list and I got the following. This was customer3a.xml and note it said it was."— Presentation transcript:

1 When I opened the XML (note elements only in a DTD), I selected as an XML list and I got the following. This was customer3a.xml and note it said it was creating a schema. The key thing here is to pick the type XML and then open an XML file. It will tell you that it is creating a schema for you and then proceed to open the file. Note that it can be used for calculations and other things you do with a spreadsheet. Check my reference material at the site..

2 DTD; This code is written in PHP. The goal is to read a table in MySQL and convert it to XML. This could be written in any language, I am interested in you understanding what is happening more than the language (for you who have had PHP, take a harder look at the language). I kept working with it. Here I select all the fields from the donor table and count the fields field names. the XML I create. When I get to the columns, I am going to carry the column name and the data for each column in the original table.

3

4 </col_def> The next part of the code lays out the database that you see here and on the next slide. <!ELEMENT cdefextra (#PCDATA)>

5 </table_def>

6 $xml_output .= "\t\t</table_def>\n";
Note the \t which tabs in to get the layout indented.

7 </row> <!ELEMENT colvalue (#PCDATA)>

8 ?> record. This is replacing things like > with $gt; - I copied this from a source -- probably MySQL site. Just notice that < is not replaced by $lt; - hmmm... The XML is created and printed to the browser.

9 ?> There are three functions one that deals with the start tag, one that deals with the data and one that deals with the end tag. Here I instantiate a parse object and set the element handler of the parser; When it hits a start tag it should execute startElement and an end tag should execute endElement. The next line sets the data handler so when you run into data you execute the function element data. While there is data parse the data using $xml_parser which you instantiated. Release the object It does the open and then dies if not opened or it does the parsing and dies if it can't parse.

10 Note in the begin I did nothing because in fact when you hit the begin tag you do not have anything to work with. However, when you hit the end tag, you can gather some information. break; when you reach the closing tag on something. When you reach the end tag on the dbname, you can execute the code to create the database.

11 break; For example when row is closed you can go through the columns and prepare an insert.

12 break; In elementData you are collecting the data so that when you are ready to process because of an end tag, you will have the data you need.


Download ppt "When I opened the XML (note elements only in a DTD), I selected as an XML list and I got the following. This was customer3a.xml and note it said it was."

Similar presentations


Ads by Google