private void handleStyleNode( final DocumentContext context, final StyleReference node, final ArrayList styleRules, final ArrayList pageRules, final ArrayList counterRules ) { // do some inline parsing // (Same as the <style> element of HTML) // we also accept preparsed content ... final String styleText = node.getStyleContent(); try { final byte[] bytes = styleText.getBytes( "UTF-8" ); final ResourceKey rawKey = resourceManager.createKey( bytes ); final ResourceKey baseKey = context.getContextKey(); final StyleSheet styleSheet = parseStyleSheet( rawKey, baseKey ); if ( styleSheet == null ) { return; } addStyleRules( styleSheet, styleRules ); addPageRules( styleSheet, pageRules ); addCounterRules( styleSheet, counterRules ); } catch ( UnsupportedEncodingException e ) { e.printStackTrace(); } catch ( ResourceKeyCreationException e ) { e.printStackTrace(); } }
private void handleLinkNode( final Object styleResource, final ArrayList<ElementStyleRule> styleRules, final ArrayList<CSSCounterRule> counterRules ) { // do some external parsing // (Same as the <link> element of HTML) try { final String href = (String) styleResource; final ResourceKey baseKey = context.getContextKey(); final ResourceKey derivedKey; if ( baseKey == null ) { derivedKey = resourceManager.createKey( href ); } else { derivedKey = resourceManager.deriveKey( baseKey, String.valueOf( href ) ); } final ElementStyleDefinition styleSheet = parseStyleSheet( derivedKey, null ); if ( styleSheet == null ) { return; } addStyleRules( styleSheet, styleRules ); addCounterRules( styleSheet, counterRules ); } catch ( ResourceKeyCreationException e ) { e.printStackTrace(); } }
private void handleLinkNode( final DocumentContext context, final StyleReference node, final ArrayList styleRules, final ArrayList pageRules, final ArrayList counterRules ) { // do some external parsing // (Same as the <link> element of HTML) try { final String href = node.getStyleContent(); final ResourceKey baseKey = context.getContextKey(); final ResourceKey derivedKey; if ( baseKey == null ) { derivedKey = resourceManager.createKey( href ); } else { derivedKey = resourceManager.deriveKey( baseKey, String.valueOf( href ) ); } final StyleSheet styleSheet = parseStyleSheet( derivedKey, null ); if ( styleSheet == null ) { return; } addStyleRules( styleSheet, styleRules ); addPageRules( styleSheet, pageRules ); addCounterRules( styleSheet, counterRules ); } catch ( ResourceKeyCreationException e ) { e.printStackTrace(); } }