Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: XML, XSD, PHP - baza danych na 1000 rekordów
Forum PHP.pl > Forum > Przedszkole
the_ring
Witam
Sprawa polega na tym, że mam do przerobienia bazę danych wykonaną przez MS Access. MS Access generuje dwa pliki: XML oraz XSD. Próbki zamieszczam poniżej.
Pytanie jest takie: Jak do tego podejść? Jestem początkujący, ale nie oczekuję gotowego rozwiązania. Chciałbym się dowiedzieć jakich narzędzi do tego użyć: nazwy funkcji - dalej sobie poradzę (manual). Mile widziane ewentualne wskazówki. Dysponuję serwerem z php 4.1.2 z włączoną obsługą XML (XML Support: active; XML Namespace Support: active; EXPAT Version: expat_1.95.2). Brak dostępu do innej konfiguracji serwera.

Literature.xml
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="Literature.xsd">
  3. <Literature>
  4. <Index>14</Index>
  5. <Author1>Ong S.K.</Author1>
  6. <Author2>Mannan M.A.</Author2>
  7. <Title>Virtual reality simulations and animations in a web-based interactive manufacturing engineering module</Title>
  8. <ClasA>92</ClasA>
  9. <ClasB>200</ClasB>
  10. <Type>A</Type>
  11. <Journal><![CDATA[Computers & Education 43 (2004) 361–382]]></Journal>
  12. <Abstract>This paper presents a web-based interactive teaching package that provides a comprehensive and conducive
  13. yet dynamic and interactive environment for a module on automated machine tools in the Manufacturing
  14. Division at the National University of Singapore. The use of Internet technologies in this teaching
  15. tool makes it possible to conjure visualisations that cannot be achieved using traditional teaching materials
  16. such as transparencies. Virtual reality simulations and animations were developed and appropriately placed
  17. in the teaching materials to enhance the student understanding of complex concepts. This is especially
  18. useful in teaching automated machine tools, which deals primarily with the numerical control (NC) of the
  19. motions of automated machine tools. These virtual reality simulations and animations provide the capability
  20. of training students in NC programming and operations without the need to work on actual NC
  21. machines in the laboratory. The simulations are suitably placed in the package to engage the students and
  22. enhance their concentration, while at the same time generate interactions. Customised question types were
  23. also designed and implemented with a tutorial monitoring application.</Abstract>
  24. <Nota>university learning</Nota>
  25. <Source>04081812585902236.pdf</Source>
  26. </Literature>


Literature.xsd
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
  3. <xsd:element name="dataroot">
  4. <xsd:complexType>
  5. <xsd:choice maxOccurs="unbounded">
  6. <xsd:element ref="Literature"/>
  7. </xsd:choice>
  8. </xsd:complexType>
  9. </xsd:element>
  10. <xsd:element name="Literature">
  11. <xsd:annotation>
  12. <xsd:appinfo>
  13. <od:index index-name="PrimaryKey" index-key="Index " primary="yes" unique="yes" clustered="no"/>
  14. <od:index index-name="PanelLiterature" index-key="ClasB " primary="no" unique="no" clustered="no"/>
  15. <od:index index-name="PanelLiterature1" index-key="ClasA " primary="no" unique="no" clustered="no"/>
  16. <od:index index-name="TypeLiterature" index-key="Type " primary="no" unique="no" clustered="no"/>
  17. </xsd:appinfo>
  18. </xsd:annotation>
  19. <xsd:complexType>
  20. <xsd:sequence>
  21. <xsd:element name="Index" od:jetType="autonumber" od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes">
  22. <xsd:simpleType>
  23. <xsd:restriction base="xsd:integer"/>
  24. </xsd:simpleType>
  25. </xsd:element>
  26. <xsd:element name="Author1" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  27. <xsd:simpleType>
  28. <xsd:restriction base="xsd:string">
  29. <xsd:maxLength value="50"/>
  30. </xsd:restriction>
  31. </xsd:simpleType>
  32. </xsd:element>
  33. <xsd:element name="Author2" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  34. <xsd:simpleType>
  35. <xsd:restriction base="xsd:string">
  36. <xsd:maxLength value="50"/>
  37. </xsd:restriction>
  38. </xsd:simpleType>
  39. </xsd:element>
  40. <xsd:element name="Author3" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  41. <xsd:simpleType>
  42. <xsd:restriction base="xsd:string">
  43. <xsd:maxLength value="50"/>
  44. </xsd:restriction>
  45. </xsd:simpleType>
  46. </xsd:element>
  47. <xsd:element name="Author4" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  48. <xsd:simpleType>
  49. <xsd:restriction base="xsd:string">
  50. <xsd:maxLength value="50"/>
  51. </xsd:restriction>
  52. </xsd:simpleType>
  53. </xsd:element>
  54. <xsd:element name="Author5" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  55. <xsd:simpleType>
  56. <xsd:restriction base="xsd:string">
  57. <xsd:maxLength value="50"/>
  58. </xsd:restriction>
  59. </xsd:simpleType>
  60. </xsd:element>
  61. <xsd:element name="Title" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  62. <xsd:simpleType>
  63. <xsd:restriction base="xsd:string">
  64. <xsd:maxLength value="255"/>
  65. </xsd:restriction>
  66. </xsd:simpleType>
  67. </xsd:element>
  68. <xsd:element name="ClasA" minOccurs="0" od:jetType="longinteger" od:sqlSType="int">
  69. <xsd:simpleType>
  70. <xsd:restriction base="xsd:integer"/>
  71. </xsd:simpleType>
  72. </xsd:element>
  73. <xsd:element name="ClasB" minOccurs="0" od:jetType="longinteger" od:sqlSType="int">
  74. <xsd:simpleType>
  75. <xsd:restriction base="xsd:integer"/>
  76. </xsd:simpleType>
  77. </xsd:element>
  78. <xsd:element name="Type" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  79. <xsd:simpleType>
  80. <xsd:restriction base="xsd:string">
  81. <xsd:maxLength value="50"/>
  82. </xsd:restriction>
  83. </xsd:simpleType>
  84. </xsd:element>
  85. <xsd:element name="Journal" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  86. <xsd:simpleType>
  87. <xsd:restriction base="xsd:string">
  88. <xsd:maxLength value="100"/>
  89. </xsd:restriction>
  90. </xsd:simpleType>
  91. </xsd:element>
  92. <xsd:element name="Abstract" minOccurs="0" od:jetType="memo" od:sqlSType="ntext">
  93. <xsd:simpleType>
  94. <xsd:restriction base="xsd:string">
  95. <xsd:maxLength value="536870910"/>
  96. </xsd:restriction>
  97. </xsd:simpleType>
  98. </xsd:element>
  99. <xsd:element name="Keywords" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  100. <xsd:simpleType>
  101. <xsd:restriction base="xsd:string">
  102. <xsd:maxLength value="255"/>
  103. </xsd:restriction>
  104. </xsd:simpleType>
  105. </xsd:element>
  106. <xsd:element name="Nota" minOccurs="0" od:jetType="memo" od:sqlSType="ntext">
  107. <xsd:simpleType>
  108. <xsd:restriction base="xsd:string">
  109. <xsd:maxLength value="536870910"/>
  110. </xsd:restriction>
  111. </xsd:simpleType>
  112. </xsd:element>
  113. <xsd:element name="Source" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
  114. <xsd:simpleType>
  115. <xsd:restriction base="xsd:string">
  116. <xsd:maxLength value="100"/>
  117. </xsd:restriction>
  118. </xsd:simpleType>
  119. </xsd:element>
  120. </xsd:sequence>
  121. </xsd:complexType>
  122. </xsd:element>
  123. </xsd:schema>


Pozdrawiam.
orson
witam ...

a nie prosciej w php polaczyc sie z baza przez ODBC i pobrac dane do array i przeslac odrazu do ...... [nie podales gdzie to chcesz miec]

pozdrawiam
the_ring
Cytat(orson @ 2005-02-24 12:38:22)
witam ...

a nie prosciej w php polaczyc sie z baza przez ODBC i pobrac dane do array i przeslac odrazu do ...... [nie podales gdzie to chcesz miec]

pozdrawiam

hmm... W takim razie jak się połączyć z tą bazą w php przez ODBC? Przypominam, że ja się chcę połączyć z XML-em, a nie z SQL-em. Czy z XML-em da się połączyć tak jak z SQL-em? Wydawać komendy SELECT lub temu podobne? Jeżeli tak, to w jaki sposób?
A z tego XML-a przesłać chcę do HTML-a. Jeszcze do tego chcę zrobić wyszukiwarkę: Tytułu, Autorów, itp.

Pozdrawiam.
orson
witam ...

nie bardzo znam sie na accessie ale te xml to chyba wynik exportu z accesssa questionmark.gif mnie chodzilo o to ze jak masz baze to mozesz zarejstrowac ja jako zrodlo danych odbc i potem polaczyc sie przez php i pobrac dane ... a jak nie to poguglaj ... np:
http://www.databasejournal.com/sqletc/article.php/3095621
http://www.softpedia.com/get/Programming/P...ta-Wizard.shtml
http://www.phpbuilder.com/columns/kenlin20031229.php3
i inne ...

pozdrawiam
the_ring
Tak, te XML to wynik eksportu z Accessa. Nie, nie mogę zarejestrować bazy jako źródło ODBC.
Cały myk polega na tym, że mam tylko te XML (oraz XSD), php 4.1.2 i nic więcej. Nie ma mowy o importowaniu do MySQL-a. Wszystkie operacje mają być wykonywane na plikach. Wiem, że nie jest to zbyt dobre rozwiązanie, ale nie ode mnie to zależy. Podałeś linki do sposobów na importowanie danych z XML-a do MySQL-a, a ja, jak wyżej napisałem, nie mam dostępu do MySQL ani do żadnej innej bazy danych.

Czy php (4.1.2) nie ma żadnych funkcji do zaawansowanej obsługi XML?

Pozdrawiam.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.