Package nu.xom

Examples of nu.xom.Attribute


    }

   
    private Attribute copy(Attribute original) {
       
        Attribute copy = new Attribute(original.getQualifiedName(),
          original.getNamespaceURI(),
          original.getValue(),
          original.getType());
        return copy;
       
View Full Code Here


            }
            return;
        }
        else if (node instanceof Element){
            Element element = (Element) node;
            element.addAttribute(new Attribute("class", "original"));
            for (int i = 0; i < node.getChildCount(); i++) {
                followNode(node.getChild(i));
            }
        }
        else {
View Full Code Here

    protected void writeAttributes(Element element)
      throws IOException {
       
        for (int i = 0; i < element.getAttributeCount(); i++) {
            Attribute attribute = element.getAttribute(i);
            write(attribute);
       
       
    }
View Full Code Here

      name.appendChild(subfunctionTitle);
      code.appendChild(subfunctionCode);
      subfunction.appendChild(name);
      subfunction.appendChild(code);
      Element amount = new Element("Amount");
      amount.addAttribute(new Attribute("year", "TransitionQuarter"));
      amount.appendChild(
       String.valueOf(subfunctions.getInt("TransitionQuarter") * 1000L));
      subfunction.appendChild(amount);
      for (int year = 1976; year <= 2006; year++) {
        String fy = "FY" + year;
        long amt = subfunctions.getInt(fy) * 1000L;
         amount = new Element("Amount");
         amount.addAttribute(new Attribute("year", String.valueOf(year)));
         amount.appendChild(String.valueOf(amt));
         subfunction.appendChild(amount);
      }
      parent.appendChild(subfunction);
    }       
View Full Code Here

   
        BigInteger low  = BigInteger.ONE;
        BigInteger high = BigInteger.ONE;     
        for (int i = 1; i <= numberOfGenerations; i++) {
            Element fibonacci = new Element("fibonacci");
            Attribute index
              = new Attribute("index", String.valueOf(i));
            fibonacci.addAttribute(index);
            fibonacci.appendChild(low.toString());
            root.appendChild(fibonacci);
      
            BigInteger temp = high;
View Full Code Here

       
       if (element.getNamespaceURI().equals(XHTML_NAMESPACE)) {
           
            // Strip out non XHTML attributes
            for (int i = 0; i < element.getAttributeCount(); i++) {
               Attribute attribute = element.getAttribute(i);
              
               if (!"".equals(attribute.getNamespaceURI())) {
                  if (!"xml".equals(attribute.getNamespacePrefix())) {
                       attribute.detach();
                  }
               }
            }
           
            // Strip out additional namespaces
View Full Code Here

        Element element = new Element(name, URI)
        element.appendChild(value);
        if (maintainTypes
          && !type.equals(Attribute.Type.UNDECLARED)
          && !type.equals(Attribute.Type.ENUMERATION)) {
            Attribute xsiType = new Attribute("xsi:type",
              "http://www.w3.org/2001/XMLSchema-instance", type.getName());
            element.addAttribute(xsiType);
        }
        return new Nodes(element);
    }
View Full Code Here

          && "resource".equals(element.getLocalName())) {
            Element table = new Element("table", XHTML_NAMESPACE);
            // move the content
            Element tr = new Element("tr", XHTML_NAMESPACE);
            Element td = new Element("td", XHTML_NAMESPACE);
            td.addAttribute(new Attribute("colspan", "2"));
            tr.appendChild(td);
            while (element.getChildCount() > 0) {
                Node child = element.removeChild(0);
                td.appendChild(child);  
            }
            table.appendChild(tr);
           
            Attribute href = element.getAttribute("role", XLINK_NAMESPACE);
            if (href != null) {
                element.removeAttribute(href);
                Element trhref = new Element("tr", XHTML_NAMESPACE);
                Element tdhref1 = new Element("td", XHTML_NAMESPACE);
                Element tdhref2 = new Element("td", XHTML_NAMESPACE);
                tdhref1.appendChild("href: ");
                tdhref2.appendChild(href.getValue());
                trhref.appendChild(tdhref1);
                trhref.appendChild(tdhref2);
                table.insertChild(trhref, 0);
            }
           
            Attribute arcrole = element.getAttribute("role", XLINK_NAMESPACE);
            if (arcrole != null) {
                element.removeAttribute(arcrole);
                Element trarcrole = new Element("tr", XHTML_NAMESPACE);
                Element tdarcrole1 = new Element("td", XHTML_NAMESPACE);
                Element tdarcrole2 = new Element("td", XHTML_NAMESPACE);
                tdarcrole1.appendChild("arcrole: ");
                tdarcrole2.appendChild(arcrole.getValue());
                trarcrole.appendChild(tdarcrole1);
                trarcrole.appendChild(tdarcrole2);
                table.insertChild(trarcrole, 0);
            }


            Attribute role = element.getAttribute("role", XLINK_NAMESPACE);
            if (role != null) {
                element.removeAttribute(role);
                Element trrole = new Element("tr", XHTML_NAMESPACE);
                Element tdrole1 = new Element("td", XHTML_NAMESPACE);
                Element tdrole2 = new Element("td", XHTML_NAMESPACE);
                tdrole1.appendChild("role: ");
                tdrole2.appendChild(role.getValue());
                trrole.appendChild(tdrole1);
                trrole.appendChild(tdrole2);
                table.insertChild(trrole, 0);
            }
                      
            Attribute id = element.getAttribute("id");
            if (id != null) {
                element.removeAttribute(id);
                Element caption = new Element("caption", XHTML_NAMESPACE);
                caption.appendChild(id.getValue());
                table.insertChild(caption, 0);
            }   
            result = table;
        }     
        return new Nodes(result);
View Full Code Here

                for (int field = 1; field <= numFields; field++) {
               
                    Element fieldElement = new Element("field");
                    int type = metadata.getColumnType(field);
                    String typeName = getSchemaType(type);
                    fieldElement.addAttribute(new Attribute("xsi:type",
                     "http://www.w3.org/2001/XMLSchema-instance",
                     typeName, Attribute.Type.NMTOKEN));
                    String name = metadata.getColumnName(field);
                    fieldElement.addAttribute(new Attribute("name", name));
         
                    // Convert nulls to empty elements with xsi:nil="true"
                    Object value = data.getObject(field);
                    if (value == null) { // null value in database
                        fieldElement.addAttribute(new Attribute("xsi:nil",
                          "http://www.w3.org/2001/XMLSchema-instance", "true"));
                     }
                     else { // non-null value
                        fieldElement.appendChild(convertToXML(data, field, type));
                    }
View Full Code Here

        int type = array.getBaseType();
        String typeName = getSchemaType(type);

        while (data.next()) {
            Element component = new Element("component");
            component.addAttribute(new Attribute("xsi:type",
              "http://www.w3.org/2001/XMLSchema-instance", typeName));
            component.appendChild(convertToXML(data, 2, type));
            holder.appendChild(component);
        }
        return holder;
View Full Code Here

TOP

Related Classes of nu.xom.Attribute

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.