예제 #1
0
 public void startElement(Txn transaction, ElementImpl element, NodePath path) {
   if (config != null) {
     boolean mixedContent = config.matchMixedElement(path);
     if (mixedContent || config.hasQNameIndex(element.getQName())) {
       ElementContent contentBuf =
           new ElementContent(
               element.getQName(),
               mixedContent || config.preserveMixedContent(element.getQName()));
       contentStack.push(contentBuf);
     }
   }
   super.startElement(transaction, element, path);
 }
예제 #2
0
 public void endElement(Txn transaction, ElementImpl element, NodePath path) {
   if (config != null) {
     boolean mixedContent = config.matchMixedElement(path);
     if (mixedContent || config.hasQNameIndex(element.getQName())) {
       ElementContent contentBuf = (ElementContent) contentStack.pop();
       element.getQName().setNameType(ElementValue.ELEMENT);
       engine.storeText(
           element,
           contentBuf,
           mixedContent ? NativeTextEngine.FOURTH_OPTION : NativeTextEngine.TEXT_BY_QNAME,
           null,
           mode == REMOVE_ALL_NODES);
     }
   }
   super.endElement(transaction, element, path);
 }
예제 #3
0
 public void attribute(Txn transaction, AttrImpl attrib, NodePath path) {
   path.addComponent(attrib.getQName());
   if (config == null || config.matchAttribute(path)) {
     engine.storeAttribute(
         attrib,
         null,
         NativeTextEngine.ATTRIBUTE_NOT_BY_QNAME,
         config,
         mode == REMOVE_ALL_NODES);
   }
   if (config != null && config.hasQNameIndex(attrib.getQName())) {
     engine.storeAttribute(
         attrib, null, NativeTextEngine.ATTRIBUTE_BY_QNAME, config, mode == REMOVE_ALL_NODES);
   }
   path.removeLastComponent();
   super.attribute(transaction, attrib, path);
 }
예제 #4
0
 /**
  * @param transaction
  * @param text
  * @param path
  */
 public void characters(Txn transaction, TextImpl text, NodePath path) {
   if (config == null) {
     engine.storeText(text, NativeTextEngine.TOKENIZE, config, mode == REMOVE_ALL_NODES);
   } else if (config.match(path)) {
     int tokenize =
         config.preserveContent(path)
             ? NativeTextEngine.DO_NOT_TOKENIZE
             : NativeTextEngine.TOKENIZE;
     engine.storeText(text, tokenize, config, mode == REMOVE_ALL_NODES);
   }
   if (!contentStack.isEmpty()) {
     for (int i = 0; i < contentStack.size(); i++) {
       ElementContent next = (ElementContent) contentStack.get(i);
       next.append(text.getXMLString());
     }
   }
   super.characters(transaction, text, path);
 }