11.09.2007, 11:50 | #1 |
Участник
|
axaptapedia: SaxReader class
Источник: http://www.axaptapedia.com/SaxReader_class
============== Summary: ==Sax Reader== SAX stands for Simple API for XML. A Sax Parser is an event driven parser. Unlike the XMLDocument and DOM Parser it doesn't built up the complete document tree. Therefore it is faster than XMLDocument but you cannot reference nodes like in DOM. ==Usage== As explained above the SAX parser is event driven. So you have to handle these events. To so create a new class that extends the SaxContentHandler class. The SaxContentHandler provides methods for handling events, like start of document, start of element node, document end, etc. class MySaxContentHandler extends SaxContentHandler { protected boolean startElement(str _namespaceURI, str _localName, str _qName, SaxAttributes _attributes) { boolean ret; ; ret = super(_namespaceURI, _localName, _qName, _attributes); info(_localName); return ret; } } Next create a new SaxReader Object and register your SaxContentHandler at the reader. The SaxReader provides two methods to start parsing: parse and parseUrl. SaxReader reader = new SaxReader(); ; reader.contentHandler(new MySaxContentHandler()); reader.parseUrl("http://terraserver.microsoft.com/TerraService2.asmx?WSDL"); [[Image:Saxoutput.png]] ==Dynamics AX 4== Since Dynamcis AX 4 supports .NET use the System.Xml.XmlReader class to parse XML documents. [[Category:General development]] Источник: http://www.axaptapedia.com/SaxReader_class
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|