Java Code Examples for com.sun.org.apache.xml.internal.serializer.SerializationHandler

The following examples show how to use com.sun.org.apache.xml.internal.serializer.SerializationHandler. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: TencentKona-8   Author: Tencent   File: SAX2DTM2.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Copy the String value of a Text node to a SerializationHandler
 */
protected final void copyTextNode(final int nodeID, SerializationHandler handler)
    throws SAXException
{
    if (nodeID != DTM.NULL) {
        int dataIndex = m_dataOrQName.elementAt(nodeID);
        if (dataIndex >= 0) {
            m_chars.sendSAXcharacters(handler,
                                      dataIndex >>> TEXT_LENGTH_BITS,
                                      dataIndex & TEXT_LENGTH_MAX);
        } else {
            m_chars.sendSAXcharacters(handler, m_data.elementAt(-dataIndex),
                                      m_data.elementAt(-dataIndex+1));
        }
    }
}
 
Example #2
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: SAX2DTM2.java    License: MIT License 6 votes vote down vote up
/**
 * Copy the String value of a Text node to a SerializationHandler
 */
protected final void copyTextNode(final int nodeID, SerializationHandler handler)
    throws SAXException
{
    if (nodeID != DTM.NULL) {
        int dataIndex = m_dataOrQName.elementAt(nodeID);
        if (dataIndex >= 0) {
            m_chars.sendSAXcharacters(handler,
                                      dataIndex >>> TEXT_LENGTH_BITS,
                                      dataIndex & TEXT_LENGTH_MAX);
        } else {
            m_chars.sendSAXcharacters(handler, m_data.elementAt(-dataIndex),
                                      m_data.elementAt(-dataIndex+1));
        }
    }
}
 
Example #3
Source Project: Bytecoder   Author: mirkosertic   File: MultiDOM.java    License: Apache License 2.0 5 votes vote down vote up
public String shallowCopy(final int node, SerializationHandler handler)
        throws TransletException
{
    if (node == DTM.NULL) {
        return "";
    }
    return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler);
}
 
Example #4
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: AbstractTranslet.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Used by some compiled code as a shortcut for passing strings to the
 * output handler
 */
public final void characters(final String string,
                             SerializationHandler handler)
    throws TransletException {
    if (string != null) {
       //final int length = string.length();
       try {
           handler.characters(string);
       } catch (Exception e) {
           throw new TransletException(e);
       }
    }
}
 
Example #5
Source Project: TencentKona-8   Author: Tencent   File: SimpleResultTreeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL)
    {
        copy(node, handler);
    }
}
 
Example #6
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: DOMAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public void characters(final int textNode, SerializationHandler handler)
  throws TransletException
{
    if (_enhancedDOM != null) {
        _enhancedDOM.characters(textNode, handler);
    }
    else {
        _dom.characters(textNode, handler);
    }
}
 
Example #7
Source Project: openjdk-8-source   Author: keerath   File: MultiDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example #8
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: AdaptiveResultTreeImpl.java    License: Apache License 2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.copy(node, handler);
    }
    else {
        super.copy(node, handler);
    }
}
 
Example #9
Source Project: hottub   Author: dsrg-uoft   File: AdaptiveResultTreeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.copy(node, handler);
    }
    else {
        super.copy(node, handler);
    }
}
 
Example #10
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: AdaptiveResultTreeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Dispatch the character content of a node to an output handler.
 *
 * The escape setting should be taken care of when outputting to
 * a handler.
 */
public void characters(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.characters(node, handler);
    }
    else {
        super.characters(node, handler);
    }
}
 
Example #11
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: AdaptiveResultTreeImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Dispatch the character content of a node to an output handler.
 *
 * The escape setting should be taken care of when outputting to
 * a handler.
 */
public void characters(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.characters(node, handler);
    }
    else {
        super.characters(node, handler);
    }
}
 
Example #12
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: SAXImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Copy the string value of a node directly to an output handler
 */
public void characters(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        try {
            dispatchCharactersEvents(node, handler, false);
        } catch (SAXException e) {
            throw new TransletException(e);
        }
    }
}
 
Example #13
Source Project: openjdk-8   Author: bpupadhyaya   File: SimpleResultTreeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Dispatch the character content of a node to an output handler.
 *
 * The escape setting should be taken care of when outputting to
 * a handler.
 */
public void characters(final int node, SerializationHandler handler)
    throws TransletException
{
    int nodeID = getNodeIdent(node);
    if (nodeID == RTF_ROOT || nodeID == RTF_TEXT) {
        boolean escapeBit = false;
        boolean oldEscapeSetting = false;

        try {
            for (int i = 0; i < _size; i++) {

                if (_dontEscape != null) {
                    escapeBit = _dontEscape.getBit(i);
                    if (escapeBit) {
                        oldEscapeSetting = handler.setEscaping(false);
                    }
                }

                handler.characters(_textArray[i]);

                if (escapeBit) {
                    handler.setEscaping(oldEscapeSetting);
                }
            }
        } catch (SAXException e) {
            throw new TransletException(e);
        }
    }
}
 
Example #14
Source Project: openjdk-8   Author: bpupadhyaya   File: MultiDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
        throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example #15
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: SAXImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Copies a processing instruction node to an output handler
 */
private void copyPI(final int node, SerializationHandler handler)
    throws TransletException
{
    final String target = getNodeName(node);
    final String value = getStringValueX(node);

    try {
        handler.processingInstruction(target, value);
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example #16
Source Project: jdk8u60   Author: chenghanpeng   File: SimpleResultTreeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL)
    {
        copy(node, handler);
    }
}
 
Example #17
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: DOMAdapter.java    License: MIT License 5 votes vote down vote up
public String shallowCopy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_enhancedDOM != null) {
        return _enhancedDOM.shallowCopy(node, handler);
    }
    else {
        return _dom.shallowCopy(node, handler);
    }
}
 
Example #18
Source Project: Bytecoder   Author: mirkosertic   File: SAX2DTM2.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Copy  attribute nodes from an element .
 *
 * @param nodeID The Element node identity
 * @param handler The SerializationHandler
 */
protected final void copyAttributes(final int nodeID, SerializationHandler handler)
    throws SAXException{

   for(int current = getFirstAttributeIdentity(nodeID); current != DTM.NULL; current = getNextAttributeIdentity(current)){
        int eType = _exptype2(current);
        copyAttribute(current, eType, handler);
   }
}
 
Example #19
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: AdaptiveResultTreeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.copy(node, handler);
    }
    else {
        super.copy(node, handler);
    }
}
 
Example #20
Source Project: TencentKona-8   Author: Tencent   File: SAX2DTM2.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copy  attribute nodes from an element .
 *
 * @param nodeID The Element node identity
 * @param handler The SerializationHandler
 */
protected final void copyAttributes(final int nodeID, SerializationHandler handler)
    throws SAXException{

   for(int current = getFirstAttributeIdentity(nodeID); current != DTM.NULL; current = getNextAttributeIdentity(current)){
        int eType = _exptype2(current);
        copyAttribute(current, eType, handler);
   }
}
 
Example #21
Source Project: jdk8u60   Author: chenghanpeng   File: MultiDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
        throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example #22
Source Project: jdk8u60   Author: chenghanpeng   File: SAX2DTM2.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copy an Attribute node to a SerializationHandler
 *
 * @param nodeID The node identity
 * @param exptype The expanded type of the Element node
 * @param handler The SerializationHandler
 */
protected final void copyAttribute(int nodeID, int exptype,
    SerializationHandler handler)
    throws SAXException
{
    /*
        final String uri = getNamespaceName(node);
        if (uri.length() != 0) {
            final String prefix = getPrefix(node);
            handler.namespaceAfterStartElement(prefix, uri);
        }
        handler.addAttribute(getNodeName(node), getNodeValue(node));
    */
    final ExtendedType extType = m_extendedTypes[exptype];
    final String uri = extType.getNamespace();
    final String localName = extType.getLocalName();

    String prefix = null;
    String qname = null;
    int dataIndex = _dataOrQName(nodeID);
    int valueIndex = dataIndex;
        if (dataIndex <= 0) {
            int prefixIndex = m_data.elementAt(-dataIndex);
            valueIndex = m_data.elementAt(-dataIndex+1);
            qname = m_valuesOrPrefixes.indexToString(prefixIndex);
            int colonIndex = qname.indexOf(':');
            if (colonIndex > 0) {
                prefix = qname.substring(0, colonIndex);
            }
        }
        if (uri.length() != 0) {
            handler.namespaceAfterStartElement(prefix, uri);
        }

    String nodeName = (prefix != null) ? qname : localName;
    String nodeValue = (String)m_values.elementAt(valueIndex);

    handler.addAttribute(uri, localName, nodeName, "CDATA", nodeValue);
}
 
Example #23
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: SAXImpl.java    License: MIT License 5 votes vote down vote up
/**
 * Copy a node-set to an output handler
 */
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL) {
        copy(node, handler);
    }
}
 
Example #24
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: SAXImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copy the string value of a node directly to an output handler
 */
public void characters(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        try {
            dispatchCharactersEvents(node, handler, false);
        } catch (SAXException e) {
            throw new TransletException(e);
        }
    }
}
 
Example #25
Source Project: openjdk-8-source   Author: keerath   File: AbstractTranslet.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Calls transform() with a given output handler
 */
public final void transform(DOM document, SerializationHandler handler)
    throws TransletException {
    try {
        transform(document, document.getIterator(), handler);
    } finally {
        _keyIndexes = null;
    }
}
 
Example #26
Source Project: Bytecoder   Author: mirkosertic   File: BasisLibrary.java    License: Apache License 2.0 5 votes vote down vote up
public static void copy(Object obj,
                        SerializationHandler handler,
                        int node,
                        DOM dom) {
    try {
        if (obj instanceof DTMAxisIterator)
  {
            DTMAxisIterator iter = (DTMAxisIterator) obj;
            dom.copy(iter.reset(), handler);
        }
        else if (obj instanceof Node) {
            dom.copy(((Node) obj).node, handler);
        }
        else if (obj instanceof DOM) {
            //((DOM)obj).copy(((com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase)((DOMAdapter)obj).getDOMImpl()).getDocument(), handler);
            DOM newDom = (DOM)obj;
            newDom.copy(newDom.getDocument(), handler);
        }
        else {
            String string = obj.toString();         // or call stringF()
            final int length = string.length();
            if (length > _characterArray.length)
                _characterArray = new char[length];
            string.getChars(0, length, _characterArray, 0);
            handler.characters(_characterArray, 0, length);
        }
    }
    catch (SAXException e) {
        runTimeError(RUN_TIME_COPY_ERR);
    }
}
 
Example #27
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: SimpleResultTreeImpl.java    License: MIT License 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL)
    {
        copy(node, handler);
    }
}
 
Example #28
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: SAX2DTM2.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Copy an Attribute node to a SerializationHandler
 *
 * @param nodeID The node identity
 * @param exptype The expanded type of the Element node
 * @param handler The SerializationHandler
 */
protected final void copyAttribute(int nodeID, int exptype,
    SerializationHandler handler)
    throws SAXException
{
    /*
        final String uri = getNamespaceName(node);
        if (uri.length() != 0) {
            final String prefix = getPrefix(node);
            handler.namespaceAfterStartElement(prefix, uri);
        }
        handler.addAttribute(getNodeName(node), getNodeValue(node));
    */
    final ExtendedType extType = m_extendedTypes[exptype];
    final String uri = extType.getNamespace();
    final String localName = extType.getLocalName();

    String prefix = null;
    String qname = null;
    int dataIndex = _dataOrQName(nodeID);
    int valueIndex = dataIndex;
        if (dataIndex <= 0) {
            int prefixIndex = m_data.elementAt(-dataIndex);
            valueIndex = m_data.elementAt(-dataIndex+1);
            qname = m_valuesOrPrefixes.indexToString(prefixIndex);
            int colonIndex = qname.indexOf(':');
            if (colonIndex > 0) {
                prefix = qname.substring(0, colonIndex);
            }
        }
        if (uri.length() != 0) {
            handler.namespaceAfterStartElement(prefix, uri);
        }

    String nodeName = (prefix != null) ? qname : localName;
    String nodeValue = (String)m_values.elementAt(valueIndex);

    handler.addAttribute(uri, localName, nodeName, "CDATA", nodeValue);
}
 
Example #29
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: SAX2DTM2.java    License: MIT License 5 votes vote down vote up
/**
 * Copy  attribute nodes from an element .
 *
 * @param nodeID The Element node identity
 * @param handler The SerializationHandler
 */
protected final void copyAttributes(final int nodeID, SerializationHandler handler)
    throws SAXException{

   for(int current = getFirstAttributeIdentity(nodeID); current != DTM.NULL; current = getNextAttributeIdentity(current)){
        int eType = _exptype2(current);
        copyAttribute(current, eType, handler);
   }
}
 
Example #30
Source Project: openjdk-8-source   Author: keerath   File: SimpleResultTreeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL)
    {
        copy(node, handler);
    }
}