List of usage examples for org.w3c.dom Node PROCESSING_INSTRUCTION_NODE
short PROCESSING_INSTRUCTION_NODE
To view the source code for org.w3c.dom Node PROCESSING_INSTRUCTION_NODE.
Click Source Link
ProcessingInstruction
. From source file:org.ajax4jsf.templatecompiler.elements.A4JRendererElementsFactory.java
public TemplateElement getProcessor(final Node nodeElement, final CompilationContext componentBean) throws CompilationException { TemplateElement returnValue = null;/*from w ww . j av a2 s.c o m*/ short nodeType = nodeElement.getNodeType(); if (Node.CDATA_SECTION_NODE == nodeType) { returnValue = new CDATAElement(nodeElement, componentBean); } else if (Node.TEXT_NODE == nodeType) { returnValue = new TextElement(nodeElement, componentBean); } else if (Node.COMMENT_NODE == nodeType) { returnValue = new CommentElement(nodeElement, componentBean); } else if (Node.PROCESSING_INSTRUCTION_NODE == nodeType) { returnValue = new PIElement(nodeElement, componentBean); } else if (Node.ELEMENT_NODE == nodeType) { String className = (String) mapClasses.get(nodeElement.getNodeName()); if (className == null) { className = DEFAULT_CLASS_ELEMENT_PROCESSOR; } if (!className.equals("")) { Class class1; try { log.debug("loading class: " + className); class1 = Class.forName(className); Object[] objects = new Object[2]; objects[0] = nodeElement; objects[1] = componentBean; returnValue = (TemplateElement) class1.getConstructor(paramClasses).newInstance(objects); } catch (InstantiationException e) { throw new CompilationException("InstantiationException: " + e.getLocalizedMessage(), e); } catch (IllegalAccessException e) { throw new CompilationException("IllegalAccessException: " + e.getLocalizedMessage(), e); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); throw new CompilationException("InvocationTargetException: " + e.getMessage(), e); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { throw new CompilationException(" error loading class: " + e.getLocalizedMessage()); } } } return returnValue; }
From source file:org.apache.ode.utils.DOMUtils.java
/** * Deep clone, but don't fry, the given node in the context of the given document. * For all intents and purposes, the clone is the exact same copy of the node, * except that it might have a different owner document. * * This method is fool-proof, unlike the <code>adoptNode</code> or <code>adoptNode</code> methods, * in that it doesn't assume that the given node has a parent or a owner document. * * @param document/*from w ww . j a v a2 s. co m*/ * @param sourceNode * @return a clone of node */ public static Node cloneNode(Document document, Node sourceNode) { Node clonedNode = null; // what is my name? QName sourceQName = getNodeQName(sourceNode); String nodeName = sourceQName.getLocalPart(); String namespaceURI = sourceQName.getNamespaceURI(); // if the node is unqualified, don't assume that it inherits the WS-BPEL target namespace if (Namespaces.WSBPEL2_0_FINAL_EXEC.equals(namespaceURI)) { namespaceURI = null; } switch (sourceNode.getNodeType()) { case Node.ATTRIBUTE_NODE: if (namespaceURI == null) { clonedNode = document.createAttribute(nodeName); } else { String prefix = ((Attr) sourceNode).lookupPrefix(namespaceURI); // the prefix for the XML namespace can't be looked up, hence this... if (prefix == null && namespaceURI.equals(NS_URI_XMLNS)) { prefix = "xmlns"; } // if a prefix exists, qualify the name with it if (prefix != null && !"".equals(prefix)) { nodeName = prefix + ":" + nodeName; } // create the appropriate type of attribute if (prefix != null) { clonedNode = document.createAttributeNS(namespaceURI, nodeName); } else { clonedNode = document.createAttribute(nodeName); } } break; case Node.CDATA_SECTION_NODE: clonedNode = document.createCDATASection(((CDATASection) sourceNode).getData()); break; case Node.COMMENT_NODE: clonedNode = document.createComment(((Comment) sourceNode).getData()); break; case Node.DOCUMENT_FRAGMENT_NODE: clonedNode = document.createDocumentFragment(); break; case Node.DOCUMENT_NODE: clonedNode = document; break; case Node.ELEMENT_NODE: // create the appropriate type of element if (namespaceURI == null) { clonedNode = document.createElement(nodeName); } else { String prefix = namespaceURI.equals(Namespaces.XMLNS_URI) ? "xmlns" : ((Element) sourceNode).lookupPrefix(namespaceURI); if (prefix != null && !"".equals(prefix)) { nodeName = prefix + ":" + nodeName; clonedNode = document.createElementNS(namespaceURI, nodeName); } else { clonedNode = document.createElement(nodeName); } } // attributes are not treated as child nodes, so copy them explicitly NamedNodeMap attributes = ((Element) sourceNode).getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Attr attributeClone = (Attr) cloneNode(document, attributes.item(i)); if (attributeClone.getNamespaceURI() == null) { ((Element) clonedNode).setAttributeNode(attributeClone); } else { ((Element) clonedNode).setAttributeNodeNS(attributeClone); } } break; case Node.ENTITY_NODE: // TODO break; case Node.ENTITY_REFERENCE_NODE: clonedNode = document.createEntityReference(nodeName); // TODO break; case Node.NOTATION_NODE: // TODO break; case Node.PROCESSING_INSTRUCTION_NODE: clonedNode = document.createProcessingInstruction(((ProcessingInstruction) sourceNode).getData(), nodeName); break; case Node.TEXT_NODE: clonedNode = document.createTextNode(((Text) sourceNode).getData()); break; default: break; } // clone children of element and attribute nodes NodeList sourceChildren = sourceNode.getChildNodes(); if (sourceChildren != null) { for (int i = 0; i < sourceChildren.getLength(); i++) { Node sourceChild = sourceChildren.item(i); Node clonedChild = cloneNode(document, sourceChild); clonedNode.appendChild(clonedChild); // if the child has a textual value, parse it for any embedded prefixes if (clonedChild.getNodeType() == Node.TEXT_NODE || clonedChild.getNodeType() == Node.CDATA_SECTION_NODE) { parseEmbeddedPrefixes(sourceNode, clonedNode, clonedChild); } } } return clonedNode; }
From source file:org.apache.xml.security.utils.CachedXPathFuncHereAPI.java
/** * Method getStrFromNode//from w w w . j a va 2 s .c o m * * @param xpathnode * @return the string for the node. */ public static String getStrFromNode(Node xpathnode) { if (xpathnode.getNodeType() == Node.TEXT_NODE) { // we iterate over all siblings of the context node because eventually, // the text is "polluted" with pi's or comments StringBuffer sb = new StringBuffer(); for (Node currentSibling = xpathnode.getParentNode() .getFirstChild(); currentSibling != null; currentSibling = currentSibling.getNextSibling()) { if (currentSibling.getNodeType() == Node.TEXT_NODE) { sb.append(((Text) currentSibling).getData()); } } return sb.toString(); } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) { return ((Attr) xpathnode).getNodeValue(); } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { return ((ProcessingInstruction) xpathnode).getNodeValue(); } return null; }
From source file:org.dita.dost.AbstractIntegrationTest.java
private void removeWorkdirProcessingInstruction(final Element e) { Node n = e.getFirstChild();/* w w w .j a v a2s. c o m*/ while (n != null) { final Node next = n.getNextSibling(); if (n.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE && (n.getNodeName().equals(PI_WORKDIR_TARGET) || n.getNodeName().equals(PI_WORKDIR_TARGET_URI))) { e.removeChild(n); } n = next; } }
From source file:org.dita.dost.reader.ChunkMapReader.java
/** * Read processing metadata from processing instructions. *///from w w w . j a v a 2 s .c om private void readProcessingInstructions(final Document doc) { final NodeList docNodes = doc.getChildNodes(); for (int i = 0; i < docNodes.getLength(); i++) { final Node node = docNodes.item(i); if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { final ProcessingInstruction pi = (ProcessingInstruction) node; if (pi.getNodeName().equals(PI_WORKDIR_TARGET)) { workdir = pi; } else if (pi.getNodeName().equals(PI_WORKDIR_TARGET_URI)) { workdirUrl = pi; } else if (pi.getNodeName().equals(PI_PATH2PROJ_TARGET)) { path2proj = pi; } else if (pi.getNodeName().equals(PI_PATH2PROJ_TARGET_URI)) { path2projUrl = pi; } } } }
From source file:org.dita.dost.writer.ConrefPushParser.java
private void writeNode(final Node node) throws SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE: { final NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { writeNode(children.item(i)); }/*from w w w.j av a2 s .co m*/ break; } case Node.ELEMENT_NODE: final Element e = (Element) node; final AttributesBuilder b = new AttributesBuilder(); final NamedNodeMap atts = e.getAttributes(); for (int i = 0; i < atts.getLength(); i++) { b.add((Attr) atts.item(i)); } final String ns = e.getNamespaceURI() != null ? e.getNamespaceURI() : NULL_NS_URI; getContentHandler().startElement(ns, e.getTagName(), e.getNodeName(), b.build()); final NodeList children = e.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { writeNode(children.item(i)); } getContentHandler().endElement(ns, e.getTagName(), e.getNodeName()); break; case Node.TEXT_NODE: final char[] data = node.getNodeValue().toCharArray(); getContentHandler().characters(data, 0, data.length); break; case Node.PROCESSING_INSTRUCTION_NODE: getContentHandler().processingInstruction(node.getNodeName(), node.getNodeValue()); break; default: throw new UnsupportedOperationException(); } }
From source file:org.eclipse.wst.xsl.xalan.debugger.XalanVariable.java
private String processNodeList(NodeList nodeList) { String value = ""; for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node != null) { int nodeType = node.getNodeType(); if (node.getNodeType() == Node.ELEMENT_NODE) { value = createElement(value, node); }/*from w w w . ja v a 2 s . c om*/ if (nodeType == Node.COMMENT_NODE) { value = value + "<!-- " + node.getNodeValue() + " -->"; } if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) { ProcessingInstruction pi = (ProcessingInstruction) node; value = value + "<?" + pi.getData() + " ?>"; } } } return value; }
From source file:org.erdc.cobie.shared.spreadsheetml.transformation.cobietab.COBieSpreadSheet.java
License:asdf
public static void nodeToStream(Node node, PrintWriter out) { String workSheetName = ""; boolean canonical = false; // is there anything to do? if (node == null) { return;//from w w w . j a v a 2 s. c o m } int type = node.getNodeType(); switch (type) { // print document case Node.DOCUMENT_NODE: { if (!canonical) { out.println("<?xml version=\"1.0\"?>"); } // print(((Document)node).getDocumentElement()); NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { nodeToStream(children.item(iChild), out); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { out.print('<'); out.print(node.getNodeName()); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; if (((node.getNodeName().equalsIgnoreCase("Worksheet") || node.getNodeName().equalsIgnoreCase("ss:Worksheet")) && attr.getName().equalsIgnoreCase("Name")) || attr.getName().equalsIgnoreCase("ss:Name")) { workSheetName = normalize(attr.getNodeValue()); } out.print(' '); out.print(attr.getNodeName()); out.print("=\""); out.print(normalize(attr.getNodeValue())); out.print('"'); } out.print('>'); out.flush(); NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { nodeToStream(children.item(i), out); } } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { nodeToStream(children.item(i), out); } } } else { out.print('&'); out.print(node.getNodeName()); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { out.print(normalize(node.getNodeValue())); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(node.getNodeName()); String data = node.getNodeValue(); if ((data != null) && (data.length() > 0)) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); break; } } if (type == Node.ELEMENT_NODE) { if ((node.getNodeName().equalsIgnoreCase("Worksheet") || node.getNodeName().equalsIgnoreCase("ss:Worksheet")) && (workSheetName.length() > 0)) { out.print(printCOBieSheetDataValidation(workSheetName)); } out.print("</"); out.print(node.getNodeName()); out.print('>'); } out.flush(); }
From source file:org.exist.dom.ElementImpl.java
private Node appendChild(Txn transaction, NodeId newNodeId, NodeImplRef last, NodePath lastPath, Node child, StreamListener listener) throws DOMException { if (last == null || last.getNode() == null) //TODO : same test as above ? -pb {// w w w . java2 s . c o m throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "invalid node"); } final DocumentImpl owner = (DocumentImpl) getOwnerDocument(); DBBroker broker = null; try { broker = ownerDocument.getBrokerPool().get(null); switch (child.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE: appendChildren(transaction, newNodeId, null, last, lastPath, child.getChildNodes(), listener); return null; // TODO: implement document fragments so //we can return all newly appended children case Node.ELEMENT_NODE: // create new element final ElementImpl elem = new ElementImpl( new QName(child.getLocalName() == null ? child.getNodeName() : child.getLocalName(), child.getNamespaceURI(), child.getPrefix()), broker.getBrokerPool().getSymbols()); elem.setNodeId(newNodeId); elem.setOwnerDocument(owner); final NodeListImpl ch = new NodeListImpl(); final NamedNodeMap attribs = child.getAttributes(); int numActualAttribs = 0; for (int i = 0; i < attribs.getLength(); i++) { final Attr attr = (Attr) attribs.item(i); if (!attr.getNodeName().startsWith("xmlns")) { ch.add(attr); numActualAttribs++; } else { final String xmlnsDecl = attr.getNodeName(); final String prefix = xmlnsDecl.length() == 5 ? "" : xmlnsDecl.substring(6); elem.addNamespaceMapping(prefix, attr.getNodeValue()); } } final NodeList cl = child.getChildNodes(); for (int i = 0; i < cl.getLength(); i++) { final Node n = cl.item(i); if (n.getNodeType() != Node.ATTRIBUTE_NODE) { ch.add(n); } } elem.setChildCount(ch.getLength()); if (numActualAttribs != (short) numActualAttribs) { throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "Too many attributes"); } elem.setAttributes((short) numActualAttribs); lastPath.addComponent(elem.getQName()); // insert the node broker.insertNodeAfter(transaction, last.getNode(), elem); broker.indexNode(transaction, elem, lastPath); broker.getIndexController().indexNode(transaction, elem, lastPath, listener); elem.setChildCount(0); last.setNode(elem); //process child nodes elem.appendChildren(transaction, newNodeId.newChild(), null, last, lastPath, ch, listener); broker.endElement(elem, lastPath, null); broker.getIndexController().endElement(transaction, elem, lastPath, listener); lastPath.removeLastComponent(); return elem; case Node.TEXT_NODE: final TextImpl text = new TextImpl(newNodeId, ((Text) child).getData()); text.setOwnerDocument(owner); // insert the node broker.insertNodeAfter(transaction, last.getNode(), text); broker.indexNode(transaction, text, lastPath); broker.getIndexController().indexNode(transaction, text, lastPath, listener); last.setNode(text); return text; case Node.CDATA_SECTION_NODE: final CDATASectionImpl cdata = new CDATASectionImpl(newNodeId, ((CDATASection) child).getData()); cdata.setOwnerDocument(owner); // insert the node broker.insertNodeAfter(transaction, last.getNode(), cdata); broker.indexNode(transaction, cdata, lastPath); last.setNode(cdata); return cdata; case Node.ATTRIBUTE_NODE: final Attr attr = (Attr) child; final String ns = attr.getNamespaceURI(); final String prefix = (Namespaces.XML_NS.equals(ns) ? "xml" : attr.getPrefix()); String name = attr.getLocalName(); if (name == null) { name = attr.getName(); } final QName attrName = new QName(name, ns, prefix); final AttrImpl attrib = new AttrImpl(attrName, attr.getValue(), broker.getBrokerPool().getSymbols()); attrib.setNodeId(newNodeId); attrib.setOwnerDocument(owner); if (ns != null && attrName.compareTo(Namespaces.XML_ID_QNAME) == Constants.EQUAL) { // an xml:id attribute. Normalize the attribute and set its type to ID attrib.setValue(StringValue.trimWhitespace(StringValue.collapseWhitespace(attrib.getValue()))); attrib.setType(AttrImpl.ID); } else { attrName.setNameType(ElementValue.ATTRIBUTE); } broker.insertNodeAfter(transaction, last.getNode(), attrib); broker.indexNode(transaction, attrib, lastPath); broker.getIndexController().indexNode(transaction, attrib, lastPath, listener); last.setNode(attrib); return attrib; case Node.COMMENT_NODE: final CommentImpl comment = new CommentImpl(((Comment) child).getData()); comment.setNodeId(newNodeId); comment.setOwnerDocument(owner); // insert the node broker.insertNodeAfter(transaction, last.getNode(), comment); broker.indexNode(transaction, comment, lastPath); last.setNode(comment); return comment; case Node.PROCESSING_INSTRUCTION_NODE: final ProcessingInstructionImpl pi = new ProcessingInstructionImpl(newNodeId, ((ProcessingInstruction) child).getTarget(), ((ProcessingInstruction) child).getData()); pi.setOwnerDocument(owner); //insert the node broker.insertNodeAfter(transaction, last.getNode(), pi); broker.indexNode(transaction, pi, lastPath); last.setNode(pi); return pi; default: throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "Unknown node type: " + child.getNodeType() + " " + child.getNodeName()); } } catch (final EXistException e) { LOG.warn("Exception while appending node: " + e.getMessage(), e); } finally { if (broker != null) broker.release(); } return null; }
From source file:org.exist.storage.dom.DOMFile.java
/** * Recursive method to retrieve the string values of the root node * and all its descendants./*from w w w . j a v a 2 s . co m*/ */ private void getNodeValue(BrokerPool pool, DocumentImpl doc, ByteArrayOutputStream os, RecordPos rec, boolean isTopNode, boolean addWhitespace) { if (!lock.hasLock()) { LOG.warn("The file doesn't own a lock"); } //Locate the next real node, skipping relocated nodes boolean foundNext = false; do { final DOMFilePageHeader pageHeader = rec.getPage().getPageHeader(); if (rec.offset > pageHeader.getDataLength()) { // end of page reached, proceed to the next page final long nextPage = pageHeader.getNextDataPage(); if (nextPage == Page.NO_PAGE) { SanityCheck.TRACE("Bad link to next page! " + "Offset: " + rec.offset + ", Len: " + pageHeader.getDataLength() + ", Page info : " + rec.getPage().page.getPageInfo()); //TODO : throw exception ? -pb return; } rec.setPage(getDOMPage(nextPage)); dataCache.add(rec.getPage()); rec.offset = LENGTH_TID; } //Position the stream at the very beginning of the record final short tupleID = ByteConversion.byteToShort(rec.getPage().data, rec.offset - LENGTH_TID); rec.setTupleID(tupleID); if (ItemId.isLink(rec.getTupleID())) { //This is a link: skip it //We position the offset *after* the next TupleID rec.offset += (LENGTH_FORWARD_LOCATION + LENGTH_TID); } else { //OK: node found foundNext = true; } } while (!foundNext); final short valueLength = ByteConversion.byteToShort(rec.getPage().data, rec.offset); int realLen = valueLength; rec.offset += LENGTH_DATA_LENGTH; //Check if the node was relocated if (ItemId.isRelocated(rec.getTupleID())) { rec.offset += LENGTH_ORIGINAL_LOCATION; } byte[] data = rec.getPage().data; int readOffset = rec.offset; boolean inOverflow = false; if (valueLength == OVERFLOW) { //If we have an overflow value, load it from the overflow page final long p = ByteConversion.byteToLong(data, rec.offset); data = getOverflowValue(p); //We position the offset *after* the next TID rec.offset += LENGTH_OVERFLOW_LOCATION + LENGTH_TID; realLen = data.length; readOffset = 0; inOverflow = true; } // check the type of the node final short type = Signatures.getType(data[readOffset]); readOffset += StoredNode.LENGTH_SIGNATURE_LENGTH; //Switch on the node type switch (type) { case Node.ELEMENT_NODE: { final int children = ByteConversion.byteToInt(data, readOffset); readOffset += ElementImpl.LENGTH_ELEMENT_CHILD_COUNT; final int dlnLen = ByteConversion.byteToShort(data, readOffset); readOffset += NodeId.LENGTH_NODE_ID_UNITS; final int nodeIdLen = pool.getNodeFactory().lengthInBytes(dlnLen, data, readOffset); readOffset += nodeIdLen; final short attributes = ByteConversion.byteToShort(data, readOffset); //Ignore the following NS data which are of no use //We position the offset *after* the next TID rec.offset += realLen + LENGTH_TID; final boolean extraWhitespace = addWhitespace && (children - attributes) > 1; for (int i = 0; i < children; i++) { //recursive call : we ignore attributes children getNodeValue(pool, doc, os, rec, false, addWhitespace); if (extraWhitespace) { os.write((byte) ' '); } } return; } case Node.TEXT_NODE: case Node.CDATA_SECTION_NODE: { final int dlnLen = ByteConversion.byteToShort(data, readOffset); readOffset += NodeId.LENGTH_NODE_ID_UNITS; final int nodeIdLen = pool.getNodeFactory().lengthInBytes(dlnLen, data, readOffset); readOffset += nodeIdLen; os.write(data, readOffset, realLen - (StoredNode.LENGTH_SIGNATURE_LENGTH + NodeId.LENGTH_NODE_ID_UNITS + nodeIdLen)); break; } case Node.PROCESSING_INSTRUCTION_NODE: { final int dlnLen = ByteConversion.byteToShort(data, readOffset); readOffset += NodeId.LENGTH_NODE_ID_UNITS; final int nodeIdLen = pool.getNodeFactory().lengthInBytes(dlnLen, data, readOffset); readOffset += nodeIdLen; final int targetLen = ByteConversion.byteToInt(data, readOffset); readOffset += 4 + targetLen; os.write(data, readOffset, realLen - (StoredNode.LENGTH_SIGNATURE_LENGTH + NodeId.LENGTH_NODE_ID_UNITS + nodeIdLen + targetLen + 4)); break; } case Node.ATTRIBUTE_NODE: { if (isTopNode) { final int start = readOffset - StoredNode.LENGTH_SIGNATURE_LENGTH; final byte idSizeType = (byte) (data[start] & 0x3); final boolean hasNamespace = (data[start] & 0x10) == 0x10; final int dlnLen = ByteConversion.byteToShort(data, readOffset); readOffset += NodeId.LENGTH_NODE_ID_UNITS; final int nodeIdLen = pool.getNodeFactory().lengthInBytes(dlnLen, data, readOffset); readOffset += nodeIdLen; readOffset += Signatures.getLength(idSizeType); if (hasNamespace) { readOffset += AttrImpl.LENGTH_NS_ID; // skip namespace id final short prefixLen = ByteConversion.byteToShort(data, readOffset); readOffset += AttrImpl.LENGTH_PREFIX_LENGTH; readOffset += prefixLen; // skip prefix } os.write(data, readOffset, realLen - (readOffset - start)); } break; } case Node.COMMENT_NODE: { if (isTopNode) { final int dlnLen = ByteConversion.byteToShort(data, readOffset); readOffset += NodeId.LENGTH_NODE_ID_UNITS; final int nodeIdLen = pool.getNodeFactory().lengthInBytes(dlnLen, data, readOffset); readOffset += nodeIdLen; os.write(data, readOffset, realLen - (StoredNode.LENGTH_SIGNATURE_LENGTH + NodeId.LENGTH_NODE_ID_UNITS + nodeIdLen)); } break; } } if (!inOverflow) { //If it isn't an overflow value, add the value length to the current offset //We position the offset *after* the next TID rec.offset += realLen + LENGTH_TID; } }