RE: namespaces and prefixes in SAX2 [Re: Re: [xmlpull-user]Problems with namespace-prefixes Feature.]
"Sean C. Truman" <[email protected]> Fri, 7 Mar 2003 15:14:52 -0600
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
Alek, Please excuse my HTML message (my MUA stinks) You are correct it does work correctly when I remove them.. Thanks for the help Sean -----Original Message----- From: Aleksander Slominski [mailto:[email protected]] Sent: Friday, March 07, 2003 12:23 PM To: [email protected] Cc: [email protected] Subject: namespaces and prefixes in SAX2 [Re: [xmlpull-dev] Re: [xmlpull-user]Problems with namespace-prefixes Feature.] Sean C. Truman wrote: >>>Trying >>> >>>MXParser pullDriver = new org.xmlpull.mxp1.MXParser(); >>>pullDriver.setFeature(pullDriver.FEATURE_PROCESS_NAMESPACES,true); >>>pullDriver.setFeature(pullDriver.FEATURE_REPORT_NAMESPACE_ATTRIBUTES,true); >>> >>>And get the following error >>> >>>org.xmlpull.v1.XmlPullParserException: unknown feature http://xmlpull.org/v1/doc/features.html#report-namespace-prefixes >>>at org.xmlpull.mxp1.MXParser.setFeature(MXParser.java:554) >>>at test.test.<init>(test.java:19) >>>at test.test.main(test.java:27) >>> >>>Am I doing something wrong? >>> >>> >>> >>hi Sean, >> >>you are not doing anything wrong instead you have found bug in our >>documentation (thanks!) as this feature was supposed to be optional >>(this how unit tests check for it) and it is currently not implemented >>in MXP1. i will fix documentation about it soon. >> >>also implementing it in MXP1 is on my TODO queue but i can not tell when >>i may get around to have it done however i wonder why do you want to use >>it? even if this feature is off you can still access all namespace >>declarations just you can not reproduce exact order of all attributes. >>how important support for it is to you? let me know and i can move it to >>higher priority TODO queue if necessary :-) >> >>thanks, >> >>alek >> >> > >Alek, > >I am using the SAX2 Driver that is provided by your API. Problem is I cannot get all the attributes without this being turned on. (I am currently using the alfread driver). > hi, if you turn namespaces off you will get all attributes driver.setFeature(" http://xml.org/sax/features/namespaces", false); but i guess you want to use namespaces? >For example The following line only returns 3 attributes with your parser. > ><SOAP-ENV:Envelope xmlns=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:si=" http://soapinterop.org/xsd" xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"> ></SOAP-ENV:Envelope> > note that this is exaclty as required default for SAX2 parsers (see section *Configuring Namespace Support *in http://www.saxproject.org/?selected=namespaces): if you have namespace feature enabled you get attributes and not namespace declarations by default you can collect all namespace declarations by using *ContentHandler.*|*startPrefixMapping < http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html#startPrefixMapping%28java.lang.String,%20java.lang.String%29> and *||*endPrefixMapping < http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html#endPrefixMapping%28java.lang.String%29>*|) however as i see that this may be important both for XmlPullParser and SAX2 driver i will work on it in short future to add support for http://xml.org/sax/features/namespace-prefixes feature. thanks, alek -- "Mr. Pauli, we in the audience are all agreed that your theory is crazy. What divides us is whether it is crazy enough to be true." Niels H. D. Bohr Yahoo! Groups Sponsor <http://rd.yahoo.com/M=247865.3003379.4374531.2848452/D=egroupweb/S=1706030390:HM/A=1482387/R=0/*http://ads.x10.com/?bHlhaG9vaG0xLmRhd=1047061424%3eM=247865.3003379.4374531.2848452/D=egroupweb/S=1706030390:HM/A=1482387/R=1=1047061424%3eM=247865.3003379.4374531.2848452/D=egroupweb/S=1706030390:HM/A=1482387/R=2> <http://us.adserver.yahoo.com/l?M=247865.3003379.4374531.2848452/D=egroupmail/S=:HM/A=1482387/rand=966703889> To unsubscribe from this group, send an email to: [email protected] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .