Click here to Skip to main content
11,492,639 members (59,770 online)
Click here to Skip to main content
Add your own
alternative version

XMLLib for PUGXML with XPath

, 29 Oct 2009 CPOL 88.3K 1K 38
A library for PugXML which implements XPath
// PugXMLNode.h: interface for the CPugXMLNode class.
// Copyright (C) 2003, by John Crane

#if !defined(AFX_PUGXMLNODE_H__5CFCBE10_9047_4EA3_A97B_791F66418629__INCLUDED_)
#define AFX_PUGXMLNODE_H__5CFCBE10_9047_4EA3_A97B_791F66418629__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// Include the Pug XML library.


#include "platform.h"
#include "Array.h"
#include "BString.h"

#include "pugxml.h"
#include <sstream>
#include <io.h>
#include <sys\stat.h>

using namespace std;
using namespace pug;
using namespace blue;
using namespace blue::common;

// CPugXMLNode class wraps xml_node and provides
// XPATH functionality.
class CPugXMLNode : public xml_node
	CPugXMLNode(xml_node_struct* p);
    CPugXMLNode(const xml_node& r);
	virtual ~CPugXMLNode();

    // Query functions
    Array <xml_node_struct*> FindNodes(const char* srch);
    xml_node_struct* FindNode(const char* srch);
    Array<BString> FindValues(const char* srch);
    BString FindValue(const char* srch);

    // Copies an existing tree under a node
    void AppendTree(xml_node& node);

    // Shorthand for something we will do all the time
    xml_node_struct* append_child_element(LPCTSTR szName)
        xml_node node =  xml_node::append_child(node_element);;
        return (xml_node_struct*) node;

class CAddAttributeNodes : public xml_tree_walker
    virtual bool for_each(xml_node& node);

class CDelAttributeNodes : public xml_tree_walker
    virtual bool for_each(xml_node& node);

#endif // !defined(AFX_PUGXMLNODE_H__5CFCBE10_9047_4EA3_A97B_791F66418629__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150520.1 | Last Updated 29 Oct 2009
Article Copyright 2003 by JCrane2
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid