Source

perl-XML-LibXML / dom.c

Diff from to
 #endif
 
 /**
- * this is a wrapper function that does the type evaluation for the 
- * node. this makes the code a little more readable in the .XS
- * 
- * the code is not really portable, but i think we'll avoid some 
- * memory leak problems that way.
- **/
-
-const char*
-domNodeTypeName( xmlNodePtr elem ){
-    const char *name = "XML::LibXML::Node";
-
-    if ( elem != NULL ) {
-        char * ptrHlp;
-        switch ( elem->type ) {
-        case XML_ELEMENT_NODE:
-            name = "XML::LibXML::Element";   
-            break;
-        case XML_TEXT_NODE:
-            name = "XML::LibXML::Text";
-            break;
-        case XML_COMMENT_NODE:
-            name = "XML::LibXML::Comment";
-            break;
-        case XML_CDATA_SECTION_NODE:
-            name = "XML::LibXML::CDATASection";
-            break;
-        case XML_ATTRIBUTE_NODE:
-            name = "XML::LibXML::Attr"; 
-            break;
-        case XML_DOCUMENT_NODE:
-        case XML_HTML_DOCUMENT_NODE:
-            name = "XML::LibXML::Document";
-            break;
-        case XML_DOCUMENT_FRAG_NODE:
-            name = "XML::LibXML::DocumentFragment";
-            break;
-        case XML_NAMESPACE_DECL:
-            name = "XML::LibXML::Namespace";
-            break;
-        case XML_DTD_NODE:
-            name = "XML::LibXML::Dtd";
-            break;
-        case XML_PI_NODE:
-            name = "XML::LibXML::PI";
-            break;
-        default:
-            name = "XML::LibXML::Node";
-            break;
-        };
-        return name;
-    }
-    return "";
-}
-
-/**
  * Name: domReadWellBalancedString
  * Synopsis: xmlNodePtr domReadWellBalancedString( xmlDocPtr doc, xmlChar *string )
  * @doc: the document, the string should belong to
 }
 
 /** 
- * encodeString returns an UTF-8 encoded String
- * while the encodig has the name of the encoding of string
- **/ 
-xmlChar*
-domEncodeString( const char *encoding, const xmlChar *string ){
-    xmlCharEncoding enc;
-    xmlChar *ret = NULL;
-    xmlBufferPtr in, out;
-    xmlCharEncodingHandlerPtr coder = NULL;
-    
-    if ( string != NULL ) {
-        if( encoding != NULL ) {
-            xs_warn( encoding );
-            enc = xmlParseCharEncoding( encoding );
-            if ( enc > 1 ) {
-                coder= xmlGetCharEncodingHandler( enc );
-            }
-            else if ( enc == 1 ) {
-                ret = xmlStrdup( string );
-            }
-            else if ( enc == XML_CHAR_ENCODING_ERROR ){
-                xs_warn("no standard encoding\n");
-                coder = xmlFindCharEncodingHandler( encoding );
-            }
-            else {
-                xs_warn("no encoding found\n");
-            }
-
-            if ( coder != NULL ) {
-                xs_warn("coding machine found\n");
-                in    = xmlBufferCreate();
-                out   = xmlBufferCreate();
-                xmlBufferCCat( in, string );
-                if ( xmlCharEncInFunc( coder, out, in ) >= 0 ) {
-                    ret = xmlStrdup( out->content );
-                }
-                else {
-                     xs_warn( "b0rked encoiding!\n");
-                }
-                    
-                xmlBufferFree( in );
-                xmlBufferFree( out );
-            }
-            else {
-                xs_warn("no coder found\n");
-                /* ret = xmlStrdup( string ); */
-            }
-        }
-        else {
-            /* if utf-8 is requested we do nothing */
-            ret = xmlStrdup( string );
-        }
-    }
-    return ret;
-}
-
-/**
- * decodeString returns an $encoding encoded string.
- * while string is an UTF-8 encoded string and 
- * encoding is the coding name
- **/
-char*
-domDecodeString( const char *encoding, const xmlChar *string){
-    char *ret=NULL;
-    xmlCharEncoding enc;
-    xmlBufferPtr in, out;
-    xmlCharEncodingHandlerPtr coder = NULL;
-
-    if ( string != NULL ) {
-        if( encoding != NULL ) {
-            enc = xmlParseCharEncoding( encoding );
-            if ( enc > 1 ) {
-                coder= xmlGetCharEncodingHandler( enc );
-            }
-            else if ( enc == 1 ) {
-                ret = xmlStrdup( string );
-            }
-            else if ( enc == XML_CHAR_ENCODING_ERROR ) {
-                coder = xmlFindCharEncodingHandler( encoding );
-            }
-            else {
-                xs_warn("no encoding found");
-            }
-
-            if ( coder != NULL ) {
-                in  = xmlBufferCreate();
-                out = xmlBufferCreate();
-                    
-                xmlBufferCat( in, string );        
-                if ( xmlCharEncOutFunc( coder, out, in ) >= 0 ) {
-                    ret=xmlStrdup(out->content);
-                }
-                else {
-                    /* printf("decoding error \n"); */
-                }
-            
-                xmlBufferFree( in );
-                xmlBufferFree( out );
-                xmlCharEncCloseFunc( coder );
-            }
-        }
-        else {
-            ret = xmlStrdup(string);
-        }
-    }
-    return ret;
-}
-
-/** 
  * internal helper: insert node to nodelist
  * synopsis: xmlNodePtr insert_node_to_nodelist( leader, insertnode, followup );
  * while leader and followup are allready list nodes. both may be NULL
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.