YES it is possible! I was working with XML that could include text and sub-XML elements. The problem is to build e-mail manager that should read commands from XML. A part of a command is e-mail text that could be a text or another XML.
<root> <A> <B> <element>a_text_here </element> </B> </A> </root> or <root> <A> <B> <element>sub-XML </element> </B> </A> </root > The key question is how to distinguish a pre-set elements (here: root, A, B and element) from sub-XML that can includes the same literal as pre-set elements. The one possible solution is to use a SAX parser with the additional SIA classes. The SIA parser has a special feature that helps to globally identify any node within XML. We can use the feature to distinguish elements that belong to root-XML and elements that belong to sub-XML even if their nodes share the same literal for element names. First we will take an XML that includes all possible root-XML nodes and only root-XML nodes to generate a source code for our new SIA parser. The SIAGenerator (from org.xml.siaparser.tools.jar package) reads an XML and writes to standard output a text of source code for a dedicated SIA parser. Then we will have to make two important changes to the source code. 1. Change the Automaton used in parser's constructor from fixed to flexible (self-learn) mode. This change guarantee that the SIA will recognized every new node - we need that for sub-XML. 2. Secondary we have to handle the new elements. E.g. we might concatenate all sub-XML nodes as they arrived. This way we will separate the sub-XML. So, to answer the question: yes it is possible with SAX but it requires some additional efforts. The SIA parser was build to help with that kind of problems. As a matter of fact it took me about 30 minutes to generate/write the source code and it is working very stable and much faster than similar DOM parser. Here I only had indicated the possible solution with SIA parser. Please see the http://www.geocities.com/siaparser/ for more details. I know it is a little complicated, but the SIA parser is a real time saver. Thank you, Robert -------------------- I wanted to know if its possible to use SAX to parse a blobbed XML file containing many documents. I know that using SAX, I can define StartDocument and EndDocument events. Is this the best way to go about it? Basically, I am looking to break up a blobbed XML file into many XML documents. Thanks, Chris __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
