Package org.w3c.dom

Examples of org.w3c.dom.Document


        testAttributes(reader);
    }
   
    public void testElementChild() throws Exception
    {
        Document doc = getDocument();
        Element e = doc.createElementNS("urn:test","root");
        e.setAttribute("xmlns", "urn:test");
        Element child =  doc.createElementNS("urn:test2","child");
        child.setAttribute("xmlns:a", "urn:test2");
       
        child.setPrefix("a");
        e.appendChild(child);
        doc.appendChild(e);
        DOMUtils.writeXml(doc,System.out);
       
        W3CDOMStreamReader reader = new W3CDOMStreamReader(e);
        testElementChild(reader);
    }
View Full Code Here


        testElementChild(reader);
    }
   
    public void testEmptyElement() throws Exception
    {
        Document doc = getDocument();
        Element e = doc.createElementNS("urn:test","root");
        W3CDOMStreamReader reader = new W3CDOMStreamReader(e);
        assertNotNull(reader.getElementText());
        assertEquals("", reader.getElementText());
    }
View Full Code Here

  }

  public void eventOccured(GUIEvent event) {
    try {
      if (event.getName().equals("add")) {
        Document document = userObject.element.getOwnerDocument();

        if (dataModel.getValue("mode").equals("common")) {
          TableRow[] entries = (TableRow[]) dialog.getDataModel().getValue("property");

          for (int i = 0; i < entries.length; i++) {
            WidgetInfo.PropertyEntry entry = ((PropertyEntryTableRow) entries[i]).getEntry();

            Element propertyNode = null;

            if (entry.propertyName.equals("anchor")) {
              propertyNode = document.createElement("anchor");

              AnchorEditor anchorEditor = new AnchorEditor(dialog, propertyNode, userObject);
              anchorEditor.show();
            } else {
              if (entry.propertyName.equals("layout")) {
                propertyNode = document.createElement("layout");
              } else {
                propertyNode = document.createElement("property");
                propertyNode.setAttribute("name", entry.propertyName);
              }

              propertyNode.setAttribute("type", entry.propertyType);

              new PropertyTableRow(userObject, entry.defaultValue, propertyNode)
                .getPropertyAdapter()
                .toDOM(
                entry.defaultValue,
                propertyNode);
             
              Object value = null;
              if (entry.propertyName.equals("layout")) {
                value = LayoutFactory.getInstance().constructLayout(userObject.widget, propertyNode);
              } else {
                value = PropertyFactory.getInstance().constructProperty(propertyNode);
              }

              PropertyTableRow row = new PropertyTableRow(userObject, value, propertyNode);

              userObject.widget.setProperty(entry.propertyName, value);
              WidgetTree.revalidate(userObject.widget);

              userObject.tableModel.addRow(row);
              userObject.element.appendChild(propertyNode);

              Builder.markModified();
            }
          }
        } else {
          String name = (String) dataModel.getValue("name"), type = null;

          Element propertyNode = document.createElement("property");
          propertyNode.setAttribute("name", name);

          switch (((Integer) dataModel.getValue("type.index")).intValue()) {
            case IDX_ISTRING :
              type = "istring";
              break;
            case IDX_STRING :
              type = "string";
              break;
            case IDX_INT :
              type = "int";
              break;
            case IDX_FLOAT :
              type = "float";
              break;
            case IDX_DOUBLE :
              type = "double";
              break;
            case IDX_BOOL :
              type = "bool";
              break;
          }
          propertyNode.setAttribute("type", type);
          propertyNode.appendChild(document.createTextNode((String) dataModel.getValue("value")));
          Object value = PropertyFactory.getInstance().constructProperty(propertyNode);
          PropertyTableRow row = new PropertyTableRow(userObject, value, propertyNode);
          userObject.widget.setProperty(name, value);
          WidgetTree.revalidate(userObject.widget);
View Full Code Here

        writer.writeEndElement();
        writer.writeEndElement();
       
        writer.writeEndDocument();
       
        Document doc = writer.getDocument();
        DOMUtils.writeXml(doc, System.out);
    }
View Full Code Here

  public void doInsert(String className, String preset, Element anchorNode) throws GUIException {
    TreeItem items[] = (TreeItem[]) dataModel.getValue("tree.selected");
    TreeItem item = items[0];
    WidgetUserObject parentObject = (WidgetUserObject) item.getUserObject();
    Document document = parentObject.element.getOwnerDocument();

    Element childWidget = document.createElement("widget");
    childWidget.setAttribute("class", className);
    if (preset != null)
      childWidget.setAttribute("preset", preset);

    TreeItem newNode = new TreeItem(item, null);
View Full Code Here

      borderNode.removeChild(children.item(0));
    }

    String type = dataModel.getValue("type").toString();
    borderNode.setAttribute("border", type);
    Document document = borderNode.getOwnerDocument();

    if (type.equals("empty")) {
      Element top = document.createElement("top");
      top.appendChild(document.createTextNode((String) dataModel.getValue("empty_top")));
      borderNode.appendChild(top);

      Element bottom = document.createElement("bottom");
      bottom.appendChild(document.createTextNode((String) dataModel.getValue("empty_bottom")));
      borderNode.appendChild(bottom);

      Element left = document.createElement("left");
      left.appendChild(document.createTextNode((String) dataModel.getValue("empty_left")));
      borderNode.appendChild(left);

      Element right = document.createElement("right");
      right.appendChild(document.createTextNode((String) dataModel.getValue("empty_right")));
      borderNode.appendChild(right);
    } else if (type.equals("titled")) {
      Element title = document.createElement("title");
      title.appendChild(document.createTextNode((String) dataModel.getValue("titled_title")));
      borderNode.appendChild(title);
    }

    PropertyTableRow row = (PropertyTableRow) editorModel.getValue("row");
    WidgetUserObject object = row.getUserObject();
View Full Code Here

  public Object toValue(Object value, Element propertyNode) {
    return value;
  }

  public void toDOM(Object value, Element propertyNode) {
    Document document = propertyNode.getOwnerDocument();

    if (value instanceof Dimension) {
      Dimension dimension = (Dimension) value;

      Element widthNode = document.createElement("width");
      Element heightNode = document.createElement("height");
      propertyNode.appendChild(widthNode);
      propertyNode.appendChild(heightNode);
      widthNode.appendChild(document.createTextNode(String.valueOf((int) dimension.getWidth())));
      heightNode.appendChild(document.createTextNode(String.valueOf((int) dimension.getHeight())));
    } else {
      Point point = (Point) value;

      Element xNode = document.createElement("x");
      Element yNode = document.createElement("y");
      propertyNode.appendChild(xNode);
      propertyNode.appendChild(yNode);
      xNode.appendChild(document.createTextNode(String.valueOf(point.x)));
      yNode.appendChild(document.createTextNode(String.valueOf(point.y)));
    }
  }
View Full Code Here

    }

    public void testSignature()
        throws Exception
    {
        Document doc = readDocument("wsse-request-clean.xml");
       
        WSS4JOutHandler handler = new WSS4JOutHandler();
       
        MessageContext ctx = new MessageContext();
   
View Full Code Here

    extends AbstractSecurityTest
{   
    public void testUsernameToken()
        throws Exception
    {
        Document doc = readDocument("wsse-request-clean.xml");
   
        WSS4JOutHandler handler = new WSS4JOutHandler();
   
        MessageContext ctx = new MessageContext();
   
View Full Code Here

    }
   
    public void testEncrypt()
        throws Exception
    {
        Document doc = readDocument("wsse-request-clean.xml");
   
        WSS4JOutHandler handler = new WSS4JOutHandler();
   
        MessageContext ctx = new MessageContext();
   
View Full Code Here

TOP

Related Classes of org.w3c.dom.Document

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.