Return-Path: Delivered-To: apmail-xml-xerces-j-user-archive@xml.apache.org Received: (qmail 32717 invoked by uid 500); 18 Nov 2002 07:25:24 -0000 Mailing-List: contact xerces-j-user-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: xerces-j-user@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list xerces-j-user@xml.apache.org Received: (qmail 32706 invoked from network); 18 Nov 2002 07:25:23 -0000 X-Authentication-Warning: pc-kari.cogsci.ed.ac.uk: kari set sender to ari@cogsci.ed.ac.uk using -f To: xerces-j-user@xml.apache.org Cc: ht@cogsci.ed.ac.uk Subject: PSVI access through DOM in xerces-j From: ari@cogsci.ed.ac.uk (K. Ari Krupnikov) Date: 18 Nov 2002 07:24:33 +0000 Message-ID: Lines: 46 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi guys, I'm trying to use PSVI features in Xerces, and I need some help. I understand Xerces 2.2.0 had a bug in the PSVI implementation that caused NullPionterExceptions if you tried to run the samples. Sandy was kind enough to point out that this bug had been fixed in 2.2.1, and indeed xni.PSVIWriter now produces the expected output. Now I'm trying to access the PSVI from DOM. http://xml.apache.org/xerces2-j/faq-xs.html#faq-5 says: "Use http://apache.org/xml/properties/dom/document-class-name property to set org.apache.xerces.dom.PSVIDocumentImpl document interfaces implementation. In the resulting DOM tree, you may cast org.w3c.dom.Element to the org.apache.xerces.xni.psvi.ElementPSVI and org.w3c.dom.Attr to the org.apache.xerces.xni.psvi.AttributePSVI." The code snippet that follows assumes that has been done. I assumed that "use ... property to set ..." in the context of DOM means inserting something like the following before the code in that sample: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setAttribute ("http://apache.org/xml/properties/dom/document-class-name", "org.apache.xerces.dom.PSVIDocumentImpl"); This throws no exceptions (and I know it does *something*, because if I pass in a nonexistent class name, I get a ``java.lang.IllegalArgumentException: PAR003 Class, "org.apache.xerces.dom.PSVIDocumentImpl.bogus", not found.'') Unfortunately, builders produced by this factory still return org.apache.xerces.dom.ElementImpl objects, not PSVIDocumentImpl. There must be something very simple I'm missing. It would be nice if the sample included a complete working example, one that compiles and produces the expected results. It wouldn't have to be very long. As far as I can tell, it would only add about a half-dozen lines to the 12-line long example on http://xml.apache.org/xerces2-j/faq-xs.html#faq-5 Ari. --------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org For additional commands, e-mail: xerces-j-user-help@xml.apache.org