Package org.exist.dom

Examples of org.exist.dom.QName


    public NamePool() {
        pool = new ConcurrentHashMap<QName, QName>();
    }
   
    public QName getSharedName(QName name) {
        final QName sharedName = (QName)pool.putIfAbsent(name, name);
        if (sharedName == null) {
            // The name was not in the pool, return the name just added.
            return name;
        } else {
            // The name was in the pool, return the shared name.
View Full Code Here


            if (nsSupport.getURI(prefix) == null) {
                namespaceDecls.put(prefix, namespaceURI);
                nsSupport.declarePrefix(prefix, namespaceURI);
            }
            // check attributes for required namespace declarations
            QName attrQName;
            String uri;
            if(attribs != null) {
                for (int i = 0; i < attribs.getLength(); i++) {
                    attrQName = attribs.getQName(i);
                    if ("xmlns".equals(attrQName.getLocalName())) {
                        if (nsSupport.getURI("") == null) {
                            uri = attribs.getValue(i);
                            if (enforceXHTML && !XHTML_NS.equals(uri)) {
                                uri = XHTML_NS;
                            }
                            namespaceDecls.put("", uri);
                            nsSupport.declarePrefix("", uri);
                        }
                    } else if (attrQName.getPrefix() != null && attrQName.getPrefix().length() > 0) {
                        prefix = attrQName.getPrefix();
                        if("xmlns:".equals(prefix)) {
                            if (nsSupport.getURI(prefix) == null) {
                                uri = attribs.getValue(i);
                                prefix = attrQName.getLocalName();
                                namespaceDecls.put(prefix, uri);
                                nsSupport.declarePrefix(prefix, uri);
                            }
                        } else {
                            if (nsSupport.getURI(prefix) == null) {
                                uri = attrQName.getNamespaceURI();
                                namespaceDecls.put(prefix, uri);
                                nsSupport.declarePrefix(prefix, uri);
                            }
                        }
                    }
View Full Code Here

                if( ( outerExpr != null ) && ( outerExpr instanceof LocationStep ) ) {
                    final LocationStep outerStep = ( LocationStep )outerExpr;
                    final NodeTest     test      = outerStep.getTest();

                    if( !test.isWildcardTest() && ( test.getName() != null ) ) {
                        contextQName = new QName( test.getName() );

                        if( ( outerStep.getAxis() == Constants.ATTRIBUTE_AXIS ) || ( outerStep.getAxis() == Constants.DESCENDANT_ATTRIBUTE_AXIS ) ) {
                            contextQName.setNameType( ElementValue.ATTRIBUTE );
                        }
                        contextStep  = firstStep;
                        axis         = outerStep.getAxis();
                        optimizeSelf = true;
                    }
                }
            } else if (firstStep != null && lastStep != null) {
                final NodeTest test = lastStep.getTest();

                if( !test.isWildcardTest() && ( test.getName() != null ) ) {
                    contextQName = new QName( test.getName() );

                    if( ( lastStep.getAxis() == Constants.ATTRIBUTE_AXIS ) || ( lastStep.getAxis() == Constants.DESCENDANT_ATTRIBUTE_AXIS ) ) {
                        contextQName.setNameType( ElementValue.ATTRIBUTE );
                    }
                    contextStep = lastStep;
View Full Code Here

                LOG.trace( "found an index of type: " + Type.getTypeName( indexType ) );
            }

            boolean indexScan = false;
            boolean indexMixed = false;
            QName myContextQName = contextQName;
            if( contextSequence != null ) {
                final IndexFlags iflags     = checkForQNameIndex( idxflags, context, contextSequence, myContextQName );
                boolean    indexFound = false;

                if( !iflags.indexOnQName ) {
View Full Code Here

    _t = _t.getFirstChild();
    arity = (org.exist.xquery.parser.XQueryAST)_t;
    match(_t,INTEGER_LITERAL);
    _t = _t.getNextSibling();
   
          QName qname;
          try {
            qname = QName.parse(staticContext, name.getText(), staticContext.getDefaultFunctionNamespace());
          } catch(XPathException e) {
            // throw exception with correct source location
            e.setLocation(name.getLine(), name.getColumn());
View Full Code Here

      // resize
      final int newSize = names.length * 3 / 2;
            NodeId tnodeIds[] = new NodeId[newSize];
            System.arraycopy(nodeIds, 0, tnodeIds, 0, nodeIds.length);

      QName tnames[] = new QName[newSize];
      System.arraycopy(names, 0, tnames, 0, names.length);
     
      String tvalues[] = new String[newSize];
      System.arraycopy(values, 0, tvalues, 0, values.length);

View Full Code Here

   * @see org.exist.util.serializer.Receiver#startElement(org.exist.dom.QName, org.exist.util.serializer.AttrList)
   */
  public void startElement(QName qname, AttrList attribs) throws SAXException {
    final AttributesImpl a = new AttributesImpl();
    if(attribs != null) {
      QName attrQName;
      for(int i = 0; i < attribs.getLength(); i++) {
        attrQName = attribs.getQName(i);
        a.addAttribute(attrQName.getNamespaceURI(), attrQName.getLocalName(), attrQName.getStringValue(),
            "CDATA", attribs.getValue(i));
      }
    }
    contentHandler.startElement(qname.getNamespaceURI(), qname.getLocalName(), qname.getStringValue(), a);
  }
View Full Code Here

        int prevAttr = nextAttr - 1;
        int attrN;
        //Check if an attribute with the same qname exists in the parent element
        while ((nodeNum > 0) && (prevAttr > -1) && (attrParent[prevAttr] == nodeNum)) {
            attrN = prevAttr--;
            final QName prevQn = attrName[attrN];
            if (prevQn.equalsSimple(qname)) {
                if (replaceAttribute) {
                    attrValue[attrN] = value;
                    attrType[attrN] = type;
                    return attrN;
                } else
View Full Code Here

    * (non-Javadoc)
    *
    * @see org.w3c.dom.Document#createElement(java.lang.String)
    */
    public Element createElement(String tagName) throws DOMException {
        QName qn;
        try {
            qn = QName.parse(getContext(), tagName);
        }
        catch (final XPathException e) {
            throw new DOMException(DOMException.NAMESPACE_ERR, e.getMessage());
View Full Code Here

     */
    public NodeList getElementsByTagName(String name) {
        final NodeListImpl nl = new NodeListImpl();
        for (int i = 1; i < size; i++) {
            if (nodeKind[i] == Node.ELEMENT_NODE) {
                final QName qn = nodeName[i];
                if (qn.getStringValue().equals(name)) {
                    nl.add(getNode(i));
                }
            }
        }
        return nl;
View Full Code Here

TOP

Related Classes of org.exist.dom.QName

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.