Package org.apache.xerces.xni

Examples of org.apache.xerces.xni.XMLAttributes


        // re-open inline elements
        if (depth > 1) {
            int size = fInlineStack.top;
            for (int i = 0; i < size; i++) {
                Info info = (Info)fInlineStack.pop();
                XMLAttributes attributes = info.attributes;
                if (fReportErrors) {
                    String iname = info.qname.rawname;
                    fErrorReporter.reportWarning("HTML2008", new Object[]{iname});
                }
                startElement(info.qname, attributes, synthesizedAugs());
View Full Code Here


            this.qname = new QName(qname);
            if (attributes != null) {
                int length = attributes.getLength();
                if (length > 0) {
                    QName aqname = new QName();
                    XMLAttributes newattrs = new XMLAttributesImpl();
                    for (int i = 0; i < length; i++) {
                        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;
                }
            }
        } // <init>(HTMLElements.Element,QName,XMLAttributes)
View Full Code Here

                sendUnIndentedElement("character");
                sendUnIndentedElement("children");

                //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()
                            );
                }
View Full Code Here

        String uri = fPSVINamespaceContext.getURI(prefix);
        return new QName(prefix, localpart, rawname, uri);
    }

    private XMLAttributes createAttributes(Vector atts) {
        XMLAttributes attributes = new XMLAttributesImpl();
        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;
    }
View Full Code Here

       
        XSTypeAlternativeImpl[] alternatives = currentElemDecl.getTypeAlternatives();
       
        if (alternatives != null) {             
            // Construct a list of attributes needed for CTA processing. This includes inherited attributes as well.
            XMLAttributes ctaAttributes = getAttributesForCTA(attributes);
           
            for (int i = 0; i < alternatives.length; i++) {
                Test test = alternatives[i].getTest();
                if (test != null && test.evaluateTest(element, ctaAttributes)) {
                    currentType = alternatives[i].getTypeDefinition();
View Full Code Here

     * Construct a list of attributes, needed for CTA processing. This includes inherited attributes as well. 
     */
    private XMLAttributes getAttributesForCTA(XMLAttributes 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--) {       
         InheritableAttribute inhAttr = (InheritableAttribute) fInheritableAttrList.elementAt(elemIndx);
         // if an inheritable attribute doesn't already exist in the attributes list, add it to the list
         if (!attributeExists(ctaAttributes, inhAttr)) {
            String rawName = "".equals(inhAttr.getPrefix()) ? inhAttr.getLocalName() : inhAttr.getPrefix() + ":" +
                                       inhAttr.getLocalName();
            fTempQName.setValues(inhAttr.getPrefix(), inhAttr.getLocalName(), rawName, inhAttr.getUri());
            ctaAttributes.addAttribute(fTempQName, inhAttr.getType(), inhAttr.getValue());
         }
      }
     
      return ctaAttributes;
     
View Full Code Here

                sendUnIndentedElement("character");
                sendUnIndentedElement("children");

                //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()
                            );
                }
View Full Code Here

        String uri = fPSVINamespaceContext.getURI(prefix);
        return new QName(prefix, localpart, rawname, uri);
    }

    private XMLAttributes createAttributes(Vector atts) {
        XMLAttributes attributes = new XMLAttributesImpl();
        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;
    }
View Full Code Here

            XSTypeAlternativeImpl[] alternatives = fCurrentElemDecl.getTypeAlternatives();
            if (alternatives != null) {             
                // construct a list of attributes, needed for CTA processing.
                // This method call, adds inherited attributes as well, to the list
                // of attributes.
                XMLAttributes ctaAttributes = getAttributesForCTA(attributes);
               
                for (int i = 0; i < alternatives.length; i++) {
                    Test test = alternatives[i].getTest();
                    if (test != null && test.evaluateTest(element, ctaAttributes)) {
                        fCurrentType = alternatives[i].getTypeDefinition();
View Full Code Here

    // construct a list of attributes, needed for CTA processing. This includes
    // inherited attributes as well.
    private XMLAttributes getAttributesForCTA(XMLAttributes 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 inherited attributes.
      // attributes only from the nearest ancestor, are added to the list
      for (int elemIndx = fInheritableAttrList.size() - 1; elemIndx > -1; elemIndx--) {       
         InheritableAttribute inhAttr = (InheritableAttribute) fInheritableAttrList.elementAt(elemIndx);
         // if an inheritable attribute doesn't already exist, in the attributes
         // list, add it to the list.
         if (!attributeExists(ctaAttributes, inhAttr)) {
            String rawName = "".equals(inhAttr.getPrefix()) ? inhAttr.getLocalName() :
                                   inhAttr.getPrefix() + ":" + inhAttr.getLocalName();
            fTempQName.setValues(inhAttr.getPrefix(), inhAttr.getLocalName(), rawName, inhAttr.getUri());
            ctaAttributes.addAttribute(fTempQName, inhAttr.getType(), inhAttr.getValue());
         }
      }
     
      return ctaAttributes;
     
View Full Code Here

TOP

Related Classes of org.apache.xerces.xni.XMLAttributes

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.