Hi Pierpaolo I cannot get Xerces DOMParser to properly handle an embedded @amp;. IT just deletes it without createing any other nodes. Attached is the input file and here is my DOCTree creation code.
Document getDocTree(String xmlString) throws JavaAdapterException { // Uses xerces Document doc = null; StringReader stringReader = new StringReader(xmlString); InputSource input = new InputSource(stringReader);; m_parser = new DOMParser(); try { // String[] as1 = m_parser.getFeaturesRecognized(); // String[] as2 = m_parser.getPropertiesRecognized(); m_parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false); m_parser.setFeature("http://apache.org/xml/features/continue-after-fatal-error", true); m_parser.setFeature( "http://xml.org/sax/features/validation", true); m_parser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes",false); Errors errors = new Errors(); m_parser.setErrorHandler(errors); m_parser.parse(input); doc = m_parser.getDocument(); } catch(SAXException spEx) { throw new JavaAdapterException( "JADocTree parse", JavaAdapterException.EXC_XML_PARSE_ERROR, spEx.getMessage()); } catch(IOException ioEx) { throw new JavaAdapterException("JADocTree parse", JavaAdapterException.EXC_XML_PARSE_ERROR,"IO Error"); } // normalize text representation doc.getDocumentElement ().normalize (); return doc; } I tried the mail address you suggested below and no reply. cheers Jim Pierpaolo Fumagalli wrote: > Bluestream - Boris Garbuzov wrote: > > > > Hello, guys. Can you please tell us how to join your Xerses news group > > or mailing list or refer us to right people? Particularly we have > > question how to handle ampersant "&" with your parser. If the text "Love > > & Sweetness" is a fragment of xml file, then it gives an error. If to > > change & to &, it just swallows it unlike other parsers who convert > > it to regular ampersant. > > I believe you're using a DOMParser, and you don't find a text node for > your & character. This is because an entity reference node is > inserted and this one has a child text node with the value of the &...; > thing. > Try to disable setting up the parser in this way: > > > DOMParser p=new DOMParser(); > > p.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes",false); > > p.parse(in); > > Document document=p.getDocument(); > > It should work... Otherwise send mail to the appropriate mailing list > wich is [EMAIL PROTECTED] > > Pier -- ---------------------------------------------------------- Jim Tivy - Bluestream Database Software Corp. 1168 Hamilton Street, Suite 200, Vancouver BC V6B 2S2 Tel: (604) 669-4469 ext 116 Fax: (604) 669-4469 E-Mail: mailto:[EMAIL PROTECTED] http://www.bluestream.com ----------------------------------------------------------
<MVData xml:space="preserve"> <Record Id="29751931*4"><Field>Silverfish & Goldfish</Field><Field>4:00.427</Field><Field>44</Field></Record> </MVData>