示例#1
0
/* Ends an XML element */
static void XMLCALL endElement(void *userData, const char *name) {
	ap_filter_t* filter = (ap_filter_t*) userData;
	xmlEntConfig* config = ap_get_module_config( 
			filter->r->per_dir_config, &xmlent_module );
	if (!strncmp(config->contentType, MODXMLENT_CONFIG_CONTENT_TYPE_DEFAULT, 9)
			&& isEmptyElement(name)) { 
		return;
	}
	_fwrite( filter, "</%s>", name );
	if(!strcmp(name, "script")) 
		xmlEntInScript = 1;
}
示例#2
0
/* Starts an XML element */
static void XMLCALL startElement(void *userData, const char *name, const char **atts) {
	ap_filter_t* filter = (ap_filter_t*) userData;
	xmlEntConfig* config = ap_get_module_config( 
			filter->r->per_dir_config, &xmlent_module );
	_fwrite(filter, "<%s", name );
	printAttr( filter, atts );
	if (!strncmp(config->contentType, MODXMLENT_CONFIG_CONTENT_TYPE_DEFAULT, 9)
		&& isEmptyElement(name)) {
		_fwrite(filter, " />", name );
	} else {
		_fwrite(filter, ">", name );
	}
	if(!strcmp(name, "script")) 
		xmlEntInScript = 1;
}
示例#3
0
void
Reader::dumpNode(bsl::ostream & os) const
{
    const char *name  = nodeName();
    const char *value = nodeValue();
    const char *nsUri = nodeNamespaceUri();

    int      line   = getLineNumber();
    int      column = getColumnNumber();
    int      depth  = nodeDepth();
    NodeType type   = nodeType();

    bsl::string strPad((bsl::string::size_type)depth*2, ' ');

    os << strPad
       << "Node pos="  << line  << ":" << column
       << " type=" << type
       << "(" << nodeTypeAsString(type)
       << ") empty=" << isEmptyElement()
       << " hasValue=" << nodeHasValue()
       << " name=" << CHK(name)
       << " value=" <<  CHK(value)
       << " uri=" << CHK(nsUri)
       << bsl::endl;

    int numAttr  = numAttributes();

    for (int i = 0; i < numAttr; ++i)
    {
        ElementAttribute attr;
        lookupAttribute(&attr, i);

        os << strPad
           << "  ATTRIBUTE  "
           << CHK(attr.qualifiedName())
           << "="
           << CHK(attr.value())
           << " uri="
           << CHK(attr.namespaceUri())
           << bsl::endl;
    }
}