Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #280 from adamretter/develop

[doc] Added javadoc about Element serialization
  • Loading branch information...
commit 88da1a2d0689d7d3db56134dfbc9a5bbe46390e9 2 parents 05f9727 + ec9527a
@wolfgangmm wolfgangmm authored
Showing with 39 additions and 0 deletions.
  1. +39 −0 src/org/exist/dom/ElementImpl.java
View
39 src/org/exist/dom/ElementImpl.java
@@ -166,6 +166,44 @@ public boolean declaresNamespacePrefixes() {
return (namespaceMappings.size() > 0);
}
+ /**
+ * Serializes a (persistent DOM) Element to a byte array
+ *
+ * data = signature childCount nodeIdUnitsLength nodeId attributesCount localNameId namespace? prefixData?
+ *
+ * signature = 0x20 | localNameLength | hasNamespace? | isDirty?
+ *
+ * localNameLength = noContent OR intContent OR shortContent OR byteContent
+ * noContent = 0x0
+ * intContent = 0x1
+ * shortContent = 0x2
+ * byteContent = 0x3
+ *
+ * hasNamespace = 0x10
+ *
+ * isDirty = 0x8
+ *
+ * childCount = [int] (4 bytes) The number of child nodes
+ * nodeIdUnitsLength = [short] (2 bytes) The number of units of the element's NodeId
+ * nodeId = @see org.exist.numbering.DLNBase#serialize(byte[], int)
+ * attributesCount = [short] (2 bytes) The number of attributes
+ *
+ * localNameId = [int] (4 bytes) | [short] (2 bytes) | [byte] 1 byte. The Id of the element's local name from SymbolTable (symbols.dbx)
+ *
+ * namespace = namespaceUriId namespacePrefixLength elementNamespacePrefix?
+ * namespaceUriId = [short] (2 bytes) The Id of the namespace URI from SymbolTable (symbols.dbx)
+ * namespacePrefixLength = [short] (2 bytes)
+ * elementNamespacePrefix = eUtf8
+ *
+ * eUtf8 = @see org.exist.util.UTF8#encode(java.lang.String, byte[], int)
+ *
+ * prefixData = namespaceMappingsCount namespaceMapping+
+ * namespaceMappingsCount = [short] (2 bytes)
+ * namespaceMapping = namespacePrefix namespaceUriId
+ * namespacePrefix = jUtf8
+ *
+ * jUtf8 = @see java.io.DataOutputStream#writeUTF(java.lang.String)
+ */
@Override
public byte[] serialize() {
if (nodeId == null)
@@ -188,6 +226,7 @@ public boolean declaresNamespacePrefixes() {
}
prefixData = bout.toByteArray();
}
+
final short id = symbols.getSymbol(this);
final boolean hasNamespace = nodeName.needsNamespaceDecl();
short nsId = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.