Package org.dom4j

Examples of org.dom4j.DocumentFactory


        this.jsonManifestHandler = jsonManifestHandler;
    }

    public Object getService(Bundle bundle, ServiceRegistration registration)
    {
        DocumentFactory factory = DocumentFactory.getInstance();
        String pluginKey = OsgiHeaderUtil.getPluginKey(bundle);
        Plugin plugin = pluginAccessor.getPlugin(pluginKey);

        if (bundle.getEntry("atlassian-extension.json") != null)
        {
            JsonManifest mf = jsonManifestHandler.read(plugin);
            if (mf.getScreenshot() != null)
            {
                registerScreenshotWebResourceDescriptor(bundle, factory, plugin, mf.getScreenshot());
            }
        }

        if (bundle.getEntry("js/") != null)
        {
            SpeakeasyCommonJsModulesDescriptor descriptor = new SpeakeasyCommonJsModulesDescriptor(
                    moduleFactory, bundleContext, hostContainer, descriptorGeneratorManager, pluginAccessor);

            Element modules = factory.createElement("scoped-modules")
                .addAttribute("key", "modules")
                .addAttribute("location", "js");
            if (bundle.getEntry("css/") != null)
            {
                modules.addElement("dependency").setText("css");
View Full Code Here


{

    public List<Element> createWebItems(InputStream in)
    {
        List<Element> items = newArrayList();
        DocumentFactory factory = DocumentFactory.getInstance();
        try
        {
            if (in == null)
            {
                return emptyList();
            }
            final String content = StringUtils.join(IOUtils.readLines(in), "\n");
            JSONArray root = new JSONArray(stripComments(content));
            for (int x=0; x<root.length(); x++)
            {
                Element element = factory.createElement("scoped-web-item");
                element.addAttribute("key", "item-" + x);
                JSONObject item = root.getJSONObject(x);
                if (!item.isNull("section"))
                {
                    element.addAttribute("section", item.getString("section"));
View Full Code Here

  }

  public static DocumentFactory getDocumentFactory() {

    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    DocumentFactory factory;
    try {
      Thread.currentThread().setContextClassLoader( XMLHelper.class.getClassLoader() );
      factory = DocumentFactory.getInstance();
    }
    finally {
View Full Code Here

     *   <w:tcPr> <!-- table cell properties -->
        <w:shd w:fill="00FF00"/>
        <!-- Table Cell Shading see chapter 2.4.33
      </w:tcPr>
     */
    DocumentFactory factory=DocumentFactory.getInstance();
    Element cellProperties=factory.createElement(new QName(WordprocessingML.TABLE_CELL_PROPERTIES, WordDocument.namespaceWord));

    if (cellBackgroundColor!=null) {
      //add shading only if a color has been defined
      addBackgroundProperties( cellProperties);
    }
View Full Code Here

//#endif

    //TODO why namespace makes trouble with table border ??
    //  Element cellAsXml = rootDocument.createElementNS(WordprocessingML.NS_WORD12,"tc");
//      Element cellProperties = rootDocument.createElementNS(WordprocessingML.NS_WORD12,"tcPr");
    DocumentFactory factory=DocumentFactory.getInstance();
    Element cellAsXml=factory.createElement(new QName(WordprocessingML.TABLE_CELL, WordDocument.namespaceWord));
    cellAsXml.add(addCellProperties());
    //TODO optimize here, addCellProperties call again DocumentFactory. sent as argument and use addElement instead

    //add all the paragraphs
    for (Iterator iter = paraList.iterator(); iter.hasNext();) {
View Full Code Here

  private Element buildColumnSize() {
    //default table width for the moment
    //TODO implement something for table size if needed

    DocumentFactory factory=DocumentFactory.getInstance();
    Element columnSizeXml=factory.createElement(new QName(WordprocessingML.TABLE_PROPERTIES_PREFRED_TABLE_WIDTH, WordDocument.namespaceWord));
    columnSizeXml.addAttribute(new QName(WordprocessingML.TABLE_CELL_WIDTH_VALUE, WordDocument.namespaceWord), "0");//TODO hard coded

    //alignment
    // w:type="auto"
    //TODO rename TABLE_CELL_WIDTH_TYPE as it is also used here
View Full Code Here

    columnSizeXml.addAttribute(new QName(WordprocessingML.TABLE_CELL_WIDTH_TYPE, WordDocument.namespaceWord),widthType.getOpenXmlName());
    return columnSizeXml;
  }

  public Element build()  {
    DocumentFactory factory=DocumentFactory.getInstance();
    Element tableAsNode=factory.createElement(new QName(WordprocessingML.TABLE_BODY_TAG_NAME, WordDocument.namespaceWord));


    Element tableProperties =tableAsNode.addElement(new QName(WordprocessingML.TABLE_PROPERTIES_TAG_NAME, WordDocument.namespaceWord));

    if (border==null) {
View Full Code Here

            </w:tc>
          </w:tr>
        <w:tc>
     */

    DocumentFactory factory=DocumentFactory.getInstance();
    Element lineAsXml=factory.createElement(new QName(WordprocessingML.TABLE_CELL_ROW, WordDocument.namespaceWord));

    // add the cells
    for (Iterator iter = cells.iterator(); iter.hasNext();) {
      TableCell element = (TableCell) iter.next();
      //add cell to table line
View Full Code Here

   * build a paragraph in open XML
   *
   * @return
   */
  public Element build() {
    DocumentFactory factory=DocumentFactory.getInstance();
    Element paragraph=factory.createElement(new QName(WordprocessingML.PARAGRAPH_BODY_TAG_NAME, WordDocument.namespaceWord));
  //  Element paragraph=insertionPoint.addElement(new QName(WordprocessingML.PARAGRAPH_BODY_TAG_NAME, WordDocument.namespaceWord));

    // add paragraph properties
    addParagraphProperties( paragraph);

View Full Code Here

    private DocumentFactory documentFactory;
    private OutputFormat outputFormat;

    public Dom4JDriver() {
        this(new DocumentFactory(), OutputFormat.createPrettyPrint());
        outputFormat.setTrimText(false);
    }
View Full Code Here

TOP

Related Classes of org.dom4j.DocumentFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.