Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
XML: Using SV XML to navigate through XML 2005-01-11 -- Tony Bowes Newsgroups: softvelocity.clarion.language
> >Try using the templates to import to a Queue instead. Just set up the
queue
> >to be the same file structure as your eventual file, then import into the
> >queue, then process the queue to check whether or not you want it in your
> >proper file. You can hack up the templates to read the data straight from
> >the DOM, but personally I think it's a waste of time.
>
> I would so much more like to have a real interface to this with a
> class so you could actually use it. Methods with a Next() option so
> you could do this like a file access. Oh, well:(
>
You can navigate your way through the document using the XMLnavigate wrapper
directly, although you will still need to hand-hold the exchange object to
actually do any work importing or exporting to the document. Here's a code
snippet that might help show a simple loop through the nodes of a DOM:
cImpXMLNavigator &= cImpExch.getNavigator()
cImpXMLNavigator.goToRoot()
bImpXmlRet = cImpXMLNavigator.goToFirstChild()
Loop
If bImpXmlRet <> CPXMLErr:NoError
Break
End
If cImpXMLNavigator.getNodeName() = 'Orders'
cImpXMLNavigator.setXMLExchangeNode()
! Set the node back into the Exchange object
bImpXmlRet = cImpExch.FromXML( cImpWrapperOD )
!And read in the set of OrderDetails for this order
If bImpXmlRet <> CPXMLErr:NoError
Message( 'An Error Occurred while Converting the XML Input. ' &|
'The error returned was: ' & bImpXmlRet,|
'Error Converting XML Output',|
ICON:Hand, BUTTON:OK )
End
End
bImpXmlRet = cImpXMLNavigator.goToNextSibling()
End
cImpExch.Close()
Tony Bowes
Today is November 23, 2024, 8:21 pm This article has been viewed 35351 times. Google search has resulted in 11 hits on this article since January 25, 2004.
|
|