Logo Search packages:      
Sourcecode: jodreports version File versions  Download package

static String net::sf::jooreports::templates::xmlfilters::ScriptTagFilter::addScriptDirectives ( Element  scriptElement ) throws IOException, DocumentTemplateException [inline, static, private]
Parameters:
scriptElement
Returns:
the text that should replace the input field
Exceptions:
DocumentTemplateException

Definition at line 157 of file ScriptTagFilter.java.

                                                                                                                     {
            String scriptReplacement = "";
            
            List scriptParts = parseScriptParts(scriptElement.getValue());
            for (int index = 0; index < scriptParts.size(); index++) {
                  ScriptPart scriptPart = (ScriptPart) scriptParts.get(index);
                  if (scriptPart.getLocation() == null) {
                        scriptReplacement = scriptPart.getText();
                  } else {
                        Element enclosingElement = findEnclosingElement(scriptElement, scriptPart.getLocation());
                        if (scriptPart.isTagAttribute()) {
                              String[] nameValue = scriptPart.getText().split("=", 2);
                              if (nameValue.length != 2) {
                                    throw new DocumentTemplateException("script error: # attribute name=value not found");
                              }
                              enclosingElement.addAttribute(new Attribute(nameValue[0], enclosingElement.getNamespaceURI(), nameValue[1]));
                        } else {
                              ParentNode parent = enclosingElement.getParent();
                              int parentIndex = parent.indexOf(enclosingElement);
                              if (scriptPart.afterEndTag()) {
                                    parentIndex++;
                              }
                              parent.insertChild(newNode(scriptPart.getText()), parentIndex);
                        }
                  }
            }
            
            return scriptReplacement;           
      }

Generated by  Doxygen 1.6.0   Back to index