/** * Invoked for a start element. If the element is a <script>, overrides the normal behavior to begin collecting * the script text. */ public void startElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException { if (!isSupportedScript( element, attrs )) { super.startElement( element, attrs, augs ); } else { _activeScriptBlock = new StringBuffer(); _scriptLanguage = getScriptLanguage( attrs ); String srcAttribute = attrs.getValue( "src" ); if (srcAttribute != null) _activeScriptBlock.append( _scriptHandler.getIncludedScript( srcAttribute ) ); } }
public void endElement( QName element, Augmentations augs ) throws XNIException { if (_activeScriptBlock == null) { super.endElement( element, augs ); } else { try { final String scriptText = _activeScriptBlock.toString(); String replacementText = getTranslatedScript( _scriptLanguage, scriptText ); _configuration.pushInputSource( newInputSource( replacementText ) ); } catch (IOException e) { // ignore } finally { _activeScriptBlock = null; } } }
final ScriptFilter javaScriptFilter = new ScriptFilter( configuration ); configuration.setProperty( FILTERS, new XMLDocumentFilter[] { javaScriptFilter } ); if (HTMLParserFactory.isPreserveTagCase()) { domParser.setFeature( DEFER_NODE_EXPANSION, false ); if (HTMLParserFactory.isReturnHTMLDocument()) domParser.setProperty( DOCUMENT_CLASS_NAME, HTMLDocumentImpl.class.getName() ); javaScriptFilter.setScriptHandler( domParser ); return domParser; } catch (SAXNotRecognizedException e) {
private boolean isSupportedScript( QName element, XMLAttributes attrs ) { if (!element.rawname.equalsIgnoreCase( "script" ) || attrs == null) return false; String value = getScriptLanguage( attrs ); return _scriptHandler.supportsScriptLanguage( value ); }
public void emptyElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException { if (!isSupportedScript( element, attrs )) { super.emptyElement(element, attrs, augs); } }
final ScriptFilter javaScriptFilter = new ScriptFilter( configuration ); configuration.setProperty( FILTERS, new XMLDocumentFilter[] { javaScriptFilter } ); if (HTMLParserFactory.isPreserveTagCase()) { domParser.setFeature( DEFER_NODE_EXPANSION, false ); if (HTMLParserFactory.isReturnHTMLDocument()) domParser.setProperty( DOCUMENT_CLASS_NAME, HTMLDocumentImpl.class.getName() ); javaScriptFilter.setScriptHandler( domParser ); return domParser; } catch (SAXNotRecognizedException e) {
private boolean isSupportedScript( QName element, XMLAttributes attrs ) { if (!element.rawname.equalsIgnoreCase( "script" ) || attrs == null) return false; String value = getScriptLanguage( attrs ); return _scriptHandler.supportsScriptLanguage( value ); }
public void emptyElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException { if (!isSupportedScript( element, attrs )) { super.emptyElement(element, attrs, augs); } }
/** * Invoked for a start element. If the element is a <script>, overrides the normal behavior to begin collecting * the script text. */ public void startElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException { if (!isSupportedScript( element, attrs )) { super.startElement( element, attrs, augs ); } else { _activeScriptBlock = new StringBuffer(); _scriptLanguage = getScriptLanguage( attrs ); String srcAttribute = attrs.getValue( "src" ); if (srcAttribute != null) _activeScriptBlock.append( _scriptHandler.getIncludedScript( srcAttribute ) ); } }
public void endElement( QName element, Augmentations augs ) throws XNIException { if (_activeScriptBlock == null) { super.endElement( element, augs ); } else { try { final String scriptText = _activeScriptBlock.toString(); String replacementText = getTranslatedScript( _scriptLanguage, scriptText ); _configuration.pushInputSource( newInputSource( replacementText ) ); } catch (IOException e) { // ignore } finally { _activeScriptBlock = null; } } }
final ScriptFilter javaScriptFilter = new ScriptFilter( configuration ); configuration.setProperty( FILTERS, new XMLDocumentFilter[] { javaScriptFilter } ); if (HTMLParserFactory.isPreserveTagCase()) { domParser.setFeature( DEFER_NODE_EXPANSION, false ); if (HTMLParserFactory.isReturnHTMLDocument()) domParser.setProperty( DOCUMENT_CLASS_NAME, HTMLDocumentImpl.class.getName() ); javaScriptFilter.setScriptHandler( domParser ); return domParser; } catch (SAXNotRecognizedException e) {
private boolean isSupportedScript( QName element, XMLAttributes attrs ) { if (!element.rawname.equalsIgnoreCase( "script" ) || attrs == null) return false; String value = getScriptLanguage( attrs ); return _scriptHandler.supportsScriptLanguage( value ); }
public void emptyElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException { if (!isSupportedScript( element, attrs )) { super.emptyElement(element, attrs, augs); } }
/** * Invoked for a start element. If the element is a <script>, overrides the normal behavior to begin collecting * the script text. */ public void startElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException { if (!isSupportedScript( element, attrs )) { super.startElement( element, attrs, augs ); } else { _activeScriptBlock = new StringBuffer(); _scriptLanguage = getScriptLanguage( attrs ); String srcAttribute = attrs.getValue( "src" ); if (srcAttribute != null) _activeScriptBlock.append( _scriptHandler.getIncludedScript( srcAttribute ) ); } }
public void endElement( QName element, Augmentations augs ) throws XNIException { if (_activeScriptBlock == null) { super.endElement( element, augs ); } else { try { final String scriptText = _activeScriptBlock.toString(); String replacementText = getTranslatedScript( _scriptLanguage, scriptText ); _configuration.pushInputSource( newInputSource( replacementText ) ); } catch (IOException e) { // ignore } finally { _activeScriptBlock = null; } } }