powered by simpleCommunicator - 2.0.53     © 2025 Programmizd 02
Форумы / FoxPro, Visual FoxPro [игнор отключен] [закрыт для гостей] / работа с XML
1 сообщений из 1, страница 1 из 1
работа с XML
    #36798027
vtanya
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Не могу сделать связанные файлы из XML.
Есть схема rsv1.xsd , элемент rsv1 содержит данные о элементах sprav,titul,section1,section2,
section3,section41,section42.
файл RSV101.xml и программа rsv11.prg.
По программе данные в эти таблицы заносятся хорошо, но я не могу их связать между собой, нет ключевого поля в родительском элементе
CREATE CURSOR rsv1_list(filename c(13),version c(5),dbeg c(12),dend c(12))
CREATE CURSOR sprav (N_kor n(3),Year n(4),Code_Period c(2),D_Deliv c(12),;
d_Calc c(12),OGRN n(15),okved c(8),Fam c(60),Im c(60),Ot c(60),;
Fullname memo)

CREATE cursor Section1 (s100_5 n(15,2),s100_6 n(15,2),s110_5 n(15,2),s110_6 n(15,2),s111_5 n(15,2),;
s111_6 n(15,2),s112_5 n(15,2),s112_6 n(15,2),s113_5 n(15,2),s113_6 n(15,2),;
s114_5 n(15,2),s114_6 n(15,2),s120_5 n(15,2),s120_6 n(15,2),s130_5 n(15,2),;
s130_6 n(15,2),s140_5 n(15,2),s140_6 n(15,2),s141_5 n(15,2),s141_6 n(15,2),;
s142_5 n(15,2),s142_6 n(15,2),s143_5 n(15,2),s143_6 n(15,2),s144_5 n(15,2),;
s144_6 n(15,2),s150_5 n(15,2),s150_6 n(15,2))

CREATE cursor Section2(s200_3 n(15,2),s200_4 n(15,2),s200_5 n(15,2),s200_6 n(15,2),s210_3 n(15,2),s210_4 n(15,2),;
s210_5 n(15,2),s210_6 n(15,2),s216_3 n(15,2),s216_4 n(15,2),s216_5 n(15,2),s216_6 n(15,2),;
s230_3 n(15,2),s230_4 n(15,2),s230_5 n(15,2),s230_6 n(15,2),s243_3 n(15,2),s243_4 n(15,2),;
s243_5 n(15,2),s243_6 n(15,2),s244_3 n(15,2),s244_4 n(15,2),s244_5 n(15,2),s244_6 n(15,2))

CREATE CURSOR Section3(s300_3 n(15,2),s300_4 n(15,2),s300_5 n(15,2),s300_6 n(15,2),;
s310_3 n(15,2),s310_4 n(15,2),s310_5 n(15,2),s310_6 n(15,2),s316_3 n(15,2),;
s316_4 n(15,2),s316_5 n(15,2),s316_6 n(15,2),s330_3 n(15,2),s330_4 n(15,2),;
s330_5 n(15,2),s330_6 n(15,2),s343_3 n(15,2),s343_4 n(15,2),s343_5 n(15,2),;
s343_6 n(15,2),s344_3 n(15,2),s344_4 n(15,2),s344_5 n(15,2),s344_6 n(15,2),;
s350_3 n(15,2),s350_4 n(15,2),s350_5 n(15,2),s350_6 n(15,2),s360_3 n(15,2),;
s360_4 n(15,2),s360_5 n(15,2),s360_6 n(15,2),s363_3 n(15,2),s363_4 n(15,2),;
s363_5 n(15,2),s363_6 n(15,2),s380_3 n(15,2),s380_4 n(15,2),s380_5 n(15,2),;
s380_6 n(15,2),s393_3 n(15,2),s393_4 n(15,2),s393_5 n(15,2),s393_6 n(15,2),;
s394_3 n(15,2),s394_4 n(15,2),s394_5 n(15,2),s394_6 n(15,2))

CREATE CURSOR invalid (num n(6),fio c(100),date_beg c(12),date_end c(12),;
total n(12,2),month1 n(12,2),month2 n(12,2),month3 n(12,2))

CREATE cursor Section42(s421_3 n(6),s421_4 n(6),s421_5 n(6),s421_6 n(6),;
s422_3 n(9,5),s422_4 n(9,5),s422_5 n(9,5),s422_6 n(9,5),s423_3 n(5,2),;
s423_4 n(5,2),s423_5 n(5,2),s423_6 n(5,2),s424_3 n(6),s424_4 n(6),;
s424_5 n(6),s424_6 n(6),s425_3 n(6),s425_4 n(6),s425_5 n(6),s425_6 n(6),;
s426_3 n(5,2),s426_4 n(5,2),s426_5 n(5,2),s426_6 n(5,2),s427_3 n(15,2),;
s427_4 n(15,2),s427_5 n(15,2),s427_6 n(15,2),s428_3 n(15,2),s428_4 n(15,2),;
s428_5 n(15,2),s428_6 n(15,2),s429_3 n(5,2),s429_4 n(5,2),s429_5 n(5,2),s429_6 n(5,2))
CREATE CURSOR titul(rns_OPFR c(12),Rns_TFOMS c(15),;
INN c(12),KPP c(9),;
Phone c(30),okato c(11),Okfs c(2),Okpo c(8),Okopf c(2),;
N_Insured n(6),N_Average n(6),Tariff_Code n(4))
CREATE CURSOR kateg (ogrn n(15),code n(4),name c(100))
CREATE CURSOR raion_opfr (ogrn n(15),code n(6),name c(60))


LOCAL loXA as XMLAdapter
LOCAL loField as XMLField
LOCAL loXMLtable as XMLTable

loXA = Createobject('XMLAdapter')

loXA.XMLSchemaLocation ="c:\rsv1.xsd"

loxa.LoadXML('c:\RSV101.xml', .T.,.T.)

loField = NEWOBJECT("XMLField")
loField.Alias = "ogrn"
loField.XMLName = STRCONV("parent::*/@ogrn", 5)
loField.XMLNameIsXPath = .T.
loField.MaxLength = 15
loField.DataType = "N"
loField = loXA.Tables(1).fields.Add(loField, loField.XMLName)

loField = NEWOBJECT("XMLField")
loField.Alias = "ogrn"
loField.XMLName = STRCONV("parent::*/@ogrn", 5)
loField.XMLNameIsXPath = .T.
loField.MaxLength = 15
loField.DataType = "N"
loField = loXA.Tables(2).fields.Add(loField, loField.XMLName)

LOCAL lnTable as Integer

FOR EACH loTable as XMLTable IN loXA.Tables
IF USED(loTable.Alias)
loTable.ToCursor(.T., loTable.Alias, 1251)
SELECT (loTable.Alias)

BROWSE

ENDIF
ENDFOR

<?xml version="1.0" encoding="WINDOWS-1251"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="rsv1_list">
<xs:complexType>
<xs:sequence>
<xs:element name="rsv1">
<xs:complexType>
<xs:sequence>
<xs:element name="sprav">
<xs:complexType>
<xs:sequence>
<xs:element name="kateg">
<xs:complexType>
<xs:attribute name="code" type="xs:string"/>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="raion_opfr">
<xs:complexType>
<xs:attribute name="code" type="xs:string"/>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="year" type="xs:string" use="required"/>
<xs:attribute name="code_period" type="xs:integer"/>
<xs:attribute name="d_deliv" type="xs:string"/>
<xs:attribute name="d_calc" type="xs:string"/>
<xs:attribute name="ogrn" type="xs:integer"/>
<xs:attribute name="okved" type="xs:string"/>
<xs:attribute name="fullname" type="xs:string"/>
<xs:attribute name="n_kor" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="titul">
<xs:complexType>
<xs:attribute name="rns_opfr" type="xs:integer"/>
<xs:attribute name="rns_tfoms" type="xs:integer"/>
<xs:attribute name="inn" type="xs:integer"/>
<xs:attribute name="kpp" type="xs:integer"/>
<xs:attribute name="phone" type="xs:string"/>
<xs:attribute name="okato" type="xs:integer"/>
<xs:attribute name="okpo" type="xs:integer"/>
<xs:attribute name="okopf" type="xs:integer"/>
<xs:attribute name="okfs" type="xs:integer"/>
<xs:attribute name="n_insured" type="xs:integer"/>
<xs:attribute name="n_average" type="xs:integer"/>
<xs:attribute name="tariff_code" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="section1">
<xs:complexType>
<xs:attribute name="s100_5" type="xs:string"/>
<xs:attribute name="s100_6" type="xs:string"/>
<xs:attribute name="s110_5" type="xs:string"/>
<xs:attribute name="s110_6" type="xs:string"/>
<xs:attribute name="s111_5" type="xs:string"/>
<xs:attribute name="s111_6" type="xs:string"/>
<xs:attribute name="s112_5" type="xs:string"/>
<xs:attribute name="s112_6" type="xs:string"/>
<xs:attribute name="s113_5" type="xs:string"/>
<xs:attribute name="s113_6" type="xs:string"/>
<xs:attribute name="s114_5" type="xs:string"/>
<xs:attribute name="s114_6" type="xs:string"/>
<xs:attribute name="s120_5" type="xs:string"/>
<xs:attribute name="s120_6" type="xs:string"/>
<xs:attribute name="s130_5" type="xs:string"/>
<xs:attribute name="s130_6" type="xs:string"/>
<xs:attribute name="s140_5" type="xs:string"/>
<xs:attribute name="s140_6" type="xs:string"/>
<xs:attribute name="s141_5" type="xs:string"/>
<xs:attribute name="s141_6" type="xs:string"/>
<xs:attribute name="s142_5" type="xs:string"/>
<xs:attribute name="s142_6" type="xs:string"/>
<xs:attribute name="s143_5" type="xs:string"/>
<xs:attribute name="s143_6" type="xs:string"/>
<xs:attribute name="s144_5" type="xs:string"/>
<xs:attribute name="s144_6" type="xs:string"/>
<xs:attribute name="s150_5" type="xs:string"/>
<xs:attribute name="s150_6" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="section2">
<xs:complexType>
<xs:attribute name="s200_3" type="xs:string"/>
<xs:attribute name="s200_4" type="xs:string"/>
<xs:attribute name="s200_5" type="xs:string"/>
<xs:attribute name="s200_6" type="xs:string"/>
<xs:attribute name="s210_3" type="xs:string"/>
<xs:attribute name="s210_4" type="xs:string"/>
<xs:attribute name="s210_5" type="xs:string"/>
<xs:attribute name="s210_6" type="xs:string"/>
<xs:attribute name="s216_3" type="xs:string"/>
<xs:attribute name="s216_4" type="xs:string"/>
<xs:attribute name="s216_5" type="xs:string"/>
<xs:attribute name="s216_6" type="xs:string"/>
<xs:attribute name="s230_3" type="xs:string"/>
<xs:attribute name="s230_4" type="xs:string"/>
<xs:attribute name="s230_5" type="xs:string"/>
<xs:attribute name="s230_6" type="xs:string"/>
<xs:attribute name="s243_3" type="xs:string"/>
<xs:attribute name="s243_4" type="xs:string"/>
<xs:attribute name="s243_5" type="xs:string"/>
<xs:attribute name="s243_6" type="xs:string"/>
<xs:attribute name="s244_3" type="xs:string"/>
<xs:attribute name="s244_4" type="xs:string"/>
<xs:attribute name="s244_5" type="xs:string"/>
<xs:attribute name="s244_6" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="section3">
<xs:complexType>
<xs:attribute name="s300_3" type="xs:string"/>
<xs:attribute name="s300_4" type="xs:string"/>
<xs:attribute name="s300_5" type="xs:string"/>
<xs:attribute name="s300_6" type="xs:string"/>
<xs:attribute name="s310_3" type="xs:string"/>
<xs:attribute name="s310_4" type="xs:string"/>
<xs:attribute name="s310_5" type="xs:string"/>
<xs:attribute name="s310_6" type="xs:string"/>
<xs:attribute name="s316_3" type="xs:string"/>
<xs:attribute name="s316_4" type="xs:string"/>
<xs:attribute name="s316_5" type="xs:string"/>
<xs:attribute name="s316_6" type="xs:string"/>
<xs:attribute name="s330_3" type="xs:string"/>
<xs:attribute name="s330_4" type="xs:string"/>
<xs:attribute name="s330_5" type="xs:string"/>
<xs:attribute name="s330_6" type="xs:string"/>
<xs:attribute name="s343_3" type="xs:string"/>
<xs:attribute name="s343_4" type="xs:string"/>
<xs:attribute name="s343_5" type="xs:string"/>
<xs:attribute name="s343_6" type="xs:string"/>
<xs:attribute name="s344_3" type="xs:string"/>
<xs:attribute name="s344_4" type="xs:string"/>
<xs:attribute name="s344_5" type="xs:string"/>
<xs:attribute name="s344_6" type="xs:string"/>
<xs:attribute name="s350_3" type="xs:string"/>
<xs:attribute name="s350_4" type="xs:string"/>
<xs:attribute name="s350_5" type="xs:string"/>
<xs:attribute name="s350_6" type="xs:string"/>
<xs:attribute name="s360_3" type="xs:string"/>
<xs:attribute name="s360_4" type="xs:string"/>
<xs:attribute name="s360_5" type="xs:string"/>
<xs:attribute name="s360_6" type="xs:string"/>
<xs:attribute name="s363_3" type="xs:string"/>
<xs:attribute name="s363_4" type="xs:string"/>
<xs:attribute name="s363_5" type="xs:string"/>
<xs:attribute name="s363_6" type="xs:string"/>
<xs:attribute name="s380_3" type="xs:string"/>
<xs:attribute name="s380_4" type="xs:string"/>
<xs:attribute name="s380_5" type="xs:string"/>
<xs:attribute name="s380_6" type="xs:string"/>
<xs:attribute name="s393_3" type="xs:string"/>
<xs:attribute name="s393_4" type="xs:string"/>
<xs:attribute name="s393_5" type="xs:string"/>
<xs:attribute name="s393_6" type="xs:string"/>
<xs:attribute name="s394_3" type="xs:string"/>
<xs:attribute name="s394_4" type="xs:string"/>
<xs:attribute name="s394_5" type="xs:string"/>
<xs:attribute name="s394_6" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="section41">
<xs:complexType>
<xs:sequence>
<xs:element name="invalid">
<xs:complexType>
<xs:attribute name="num" type="xs:integer"/>
<xs:attribute name="fio" type="xs:string"/>
<xs:attribute name="date_beg" type="xs:string"/>
<xs:attribute name="date_end" type="xs:string"/>
<xs:attribute name="total" type="xs:string"/>
<xs:attribute name="month1" type="xs:string"/>
<xs:attribute name="month2" type="xs:string"/>
<xs:attribute name="month3" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="section42">
<xs:complexType>
<xs:attribute name="s421_3" type="xs:string"/>
<xs:attribute name="s421_4" type="xs:string"/>
<xs:attribute name="s421_5" type="xs:string"/>
<xs:attribute name="s421_6" type="xs:string"/>
<xs:attribute name="s422_3" type="xs:string"/>
<xs:attribute name="s422_4" type="xs:string"/>
<xs:attribute name="s422_5" type="xs:string"/>
<xs:attribute name="s422_6" type="xs:string"/>
<xs:attribute name="s423_3" type="xs:string"/>
<xs:attribute name="s423_4" type="xs:string"/>
<xs:attribute name="s423_5" type="xs:string"/>
<xs:attribute name="s423_6" type="xs:string"/>
<xs:attribute name="s424_3" type="xs:string"/>
<xs:attribute name="s424_4" type="xs:string"/>
<xs:attribute name="s424_5" type="xs:string"/>
<xs:attribute name="s424_6" type="xs:string"/>
<xs:attribute name="s425_3" type="xs:string"/>
<xs:attribute name="s425_4" type="xs:string"/>
<xs:attribute name="s425_5" type="xs:string"/>
<xs:attribute name="s425_6" type="xs:string"/>
<xs:attribute name="s426_3" type="xs:string"/>
<xs:attribute name="s426_4" type="xs:string"/>
<xs:attribute name="s426_5" type="xs:string"/>
<xs:attribute name="s426_6" type="xs:string"/>
<xs:attribute name="s427_3" type="xs:string"/>
<xs:attribute name="s427_4" type="xs:string"/>
<xs:attribute name="s427_5" type="xs:string"/>
<xs:attribute name="s427_6" type="xs:string"/>
<xs:attribute name="s428_3" type="xs:string"/>
<xs:attribute name="s428_4" type="xs:string"/>
<xs:attribute name="s428_5" type="xs:string"/>
<xs:attribute name="s428_6" type="xs:string"/>
<xs:attribute name="s429_3" type="xs:string"/>
<xs:attribute name="s429_4" type="xs:string"/>
<xs:attribute name="s429_5" type="xs:string"/>
<xs:attribute name="s429_6" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="filename" type="xs:string" use="required" />
<xs:attribute name="version" type="xs:string" />
<xs:attribute name="dbeg" type="xs:string" />
<xs:attribute name="dend" type="xs:string" />
<xs:attribute name="region_pfr" type="xs:integer" />
</xs:complexType>
</xs:element>
</xs:schema>
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / FoxPro, Visual FoxPro [игнор отключен] [закрыт для гостей] / работа с XML
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]