Package org.apache.xerces.util

Examples of org.apache.xerces.util.XMLAttributesImpl.addAttribute()


      if (null != _scripts) {
        for (Iterator iter = _scripts.iterator(); iter.hasNext();) {
          String script = (String) iter.next();
          QName element = new QName(null, "script", "script", null);
          XMLAttributes attrs = new XMLAttributesImpl();
          attrs.addAttribute(new QName(null, "src", "src", null),
              "CDATA", script);
          attrs.addAttribute(new QName(null, "type", "type", null),
              "CDATA", "text/javascript");
          Augmentations augs = new HTMLAugmentations();
          super.startElement(element, attrs, augs);


          String script = (String) iter.next();
          QName element = new QName(null, "script", "script", null);
          XMLAttributes attrs = new XMLAttributesImpl();
          attrs.addAttribute(new QName(null, "src", "src", null),
              "CDATA", script);
          attrs.addAttribute(new QName(null, "type", "type", null),
              "CDATA", "text/javascript");
          Augmentations augs = new HTMLAugmentations();
          super.startElement(element, attrs, augs);
          super.endElement(element, augs);
        }

                //Create XMLAttributes from DOM
                Attr[] atts = (Element) child == null ? null : DOMUtil.getAttrs((Element) child);
                XMLAttributes attrs = new XMLAttributesImpl();
                for (int i=0; i<atts.length; i++) {
                    Attr att = (Attr)atts[i];
                    attrs.addAttribute(
                            new QName(att.getPrefix(), att.getLocalName(), att.getName(), att.getNamespaceURI()),
                            "CDATA" ,att.getValue()
                            );
                }

        if (atts != null) {
            for (int i = 0; i < atts.size(); i += 3) {
                String rawname = (String)atts.elementAt(i);
                String value = (String)atts.elementAt(i + 1);
                String type = (String)atts.elementAt(i + 2);
                attributes.addAttribute(createQName(rawname), type, value);
            }
        }
        return attributes;
    }

        if (attributes != null) {
          int l = attributes.getLength();
 
          for (int i = 0; i < l; i++) {
            Node attributeNode = attributes.item(i);
            attrs.addAttribute(new QName(prefix, attributeNode.getNodeName(),
                attributeNode.getNodeName(), uri), "CDATA",
                attributeNode.getNodeValue());
          }
         
        }

        if (attributes != null) {
          int l = attributes.getLength();
 
          for (int i = 0; i < l; i++) {
            Node attributeNode = attributes.item(i);
            attrs.addAttribute(new QName(prefix, attributeNode.getNodeName(),
                attributeNode.getNodeName(), uri), "CDATA",
                attributeNode.getNodeValue());
          }
         
        }

                  attributes.getName(i, aqname);
                  String type = attributes.getType(i);
                  String value = attributes.getValue(i);
                  String nonNormalizedValue = attributes.getNonNormalizedValue(i);
                  boolean specified = attributes.isSpecified(i);
                  newattrs.addAttribute(aqname, type, value);
                  newattrs.setNonNormalizedValue(i, nonNormalizedValue);
                  newattrs.setSpecified(i, specified);
               }
               this.attributes = newattrs;
            }

                        attributes.getName(i, aqname);
                        String type = attributes.getType(i);
                        String value = attributes.getValue(i);
                        String nonNormalizedValue = attributes.getNonNormalizedValue(i);
                        boolean specified = attributes.isSpecified(i);
                        newattrs.addAttribute(aqname, type, value);
                        newattrs.setNonNormalizedValue(i, nonNormalizedValue);
                        newattrs.setSpecified(i, specified);
                    }
                    this.attributes = newattrs;
                }

TOP
Copyright © 2018 www.massapi.com. 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.