Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLAdapter
Message
From
10/09/2018 02:55:32
 
 
To
09/09/2018 18:12:02
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01661917
Message ID:
01661922
Views:
58
Luís,

You may remove the unwanted columns from the Fields collection of the respective item in the Tables collection. They won't be generated by ToXML().


>Hello Community,
>
>I build 3 cursors for one Invoice document from my sql server database, like this:
>
>
>Local msel as string
>store '' to msel
>
>
>Text to msel textmerge noshow pretext 7
>	select ftstamp,fdata,nmdoc, fno from ft where ftstamp = ?ft.ftstamp
>Endtext
>u_sqlexec(msel,[Documento])
>
>
>Text to msel textmerge noshow pretext 7
>	select fno,ref,design, qtt, epv
>        from fi where ftstamp = ?ft.ftstamp
>	Order by lordem asc
>Endtext
>u_sqlexec(msel,[Linhas])
>
>Text to msel textmerge noshow pretext 7
>	select fno, tabiva, iva 
>         from fi where ftstamp = ?ft.ftstamp
>	 and fi.fno = ?Linhas.fno
>	Order by lordem asc
>Endtext
>u_sqlexec(msel,[TaxasIVA])
>
>
>
>SELECT LINHAS
>INDEX ON fno TAG LINHAS
>SELECT TaxasIVA
>INDEX ON fno TAG TaxasIVA
>select DOCUMENTO
>SET RELATION TO fno INTO LINHAS
>SET RELATION TO fno INTO TaxasIVA in 'LINHAS' ADDITIVE 
>
>
>LOCAL oAdapter as XMLAdapter
>oAdapter = CREATEOBJECT('xmlAdapter')
>oAdapter.RespectNesting = .t.
>oAdapter.XMLName=STRCONV("VFPDATASET",12) && default "VFPDataSet"
>oAdapter.AddTableSchema('Documento')
>oAdapter.AddTableSchema('Linhas')
>oAdapter.AddTableSchema('TaxasIVA')
>
>
>lcXMLFileName = sys(2015)+'.xml'
>lcXSDFileName = forceext(m.lcXMLFileName,'xsd')
>
>* Uncomment to write schema separately to an external file
>oAdapter.XMLSchemaLocation = m.lcXSDFileName
>oAdapter.ToXML(m.lcXMLFileName,'',.T.) && to file
>*oAdapter.ToXML('cXMLSampleData','',.f.) && to memvar
>
>* Check what is generated
>modi comm (m.lcXMLFileName)
>modi comm (m.lcXSDFileName)
>*erase (juststem(m.lcXMLFileName)+'.*')
>
>
>
>
>
>
>But, i need to remove Field FNO on Chield nodes [ Linhas] and [TaxasIva], because is already exist in [DOCUMENTO] and this command will go only process 1 document each time.
>I think the problem is because i need this field [ FNO ] when i build SET RELATION to join my cursors.
>
>Is it possible to remove the same ?? and how ??
>
>Example of my XML file:
>
>
><?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
><VFPDATASET xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\PHC23\_5AI1D8LPP.xsd">
>	<Documento>
>		<ftstamp>ADM18090382517,515788064</ftstamp>
>		<fdata>2018-09-03T00:00:00</fdata>
>		<nmdoc>Fatura Recibo</nmdoc>
>		<fno>11</fno>
>		<Linhas>
>			<fno>11</fno> && need to remove here
>			<ref>C001</ref>
>			<design>Caixa e tamboril</design>
>			<qtt>1.000</qtt>
>			<epv>100.000000</epv>
>			<lordem>10000</lordem>
>			<TaxasIVA>
>				<fno>11</fno>  && need to remove here
>				<tabiva>4</tabiva>
>				<iva>.00</iva>
>			</TaxasIVA>
>		</Linhas>
>		<Linhas>
>			<fno>11</fno> && need to remove here
>			<ref>TAXFREE</ref>
>			<design>TAXFREE</design>
>			<qtt>1.000</qtt>
>			<epv>23.000000</epv>
>			<lordem>20000</lordem>
>			<TaxasIVA>
>				<fno>11</fno> && need to remove here
>				<tabiva>4</tabiva>
>				<iva>.00</iva>
>			</TaxasIVA>
>		</Linhas>
>	</Documento>
></VFPDATASET>
>
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform