Sponsored Content
Full Discussion: libxml c
Top Forums Programming libxml c Post 302158169 by shamrock on Monday 14th of January 2008 03:13:24 PM
Old 01-14-2008
Code:
#include <stdio.h>
#include <regex.h>

main(int argc, char *argv[])
{
    char *str, line[BUFSIZ];
    regex_t re;

    
    str = "<cms:CMSContent id=\"leftNav\" />";
    if (regcomp(&re, str, REG_EXTENDED)) {
        perror(argv[0]);
        exit(1); 
    }
    while (gets(line)) {
        if (regexec(&re, line, (size_t) 0, NULL, 0))
            printf("%s\n", line);
        else
            printf("left\n");
    }
}

 

4 More Discussions You Might Find Interesting

1. Programming

libxml c

i have xml file like this <root> <sree> <cnu value="cprogramming"\> </sree> </root> to retrieve the valuse of cnu element i tried the following code Code: void parseDoc() { xmlDocPtr doc; xmlNodePtr cur; doc = xmlParseFile("/usr/share/1.xml"); if (doc == NULL ) {... (1 Reply)
Discussion started by: phani_sree
1 Replies

2. Programming

[libxml++] DOmParser get node value

Hi I wrote the follow code: this->domParser = new xmlpp::DomParser(); this->domParser->set_validate(true); this->domParser->parse_file(*this->xmlFileName); this->doc = this->domParser->get_document(); xmlpp::Node* rootNode = this->doc->get_root_node(); xmlpp::Node::NodeList list =... (0 Replies)
Discussion started by: takeo.kikuta
0 Replies

3. Shell Programming and Scripting

How to nodetype as "ELEMENT_NODE" using xml::libxml in perl?

Hi, I am using xml::libxml. Here is the code. my $parser = XML::LibXML->new(); my $xmldoc = $parser->parse_file ("file.xml") || die("Could not parse config xml file\n"); my $root = $xmldoc->getDocumentElement()|| die("Could not get Document Element \n"); $id="121313131"; # For example... (2 Replies)
Discussion started by: vanitham
2 Replies

4. Programming

Help in libxml++ for Linux

Hi, Using libxml++-2.6, is it possible to change the xsi:noNamespaceSchemaLocation in the root element node? e.g. from <myxml xsi:noNamespaceSchemaLocation="ABC.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> : : </myxml> to <myxml... (1 Reply)
Discussion started by: tanlccc
1 Replies
ENVZ_ADD(3)						     Linux Programmer's Manual						       ENVZ_ADD(3)

NAME
envz_add, envz_entry, envz_get, envz_merge, envz_remove, envz_strip - environment string support SYNOPSIS
#include <envz.h> error_t envz_add(char **envz, size_t *envz_len, const char *name, const char *value); char *envz_entry(const char *envz, size_t *envz_len, const char *name); char *envz_get(const char *envz, size_t *envz_len, const char *name); error_t envz_merge(char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, int override); void envz_remove(char **envz, size_t *envz_len, const char *name); void envz_strip(char **envz, size_t *envz_len); DESCRIPTION
These functions are glibc-specific. An argz vector is a pointer to a character buffer together with a length, see argz_add(3). An envz vector is a special argz vector, namely one where the strings have the form "name=value". Everything after the first '=' is considered to be the value. If there is no '=', the value is taken to be NULL. (While the value in case of a trailing '=' is the empty string "".) These functions are for handling envz vectors. envz_add() adds the string "name=value" (in case value is non-NULL) or "name" (in case value is NULL) to the envz vector (*envz, *envz_len) and updates *envz and *envz_len. If an entry with the same name existed, it is removed. envz_entry() looks for name in the envz vector (envz, envz_len) and returns the entry if found, or NULL if not. envz_get() looks for name in the envz vector (envz, envz_len) and returns the value if found, or NULL if not. (Note that the value can also be NULL, namely when there is an entry for name without '=' sign.) envz_merge() adds each entry in envz2 to *envz, as if with envz_add(). If override is true, then values in envz2 will supersede those with the same name in *envz, otherwise not. envz_remove() removes the entry for name from (*envz, *envz_len) if there was one. envz_strip() removes all entries with value NULL. RETURN VALUE
All envz functions that do memory allocation have a return type of error_t, and return 0 for success, and ENOMEM if an allocation error occurs. CONFORMING TO
These functions are a GNU extension. Handle with care. EXAMPLE
#include <stdio.h> #include <stdlib.h> #include <envz.h> int main(int argc, char *argv[], char *envp[]) { int i, e_len = 0; char *str; for (i = 0; envp[i] != NULL; i++) e_len += strlen(envp[i]) + 1; str = envz_entry(*envp, e_len, "HOME"); printf("%s ", str); str = envz_get(*envp, e_len, "HOME"); printf("%s ", str); exit(EXIT_SUCCESS); } SEE ALSO
argz_add(3) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2007-05-18 ENVZ_ADD(3)
All times are GMT -4. The time now is 08:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy