Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLField question
Message
From
29/09/2006 15:09:08
 
 
To
29/09/2006 14:39:31
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01158009
Message ID:
01158258
Views:
31
Thank you very much, Aleksey, that's something I never would have thought of ...

By the way, googling "self::node" I found that using "." seems to be an equivalent, and it works in my case at least.

In any case, thank you very much

>
>CLEAR
>CLOSE DATABASES all
>
>TEXT TO cXML1 NOSHOW
><?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
><Total>
>     <Line type="Subtotal" name="Subtotal">229.99</Line>
>     <Line type="Coupon" name="Coupon discount (fallshow)">-23.00</Line>
>     <Line type="Subtotal" name="Subtotal">206.99</Line>
>     <Line type="Shipping" name="Shipping">29.14</Line>
>     <Line type="Tax" name="Tax">0.00</Line>
>     <Line type="Total" name="Total">236.13</Line>
></Total>
>ENDTEXT
>
>oTable = SetupXMLTable( "Line", "Line")
>AddXMLField( oTable, "self::node()", "line", "C",  40)
>AddXMLField( oTable, "@name", "_name", "C",  40)
>AddXMLField( oTable, "@type", "_type", "C",  10)
>
>LOCAL oXA as XMLAdapter
>oXA = CREATEOBJECT("XMLAdapter")
>
>oXA.LoadXML(cXML1)
>oXA.Tables.Add(oTable, oTable.XMLName)
>
>oTable.ToCursor()
>SELECT Line
>LIST
>
>Procedure SetupXMLTable( lcName, lcAlias)
>	Local oTable
>	oTable = Createobject("XMLTable")
>	* all XMLName properties must be Unicode
>	oTable.XMLName = Strconv(lcName, 5)
>	oTable.XMLNameIsXpath = .T.
>	* the cursor's alias
>	oTable.Alias = lcAlias
>	If Used(lcAlias)
>		Use In (lcAlias)
>	Endif
>	Return oTable
>Endproc
>
>Procedure AddXMLField( oTable, lcXMLName, lcAlias, lcDataType, lnMaxLength, lnFractionDigits)
>	Local oField
>	oField = Createobject("XMLField")
>
>	oField.XMLName = Strconv( lcXMLName, 5)
>	oField.XMLNameIsXpath = .T.
>	oField.Alias = Evl( lcAlias, lcXMLName)
>	oField.DataType = lcDataType
>	oField.MaxLength = lnMaxLength
>	If Not Empty( lnFractionDigits)
>		oField.FractionDigits =  lnFractionDigits
>	Endif
>
>	oTable.Fields.Add(oField, oField.XMLName)
>	Return oTable
>Endproc
>
>
>Thanks,
>Aleksey.
Jim Nelson
Newbury Park, CA
Previous
Reply
Map
View

Click here to load this message in the networking platform