Search in sources :

Example 26 with QName

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

the class EXISerializer method startElement.

@Override
public void startElement(QName qname, AttrList attribs) throws SAXException {
    AttributesImpl attributes = null;
    if (attribs != null) {
        attributes = new AttributesImpl();
        for (int x = 0; x < attribs.size; x++) {
            final QName attribQName = attribs.getQName(x);
            attributes.addAttribute(attribQName.getNamespaceURI(), attribQName.getLocalPart(), attribQName.getStringValue(), UNKNOWN_TYPE, attribs.getValue(x));
        }
    }
    encoder.startElement(qname.getNamespaceURI(), qname.getLocalPart(), null, attributes);
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) QName(org.exist.dom.QName)

Example 27 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 28 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 29 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 30 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)

Aggregations

QName (org.exist.dom.QName)260 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 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 PermissionDeniedException (org.exist.security.PermissionDeniedException)10