Search in sources :

Example 31 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class SAXToReceiver method endElement.

public void endElement(String uri, String localName, String qName) throws SAXException {
    String prefix = null;
    final int p = qName.indexOf(':');
    if (p > -1) {
        prefix = qName.substring(0, p - 1);
    }
    receiver.endElement(new QName(localName, uri, prefix));
}
Also used : QName(org.exist.dom.QName) XMLString(org.exist.util.XMLString)

Example 32 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class SAXToReceiver method startElement.

public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
    String prefix = null;
    int p = qName.indexOf(':');
    if (p > -1) {
        prefix = qName.substring(0, p - 1);
    }
    final AttrList attrs = new AttrList();
    for (int i = 0; i < atts.getLength(); i++) {
        if (atts.getQName(i).startsWith("xmlns")) {
            continue;
        }
        String attrPrefix = null;
        p = atts.getQName(i).indexOf(':');
        if (p > -1) {
            attrPrefix = atts.getQName(i).substring(0, p - 1);
        }
        int type = AttrImpl.CDATA;
        final String atype = atts.getType(i);
        if ("ID".equals(atype)) {
            type = AttrImpl.ID;
        } else if ("IDREF".equals(atype)) {
            type = AttrImpl.IDREF;
        } else if ("IDREFS".equals(atype)) {
            type = AttrImpl.IDREFS;
        }
        attrs.addAttribute(new QName(atts.getLocalName(i), atts.getURI(i), attrPrefix), atts.getValue(i), type);
    }
    receiver.startElement(new QName(localName, uri, prefix), attrs);
}
Also used : QName(org.exist.dom.QName) XMLString(org.exist.util.XMLString)

Example 33 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class XMLWriter method startElement.

public void startElement(final String namespaceUri, final String localName, final String qname) throws TransformerException {
    if (!declarationWritten) {
        writeDeclaration();
    }
    if (!doctypeWritten) {
        writeDoctype(qname);
    }
    try {
        if (tagIsOpen) {
            closeStartTag(false);
        }
        writer.write('<');
        writer.write(qname);
        tagIsOpen = true;
        try {
            elementName.push(QName.parse(namespaceUri, qname));
        } catch (final QName.IllegalQNameException e) {
            throw new TransformerException(e.getMessage(), e);
        }
    } catch (final IOException ioe) {
        throw new TransformerException(ioe.getMessage(), ioe);
    }
}
Also used : QName(org.exist.dom.QName) IOException(java.io.IOException) TransformerException(javax.xml.transform.TransformerException)

Example 34 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class XHTMLWriter method endElement.

@Override
public void endElement(final QName qname) throws TransformerException {
    final QName xhtmlQName = removeXhtmlPrefix(qname);
    super.endElement(xhtmlQName);
    haveCollapsedXhtmlPrefix = false;
}
Also used : QName(org.exist.dom.QName)

Example 35 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class NamePool method getSharedName.

public QName getSharedName(final QName name) {
    final WrappedQName wrapped = new WrappedQName(name);
    final QName sharedName = pool.putIfAbsent(wrapped, 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.
        return sharedName;
    }
}
Also used : QName(org.exist.dom.QName)

Aggregations

QName (org.exist.dom.QName)271 Test (org.junit.Test)54 Sequence (org.exist.xquery.value.Sequence)39 DBBroker (org.exist.storage.DBBroker)31 MemTreeBuilder (org.exist.dom.memtree.MemTreeBuilder)28 IOException (java.io.IOException)23 Document (org.w3c.dom.Document)23 DocumentSet (org.exist.dom.persistent.DocumentSet)20 Text (org.w3c.dom.Text)20 AttributesImpl (org.xml.sax.helpers.AttributesImpl)18 NameTest (org.exist.xquery.NameTest)17 XPathException (org.exist.xquery.XPathException)17 BrokerPool (org.exist.storage.BrokerPool)15 IllegalQNameException (org.exist.dom.QName.IllegalQNameException)13 Node (org.w3c.dom.Node)12 ReentrantLock (java.util.concurrent.locks.ReentrantLock)11 NodeSet (org.exist.dom.persistent.NodeSet)11 SAXException (org.xml.sax.SAXException)11 DefaultDocumentSet (org.exist.dom.persistent.DefaultDocumentSet)10 MutableDocumentSet (org.exist.dom.persistent.MutableDocumentSet)10