Package com.sun.xml.bind.util

Examples of com.sun.xml.bind.util.AttributesImpl


     */
    public int getAttribute( String uri, String local ) {
        return attStack[stackTop].getIndexFast(uri,local);
    }
    public void consumeAttribute( int idx ) throws SAXException {
        AttributesImpl a = attStack[stackTop];
       
        String uri = a.getURI(idx);
        String local = a.getLocalName(idx);
        String qname = a.getQName(idx);
        String value = a.getValue(idx);

        // mark the attribute as consumed
        // we need to remove the attribute before we process it
        // because the event handler might access attributes.
        a.removeAttribute(idx);
       
       
        getCurrentHandler().enterAttribute(uri,local,qname);
        consumeText(value,false);
        getCurrentHandler().leaveAttribute(uri,local,qname);
View Full Code Here


        getCurrentHandler().enterAttribute(uri,local,qname);
        consumeText(value,false);
        getCurrentHandler().leaveAttribute(uri,local,qname);
    }
    public String eatAttribute( int idx ) throws SAXException {
        AttributesImpl a = attStack[stackTop];
       
        String value = a.getValue(idx);

        // mark the attribute as consumed
        a.removeAttribute(idx);
       
        return value;
    }
View Full Code Here

   
    public void pushAttributes( Attributes atts ) {
        // since Attributes object is mutable, it is criticall important
        // to make a copy.
        // also symbolize attribute names
        AttributesImpl a = new AttributesImpl();
        for( int i=0; i<atts.getLength(); i++ )
            a.addAttribute(
                atts.getURI(i).intern(),
                atts.getLocalName(i).intern(),
                atts.getQName(i).intern(),
                atts.getType(i),
                atts.getValue(i) );
       
        // <foo xsi:nil="false">some value</foo> is a valid fragment, however
        // we need a look ahead to correctly handle this case.
        // (because when we process @xsi:nil, we don't know what the value is,
        // and by the time we read "false", we can't cancel this attribute anymore.)
        //
        // as a quick workaround, we remove @xsi:nil if the value is false.
        int idx = a.getIndex("http://www.w3.org/2001/XMLSchema-instance","nil");
        if(idx!=-1) {
            String v = a.getValue(idx).trim();
            if(v.equals("false") || v.equals("0"))
                a.removeAttribute(idx);
        }
       
        attStack.push(a);
       
        // start a new namespace scope
View Full Code Here

        Attributes a = (Attributes)attStack.peek();
       
        return a.getIndex(uri,local);
    }
    public void consumeAttribute( int idx ) throws UnreportedException {
        AttributesImpl a = (AttributesImpl)attStack.peek();
       
        String uri = a.getURI(idx).intern();
        String local = a.getLocalName(idx).intern();
        String value = a.getValue(idx).intern();

        // mark the attribute as consumed
        // we need to remove the attribute before we process it
        // because the event handler might access attributes.
        a.removeAttribute(idx);
       
       
        getCurrentHandler().enterAttribute(uri,local);
        consumeText(value,false);
        getCurrentHandler().leaveAttribute(uri,local);
View Full Code Here

        throws SAXException {
           
        elementCount++;
       
        if( rootElement ) {
            AttributesImpl attributes = new AttributesImpl( atts );
            atts = attributes;
                           
            // see if "xsi" already exists and has been set to something else               
            if( seenXsiURI != null && seenXsiURI.equals( xsiURI ) ) {
                // no need to declare the prefix
            } else {
                if( seenXsiURI!=null )
                    // make up a new prefix
                    prefix = "xmlschemainstance";
                   
                prefixDeclared = true;
               
                // declare the namespace
                super.startPrefixMapping( prefix, xsiURI );
            }
           
            // set the schemaLocation attribute
            if( schemaLocation != null ) {
                attributes.addAttribute( xsiURI, "schemaLocation",
                                         prefix + ":schemaLocation",
                                         "CDATA",
                                         schemaLocation );
            }
           
            // set the noNSSchemaLocation attribute
            if( noNSSchemaLocation != null ) {
                attributes.addAttribute( xsiURI, "noNamespaceSchemaLocation",
                                         prefix + ":noNamespaceSchemaLocation",
                                         "CDATA",
                                         noNSSchemaLocation );
            }
       
View Full Code Here

       
        elementDepth++;
        stackTop++;
       
        // push the stack
        AttributesImpl a = attStack[stackTop];
        if( a==null )
            attStack[stackTop] = a = new AttributesImpl();
        else
            a.clear();
       
        // since Attributes object is mutable, it is criticall important
        // to make a copy.
        // also symbolize attribute names
        for( int i=0; i<atts.getLength(); i++ ) {
            String auri = atts.getURI(i);
            String alocal = atts.getLocalName(i);
            String avalue = atts.getValue(i);
            String aqname = atts.getQName(i);
           
            // work gracefully with misconfigured parsers that don't support namespaces
            if( auri==null )
                auri="";
            if( alocal==null || alocal.length()==0 )
                alocal=aqname;
            if( aqname==null || aqname.length()==0 )
                aqname=alocal;

            // <foo xsi:nil="false">some value</foo> is a valid fragment, however
            // we need a look ahead to correctly handle this case.
            // (because when we process @xsi:nil, we don't know what the value is,
            // and by the time we read "false", we can't cancel this attribute anymore.)
            //
            // as a quick workaround, we remove @xsi:nil if the value is false.
            if( auri=="http://www.w3.org/2001/XMLSchema-instance" && alocal=="nil" ) {
                String v = avalue.trim();
                if(v.equals("false") || v.equals("0"))
                    continue;   // skip this attribute
            }
           
            // otherwise just add it.
            a.addAttribute(
                    auri,
                    alocal,
                    aqname,
                    atts.getType(i),
                    avalue );
View Full Code Here

     */
    public int getAttribute( String uri, String local ) {
        return attStack[stackTop].getIndexFast(uri,local);
    }
    public void consumeAttribute( int idx ) throws SAXException {
        AttributesImpl a = attStack[stackTop];
       
        String uri = a.getURI(idx);
        String local = a.getLocalName(idx);
        String qname = a.getQName(idx);
        String value = a.getValue(idx);

        // mark the attribute as consumed
        // we need to remove the attribute before we process it
        // because the event handler might access attributes.
        a.removeAttribute(idx);
       
       
        getCurrentHandler().enterAttribute(uri,local,qname);
        consumeText(value,false);
        getCurrentHandler().leaveAttribute(uri,local,qname);
View Full Code Here

        getCurrentHandler().enterAttribute(uri,local,qname);
        consumeText(value,false);
        getCurrentHandler().leaveAttribute(uri,local,qname);
    }
    public String eatAttribute( int idx ) throws SAXException {
        AttributesImpl a = attStack[stackTop];
       
        String value = a.getValue(idx);

        // mark the attribute as consumed
        a.removeAttribute(idx);
       
        return value;
    }
View Full Code Here

       
        elementDepth++;
        stackTop++;
       
        // push the stack
        AttributesImpl a = attStack[stackTop];
        if( a==null )
            attStack[stackTop] = a = new AttributesImpl();
        else
            a.clear();
       
        // since Attributes object is mutable, it is criticall important
        // to make a copy.
        // also symbolize attribute names
        for( int i=0; i<atts.getLength(); i++ ) {
            String auri = atts.getURI(i);
            String alocal = atts.getLocalName(i);
            String avalue = atts.getValue(i);
            String aqname = atts.getQName(i);
           
            // work gracefully with misconfigured parsers that don't support namespaces
            if( auri==null )
                auri="";
            if( alocal==null || alocal.length()==0 )
                alocal=aqname;
            if( aqname==null || aqname.length()==0 )
                aqname=alocal;

            // <foo xsi:nil="false">some value</foo> is a valid fragment, however
            // we need a look ahead to correctly handle this case.
            // (because when we process @xsi:nil, we don't know what the value is,
            // and by the time we read "false", we can't cancel this attribute anymore.)
            //
            // as a quick workaround, we remove @xsi:nil if the value is false.
            if( auri=="http://www.w3.org/2001/XMLSchema-instance" && alocal=="nil" ) {
                String v = avalue.trim();
                if(v.equals("false") || v.equals("0"))
                    continue;   // skip this attribute
            }
           
            // otherwise just add it.
            a.addAttribute(
                    auri,
                    alocal,
                    aqname,
                    atts.getType(i),
                    avalue );
View Full Code Here

     */
    public int getAttribute( String uri, String local ) {
        return attStack[stackTop].getIndexFast(uri,local);
    }
    public void consumeAttribute( int idx ) throws SAXException {
        AttributesImpl a = attStack[stackTop];
       
        String uri = a.getURI(idx);
        String local = a.getLocalName(idx);
        String qname = a.getQName(idx);
        String value = a.getValue(idx);

        // mark the attribute as consumed
        // we need to remove the attribute before we process it
        // because the event handler might access attributes.
        a.removeAttribute(idx);
       
       
        getCurrentHandler().enterAttribute(uri,local,qname);
        consumeText(value,false);
        getCurrentHandler().leaveAttribute(uri,local,qname);
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.util.AttributesImpl

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.