Ik ben voor mezelf bezig met het doorwerken van een boek over XML. Ik heb nu een html pagina geschreven, welke gebruikt maakt van een XML bestand.
Het rare is nu dat dit bestand de XML data in geneste tables niet weergeeft, maar als ik deze tables gewoon onder elkaar zet, wordt deze data wel weergegeven...
Ik heb met google al naar andere voorbeelden gezocht, maar overal zie ik hetzelfde. Misschien dat ik iets heel doms mis, en dat iemand anders (die er nog niet al lange tijd naar heeft zitten staren) het misschien wel gelijk ziet.
Ik zal hieronder de code geven. Het gaat om de geneste tables voor de velden "Author" en "Publisher" in het XML bestand.
De code in het Book.xml bestand:
De code in mijn html bestand:
Ik hoop dat iemand het snel ziet, en alvast bedankt
Het rare is nu dat dit bestand de XML data in geneste tables niet weergeeft, maar als ik deze tables gewoon onder elkaar zet, wordt deze data wel weergegeven...
Ik heb met google al naar andere voorbeelden gezocht, maar overal zie ik hetzelfde. Misschien dat ik iets heel doms mis, en dat iemand anders (die er nog niet al lange tijd naar heeft zitten staren) het misschien wel gelijk ziet.
Ik zal hieronder de code geven. Het gaat om de geneste tables voor de velden "Author" en "Publisher" in het XML bestand.
De code in het Book.xml bestand:
XML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| <?xml version="1.0"?> <!-- Data component of instance of the catalog object that contains book objects --> <Book> <Title >Teach Yourself XML in 24 Hours</Title> <Author> <Name >Charles Ashbacher</Name> <Address >119 Northwood Drive</Address> <City >Hiawatha</City> <State >Iowa</State> <PostalCode >52233</PostalCode> <Country >United States</Country> <Phone >(319) 378-4646</Phone> <Email >ashbacher@ashbacher.com</Email> <URL >http://www.ashbacher.com</URL> </Author> <Publisher> <Name >Sams Publishing</Name> <Address >201 West 103rd Street</Address> <City >Indianapolis</City> <State >Indiana</State> <PostalCode >46290</PostalCode> <Country >United States</Country> <Phone >(111) 123-4567</Phone> <Editor >Dummy Name</Editor> <EmailContact >Dummy.Name@samspublishing.com</EmailContact> <URL >http://www.samspublishing.com</URL> </Publisher> <ISBN >0-672-31950-0</ISBN> <PublisherBookID >1234567</PublisherBookID> <PublicationDate >2000-04-01</PublicationDate> <Price >24.95</Price> </Book> |
De code in mijn html bestand:
HTML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
| <html> <head> <script type="text/javascript"> function startUp() { var xmlDso = xmldso.XMLDocument; xmlDso.load("book.xml"); } </script> </head> <body bgcolor="white" onLoad="startUp()"> <!--document body --> <object width="0" height="0" classid="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" id="xmldso"></object> <table id="Catalog" datasrc=#xmlDso border="1" cellspacing="2"> <tr> <td> <span style="font-size:18;font-weight:bold">Title </span> <span datafld="Title"></span> </td> </tr> <tr> <td> <table datasrc=#xmlDso datafld="Author" border="0" cellspacing="2"> <thead align=center> <th>Name</th> <th>Address</th> <th>City</th> <th>State</th> <th>Postal Code</th> <th>Country</th> <th>Phone</th> <th>Email</th> <th>URL</th> </thead> <tr> <td><span datafld="Name"> </span></td> <td><span datafld="Address"> </span></td> <td><span datafld="City"> </span></td> <td><span datafld="State"> </span></td> <td><span datafld="PostalCode"> </span></td> <td><span datafld="Country"> </span></td> <td><span datafld="Phone"> </span></td> <td><span datafld="Email"> </span></td> <td><span datafld="URL"> </span></td> </tr> </table> </td> </tr> <tr> <td> <table datasrc=#xmlDso datafld="Publisher" border="0" cellspacing="2"> <thead align=center> <th>Name</th> <th>Address</th> <th>City</th> <th>State</th> <th>Postal Code</th> <th>Country</th> <th>Phone</th> <th>Editor</th> <th>Email Contact</th> <th>URL</th> </thead> <tr> <td><span datafld="Name"> </span></td> <td><span datafld="Address"> </span></td> <td><span datafld="City"> </span></td> <td><span datafld="State"> </span></td> <td><span datafld="PostalCode"> </span></td> <td><span datafld="Country"> </span></td> <td><span datafld="Phone"> </span></td> <td><span datafld="Editor"> </span></td> <td><span datafld="EmailContact"> </span></td> <td><span datafld="URL"> </span></td> </tr> </table> </td> </tr> <tr> <td> <span style="font-size:18;font-weight:bold">ISBN: </span> <span datafld="ISBN"></span> </td> </tr> <tr> <td> <span style="font-size:18;font-weight:bold">Publisher Book ID: </span> <span datafld="PublisherBookID"></span> </td> </tr> <tr> <td> <span style="font-size:18;font-weight:bold">Publication Date: </span> <span datafld="PublicationDate"></span> </td> </tr> <tr> <td> <span style="font-size:18;font-weight:bold">Price: </span> <span datafld="Price"></span> </td> </tr> </table> </body> </html> |
Ik hoop dat iemand het snel ziet, en alvast bedankt