Package org.xml.sax.helpers

Examples of org.xml.sax.helpers.AttributeListImpl


  throws SAXException
    {
  // If not inside schema element, start it
  if ( ! _insideSchema ) {
      _insideSchema = true;
      _docHandler.startElement( prefix( XML.Schema.Element ), new AttributeListImpl() );
  }
    }
View Full Code Here


        _handler.startDocument();
    }

    String idVal = rs.getString(idColNum.intValue());

    AttributeListImpl attrs = new AttributeListImpl();

    for (int i = 0; i < attrCols.length; i++) {
        String attrCol = attrCols[i];
        Integer attrColNum = (Integer) _cols.get(attrCol);
        FieldMapping field = desc.getAttr(attrCol);
        String attrName = null;
        if (field.getBindXml() == null || field.getBindXml().getName() == null) {
      attrName = field.getName();
        } else {
      attrName = field.getBindXml().getName();
        }

        String attrValue = rs.getString(attrColNum.intValue());
        attrs.addAttribute(attrName, "CDATA", attrValue);
    }

    _handler.startElement(elementName, attrs);

    for (int j = 0; j < simpleElementCols.length; j++) {
        String simpleElementCol = simpleElementCols[j];
        Integer elementColNum = (Integer) _cols.get(simpleElementCol);
        FieldMapping elField = desc.getSimpleElement(simpleElementCol);
        String elName = null;
        if (elField.getBindXml() == null || elField.getBindXml().getName() == null) {
      elName = elField.getName();
        } else {
      elName = elField.getBindXml().getName();
        }

        String elValue = rs.getString(elementColNum.intValue());
        _handler.startElement(elName, new AttributeListImpl());
        _handler.characters(elValue.toCharArray(), 0, elValue.length());
        _handler.endElement(elName);
    }

    if (idIndex < _ids.size() - 1) {
View Full Code Here

        }
        m_contextPushed = false;

        final String name = getTagName( loc, raw, uri );

        final AttributeListImpl attributeList = new AttributeListImpl();
        for( int i = 0; i < a.getLength(); i++ )
        {
            String attributeName = a.getQName( i );
            if( ( attributeName == null ) || ( attributeName.length() == 0 ) )
            {
                final String attributeNamespaceURI = a.getURI( i );
                final String attributeLocalName = a.getLocalName( i );
                if( attributeNamespaceURI.length() == 0 )
                {
                    attributeName = attributeLocalName;
                }
                else
                {
                    final String prefix = m_support.getPrefix( attributeNamespaceURI );
                    if( prefix == null )
                    {
                        throw new SAXException( "No attribute prefix for namespace URI: " + attributeNamespaceURI );
                    }
                    attributeName = prefix + ':' + attributeLocalName;
                }
            }
            attributeList.addAttribute( attributeName, a.getType( i ), a.getValue( i ) );
        }

        final Enumeration e = m_support.getDeclaredPrefixes();
        while( e.hasMoreElements() )
        {
            final String prefix = (String)e.nextElement();
            if( prefix.length() == 0 )
            {
                attributeList.addAttribute( XMLNS, CDATA, uri );
            }
            else
            {
                attributeList.addAttribute( XMLNS_PREFIX + prefix, CDATA, uri );
            }
        }

        m_documentHandler.startElement( name, attributeList );
    }
View Full Code Here

    throws SAXException {
        if (this.documentHandler==null)
            throw new SAXException("DocumentHandler not set");
        NamespacesTable.Name name=this.namespaces.resolve(uri,raw,null,loc);
        // Create the AttributeList
        AttributeListImpl a2=new AttributeListImpl();
        // Set the xmlns:...="..." attributes
        if (this.undecl.size()>0) {
            for (int x=0; x<this.undecl.size(); x++) {
                NamespacesTable.Declaration dec=null;
                dec=(NamespacesTable.Declaration)this.undecl.elementAt(x);
                String aname="xmlns";
                if (dec.getPrefix().length()>0) aname="xmlns:"+dec.getPrefix();
                a2.addAttribute(aname,"CDATA",dec.getUri());
            }
            this.undecl.clear();
        }
        // Set the real attributes
        for (int x=0; x<a.getLength(); x++) {
            NamespacesTable.Name aname=namespaces.resolve(a.getURI(x),
                                                          a.getQName(x),
                                                          null,
                                                          a.getLocalName(x));
            a2.addAttribute(aname.getQName(),a.getType(x),a.getValue(x));
        }
        // Call the document handler startElement() method.
        this.documentHandler.startElement(name.getQName(),a2);
    }
View Full Code Here

     *
     * @param attributes List of attributes defined in the XML for this
     *                   element. May be <code>null</code>.
     */
    public void setAttributes(AttributeList attributes) {
        this.attributes = new AttributeListImpl(attributes);
    }
View Full Code Here

    /**
     * Set's the attributes for the wrapped element.
     */
    public void setAttributes(AttributeList attributes) {
        this.attributes = new AttributeListImpl(attributes);
    }
View Full Code Here

  throws FOPException {

  /* most of this code is modified from John Cowan's */

  Node currentNode;
  AttributeListImpl currentAtts;
 
  /* temporary array for making Strings into character arrays */
  char[] array = null;

  currentAtts = new AttributeListImpl();
 
  /* start at the document element */
  currentNode = document;

  try {
      while (currentNode != null) {
    switch (currentNode.getNodeType()) {
    case Node.DOCUMENT_NODE:
        this.treeBuilder.startDocument();
        break;
    case Node.CDATA_SECTION_NODE:
    case Node.TEXT_NODE:
        String data = currentNode.getNodeValue();
        int datalen = data.length();
        if (array == null || array.length < datalen) {
      /* if the array isn't big enough, make a new
         one */
      array = new char[datalen];
        }
        data.getChars(0, datalen, array, 0);
        this.treeBuilder.characters(array, 0, datalen);
        break;
    case Node.PROCESSING_INSTRUCTION_NODE:
        this.treeBuilder.processingInstruction(
              currentNode.getNodeName(),
      currentNode.getNodeValue());
        break;
    case Node.ELEMENT_NODE:
        NamedNodeMap map = currentNode.getAttributes();
        currentAtts.clear();
        for (int i = map.getLength() - 1; i >= 0; i--) {
      Attr att = (Attr)(map.item(i));
      currentAtts.addAttribute(att.getName(),
             "CDATA",
             att.getValue());
        }
        this.treeBuilder.startElement(
      currentNode.getNodeName(), currentAtts);
View Full Code Here

     * @deprecated
     * @param attributes List of attributes defined in the XML for this
     *                   element. May be <code>null</code>.
     */
    public void setAttributes(AttributeList attributes) {
        this.attributes = new AttributeListImpl(attributes);
        for (int i = 0; i < attributes.getLength(); i++) {
            setAttribute(attributes.getName(i), attributes.getValue(i));
        }
    }
View Full Code Here

            marshal = new Marshaller( response.getDocumentHandler() );

            // Print all the products as elements under the root element
            // <products>, using the Marshaller.
            response.getDocumentHandler().startDocument();
            response.getDocumentHandler().startElement( "products", new AttributeListImpl() );
            if ( result instanceof Enumeration ) {
                Enumeration enumeration;

                enumeration = (Enumeration) result;
                while( enumeration.hasMoreElements() )
View Full Code Here

    start(name, new String[0] );
  }
  public void start( String name, String[] attributes ) {
   
    // create attributes.
    AttributeListImpl as = new AttributeListImpl();
    for( int i=0; i<attributes.length; i+=2 )
      as.addAttribute( attributes[i], "", attributes[i+1] );
   
    try {
      handler.startElement( name, as );
    } catch( SAXException e ) {
      throw new SAXWrapper(e);
View Full Code Here

TOP

Related Classes of org.xml.sax.helpers.AttributeListImpl

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.