[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XMLFilter in a URIResolver

Subject: RE: XMLFilter in a URIResolver
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 11 Sep 2003 14:38:36 +0100
saxon saxsource
When you supply a SAXSource to Saxon, Saxon sets the properties of the
XMLReader supplied with the SAXSource to make sure that it is reporting
namespaces in the way that Saxon requires. Specifically it does:

     	parser.setFeature("http://xml.org/sax/features/namespaces",
true);
 
parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
false);

A SAX2 parser is expected to recognize these properties; if it responds
to these requests with an exception, Saxon complains with the error
message that you saw.

Your XMLFilter is pretending to be a SAX2 parser, so it must support
these methods properly.

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Andrew Welch
> Sent: 11 September 2003 14:03
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  XMLFilter in a URIResolver
> 
> 
> > Create a SAXSource, whose InputSource is the actual XML file, and
> whose
> > XMLReader is the XMLFilter. Return the SAXSource as the 
> result of the 
> > URIResolver.
> > 
> > (untested)
> 
> Thanks Mike,
> 
> I now get the error,
> 
> Warning: The SAX2 parser does not support a required namespace feature
> 
> Which I guess is related to the XMLFilter, which looks like:
> 
> public void startElement(String namespaceURI, String 
> localName, String qualifiedName, Attributes atts) throws 
> SAXException {
> 
>  AttributesImpl newAttributes = new AttributesImpl(atts);  
> newAttributes.addAttribute("", "elementID", "elementID", "",
> counter+"");
>  atts = newAttributes;
>  counter++;
>         
>  super.startElement(namespaceURI, localName, qualifiedName, atts); }
> 
> This method simply adds @elementID to each element.
> 
> 
> The code that calls this (in the resolver) is:
> 
> SAXSource s = new SAXSource();
> s.setInputSource(new InputSource(is));
> s.setXMLReader(addElementIdToXML);   
> return s;
> 
> I'm using Saxon 7.6.5a and crimson.  Do I need to set the 
> XMLReader on the XMLFilter??  Or am I missing the point?  
> When I do set it, the XMLFilter seems to be ignored.  When 
> its not set, I get the error. Surely I need to set it...
> 
> Still confused,
> 
> andrew
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.