287 |
287 |
// for element <eml:eml...> qname is "eml:eml", local name is "eml"
|
288 |
288 |
// for element <acl....> both qname and local name is "eml"
|
289 |
289 |
// uri is namesapce
|
290 |
|
logMetacat.debug("Start ELEMENT(qName) " + qName);
|
291 |
|
logMetacat.debug("Start ELEMENT(localName) " + localName);
|
292 |
|
logMetacat.debug("Start ELEMENT(uri) " + uri);
|
|
290 |
logMetacat.trace("Start ELEMENT(qName) " + qName);
|
|
291 |
logMetacat.trace("Start ELEMENT(localName) " + localName);
|
|
292 |
logMetacat.trace("Start ELEMENT(uri) " + uri);
|
293 |
293 |
|
294 |
294 |
DBSAXNode parentNode = null;
|
295 |
295 |
DBSAXNode currentNode = null;
|
... | ... | |
617 |
617 |
inlineDataNameSpace = null;
|
618 |
618 |
inlineDataNameSpace = new Hashtable<String, String>();
|
619 |
619 |
// write inline data into file
|
620 |
|
logMetacat.debug("the inline element data is: " + inlineElements.toString());
|
|
620 |
logMetacat.trace("the inline element data is: " + inlineElements.toString());
|
621 |
621 |
writeInlineDataIntoFile(inlineDataFileWriter, inlineElements);
|
622 |
622 |
}// else
|
623 |
623 |
|
... | ... | |
756 |
756 |
|
757 |
757 |
/** SAX Handler that is called for each XML text node */
|
758 |
758 |
public void characters(char[] cbuf, int start, int len) throws SAXException {
|
759 |
|
logMetacat.debug("CHARACTERS");
|
|
759 |
logMetacat.trace("CHARACTERS");
|
760 |
760 |
if (!handleInlineData) {
|
761 |
761 |
// buffer all text nodes for same element. This is for if text was
|
762 |
762 |
// split into different nodes
|
... | ... | |
766 |
766 |
// if text buffer .size is greater than max, write it to db.
|
767 |
767 |
// so we can save memory
|
768 |
768 |
if (textBuffer.length() > MAXDATACHARS) {
|
769 |
|
logMetacat.debug("Write text into DB in charaters"
|
|
769 |
logMetacat.trace("Write text into DB in charaters"
|
770 |
770 |
+ " when text buffer size is greater than maxmum number");
|
771 |
771 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek();
|
772 |
772 |
endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer, currentNode);
|
... | ... | |
778 |
778 |
// we don't need to buffer it.
|
779 |
779 |
StringBuffer inlineText = new StringBuffer();
|
780 |
780 |
inlineText.append(new String(cbuf, start, len));
|
781 |
|
logMetacat.debug("The inline text data write into file system: "
|
|
781 |
logMetacat.trace("The inline text data write into file system: "
|
782 |
782 |
+ inlineText.toString());
|
783 |
783 |
writeInlineDataIntoFile(inlineDataFileWriter, inlineText);
|
784 |
784 |
}
|
... | ... | |
787 |
787 |
/** SAX Handler that is called at the end of each XML element */
|
788 |
788 |
public void endElement(String uri, String localName, String qName)
|
789 |
789 |
throws SAXException {
|
790 |
|
logMetacat.debug("End ELEMENT " + qName);
|
|
790 |
logMetacat.trace("End ELEMENT " + qName);
|
791 |
791 |
|
792 |
792 |
if (localName.equals(INLINE) && handleInlineData) {
|
793 |
793 |
// Get the node from the stack
|
794 |
794 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.pop();
|
795 |
|
logMetacat.debug("End of inline data");
|
|
795 |
logMetacat.trace("End of inline data");
|
796 |
796 |
// close file writer
|
797 |
797 |
try {
|
798 |
798 |
inlineDataFileWriter.close();
|
... | ... | |
864 |
864 |
}// else if
|
865 |
865 |
|
866 |
866 |
// write text to db if it is not inline data
|
867 |
|
logMetacat.debug("Write text into DB in End Element");
|
|
867 |
logMetacat.trace("Write text into DB in End Element");
|
868 |
868 |
|
869 |
869 |
// compare top level access module
|
870 |
870 |
if (processingTopLevelAccess && needToCheckAccessModule) {
|
... | ... | |
1022 |
1022 |
endElement.append("</");
|
1023 |
1023 |
endElement.append(qName);
|
1024 |
1024 |
endElement.append(">");
|
1025 |
|
logMetacat.debug("inline endElement: " + endElement.toString());
|
|
1025 |
logMetacat.trace("inline endElement: " + endElement.toString());
|
1026 |
1026 |
writeInlineDataIntoFile(inlineDataFileWriter, endElement);
|
1027 |
1027 |
}
|
1028 |
1028 |
}
|
... | ... | |
1031 |
1031 |
* SAX Handler that receives notification of comments in the DTD
|
1032 |
1032 |
*/
|
1033 |
1033 |
public void comment(char[] ch, int start, int length) throws SAXException {
|
1034 |
|
logMetacat.debug("COMMENT");
|
|
1034 |
logMetacat.trace("COMMENT");
|
1035 |
1035 |
if (!handleInlineData) {
|
1036 |
1036 |
if (!processingDTD) {
|
1037 |
1037 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek();
|
... | ... | |
1058 |
1058 |
inlineComment.append("<!--");
|
1059 |
1059 |
inlineComment.append(new String(ch, start, length));
|
1060 |
1060 |
inlineComment.append("-->");
|
1061 |
|
logMetacat.debug("inline data comment: " + inlineComment.toString());
|
|
1061 |
logMetacat.trace("inline data comment: " + inlineComment.toString());
|
1062 |
1062 |
writeInlineDataIntoFile(inlineDataFileWriter, inlineComment);
|
1063 |
1063 |
}
|
1064 |
1064 |
}
|
... | ... | |
1073 |
1073 |
logMetacat.error("the stack is empty for comment data");
|
1074 |
1074 |
throw new SAXException(error);
|
1075 |
1075 |
}
|
1076 |
|
logMetacat.debug("current node type from xml is COMMENT");
|
1077 |
|
logMetacat.debug("node type from stack: " + node.getNodeType());
|
1078 |
|
logMetacat.debug("current node data from xml is: " + string);
|
1079 |
|
logMetacat.debug("node data from stack: " + node.getNodeData());
|
1080 |
|
logMetacat.debug("node is from stack: " + node.getNodeId());
|
|
1076 |
logMetacat.trace("current node type from xml is COMMENT");
|
|
1077 |
logMetacat.trace("node type from stack: " + node.getNodeType());
|
|
1078 |
logMetacat.trace("current node data from xml is: " + string);
|
|
1079 |
logMetacat.trace("node data from stack: " + node.getNodeData());
|
|
1080 |
logMetacat.trace("node is from stack: " + node.getNodeId());
|
1081 |
1081 |
// if not consistent terminate program and throw a exception
|
1082 |
1082 |
if (!node.getNodeType().equals("COMMENT") || !string.equals(node.getNodeData())) {
|
1083 |
1083 |
logMetacat.error("Inconsistence happened: ");
|
... | ... | |
1095 |
1095 |
* PI may occur before or after the root element.
|
1096 |
1096 |
*/
|
1097 |
1097 |
public void processingInstruction(String target, String data) throws SAXException {
|
1098 |
|
logMetacat.debug("PI");
|
|
1098 |
logMetacat.trace("PI");
|
1099 |
1099 |
if (!handleInlineData) {
|
1100 |
1100 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek();
|
1101 |
1101 |
endNodeId = currentNode.writeChildNodeToDB("PI", target, data, docid);
|
... | ... | |
1106 |
1106 |
inlinePI.append(" ");
|
1107 |
1107 |
inlinePI.append(data);
|
1108 |
1108 |
inlinePI.append("?>");
|
1109 |
|
logMetacat.debug("inline data pi is: " + inlinePI.toString());
|
|
1109 |
logMetacat.trace("inline data pi is: " + inlinePI.toString());
|
1110 |
1110 |
writeInlineDataIntoFile(inlineDataFileWriter, inlinePI);
|
1111 |
1111 |
}
|
1112 |
1112 |
}
|
1113 |
1113 |
|
1114 |
1114 |
/** SAX Handler that is called at the start of Namespace */
|
1115 |
1115 |
public void startPrefixMapping(String prefix, String uri) throws SAXException {
|
1116 |
|
logMetacat.debug("NAMESPACE");
|
|
1116 |
logMetacat.trace("NAMESPACE");
|
1117 |
1117 |
if (!handleInlineData) {
|
1118 |
1118 |
namespaces.put(prefix, uri);
|
1119 |
1119 |
} else {
|
... | ... | |
1129 |
1129 |
// When validation is turned "on", white spaces are reported here
|
1130 |
1130 |
// When validation is turned "off" white spaces are not reported here,
|
1131 |
1131 |
// but through characters() callback
|
1132 |
|
logMetacat.debug("IGNORABLEWHITESPACE");
|
|
1132 |
logMetacat.trace("IGNORABLEWHITESPACE");
|
1133 |
1133 |
if (!handleInlineData) {
|
1134 |
1134 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek();
|
1135 |
1135 |
String data = new String(cbuf, start, len);
|
... | ... | |
1179 |
1179 |
|
1180 |
1180 |
/** SAX Handler that receives notification of end of the document */
|
1181 |
1181 |
public void endDocument() throws SAXException {
|
1182 |
|
logMetacat.debug("end Document");
|
|
1182 |
logMetacat.trace("end Document");
|
1183 |
1183 |
// There are some unchangable subtree didn't be compare
|
1184 |
1184 |
// This maybe cause user change the subtree id
|
1185 |
1185 |
if (!super.getIsRevisionDoc()) {
|
Change the debug level from debug to trace.