Package org.apache.xerces.util

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


          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;
    }

            XMLAttributes attrs = new XMLAttributesImpl();
            for (Map.Entry<String, String> entry : startElementEvent.getAttributes().entrySet()) {
             
              String name = entry.getKey();
              String value = entry.getValue();
              attrs.addAttribute(new QName(prefix, name, name, uri), "CDATA", value);
            }

            if (depth++ == 0) {
              augs = new HTMLAugmentations();
            }

                        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;
                }

                        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;
                }

                //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;
    }

      // copy attributes from the original list of attributes
      XMLAttributes ctaAttributes = new XMLAttributesImpl();
      for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
         QName qName = new QName();
         attributes.getName(attrIndx, qName);
         ctaAttributes.addAttribute(qName, attributes.getType(attrIndx), attributes.getValue(attrIndx));  
      }
     
      // Traverse up the XML tree, to find inheritable attributes. Attributes only from the nearest ancestor,
      // are added to the list (since there is recursive inclusion of inheritable attributes in an XML tree).
      for (int elemIndx = fInheritableAttrList.size() - 1; elemIndx > -1; elemIndx--) {       

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.