Пример #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
Пример #2
0
  virtual bool operator()(const DOM::Node<string_type, string_adaptor>& node) const
  {
    int type = node.getNodeType();
    return (type == DOM::Node_base::DOCUMENT_NODE) || 
           (type == DOM::Node_base::DOCUMENT_FRAGMENT_NODE);

  } // operator()
Пример #3
0
 void do_characters(const std::string& ch)
 {
   DOM::Node<std::string> lc = current().getLastChild();
   if(lc == 0 || lc.getNodeType() != DOM::Node_base::TEXT_NODE)
     current().appendChild(document().createTextNode(ch));
   else
     lc.setNodeValue(lc.getNodeValue() + ch);
 } // do_characters
Пример #4
0
 virtual bool operator()(const DOM::Node<string_type, string_adaptor>& node) const
 {
   int type = node.getNodeType();
   if((type == DOM::Node_base::DOCUMENT_NODE) || 
      (type == DOM::Node_base::DOCUMENT_FRAGMENT_NODE))
     return false;
   return true;
 } // matches
Пример #5
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
Пример #6
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
Пример #7
0
 void do_end_CDATA()
 {
   DOM::Node<std::string> lc = current().getLastChild();
   if(lc.getNodeType() == DOM::Node_base::TEXT_NODE)
     current().replaceChild(document().createCDATASection(lc.getNodeValue()), lc);
 } // do_end_CDATA
Пример #8
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()
Пример #9
0
 virtual bool operator()(const DOM::Node<string_type, string_adaptor>& node) const
 {
   return node.getNodeType() != DOM::Node_base::ATTRIBUTE_NODE;
 } // operator()
Пример #10
0
 virtual bool operator()(const DOM::Node<string_type, string_adaptor>& node) const
 {
   return node.getNodeType() == DOM::Node_base::COMMENT_NODE;
 } // operator()
Пример #11
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);
 } // test