Exemplo n.º 1
0
 virtual bool operator()(const DOM::Node<string_type, string_adaptor>& node) const
 {
   int type = node.getNodeType();
   return (type == DOM::Node_base::ELEMENT_NODE || type == NAMESPACE_NODE_TYPE) && 
          (name_ == node.getNodeName()) &&
          (string_adaptor::empty(node.getNamespaceURI()));
 } // test
Exemplo n.º 2
0
  virtual bool operator()(const DOM::Node<string_type, string_adaptor>& node) const
  {
    if(node.getNodeType() != DOM::Node_base::PROCESSING_INSTRUCTION_NODE)
      return false;

    if(string_adaptor::empty(target_))
      return true;

    return node.getNodeName() == target_;
  } // test
Exemplo n.º 3
0
 void copy(const DOM::Node<std::string>& node, ExecutionContext& context) const
 {
   switch(node.getNodeType())
   {
   case DOM::Node_base::ATTRIBUTE_NODE:
     context.sink().add_attribute(node.getNamespaceURI(),
                                  node.getLocalName(),
                                  node.getNodeName(),
                                  node.getNodeValue());
     break;
   case DOM::Node_base::COMMENT_NODE:
     context.sink().start_comment();
     context.sink().characters(node.getNodeValue());
     context.sink().end_comment();
     break;
   case DOM::Node_base::DOCUMENT_NODE:
   case DOM::Node_base::DOCUMENT_FRAGMENT_NODE:
     process_content(node, context);
     break;
   case DOM::Node_base::ELEMENT_NODE:
     if(context.sink().start_element(node.getPrefix(), node.getLocalName(), node.getNamespaceURI()))
     {
       process_content(node, context);
       context.sink().end_element(node.getPrefix(), node.getLocalName(), node.getNamespaceURI());
     }
     break;
   case DOM::Node_base::PROCESSING_INSTRUCTION_NODE:
     context.sink().start_processing_instruction(node.getNodeName());
     context.sink().characters(node.getNodeValue());
     context.sink().end_processing_instruction();
     break;
   case DOM::Node_base::TEXT_NODE:
   case DOM::Node_base::CDATA_SECTION_NODE:
     context.sink().characters(node.getNodeValue());
     break;
   } // switch
 } // execute
Exemplo n.º 4
0
 virtual bool operator()(const DOM::Node<string_type, string_adaptor>& node) const
 {
   return node.getNodeType() == DOM::Node_base::ATTRIBUTE_NODE &&
          (name_ == node.getNodeName()) &&
          (string_adaptor::empty(node.getNamespaceURI()));
 } // operator()