libxml2

Xmppframework could not build module libxml

久未见 提交于 2019-12-06 09:54:29
On DDXMLNode.h My project import XMPPFramework by cocoapods ,like: pod 'XMPPFramework', '~> 3.6.6' I find some way like: 1. header search paths add "$(SDKROOT)/usr/include/libxml2" 2. Other Linker Flags add "-lxml2" 3. Framework Search Path add "/usr/lib/libxml2.dylib" All not working! Instead of changing path of the files you can do what i have done to resolve my error in Xcode 7.2 beta First check if you have file libxml2.tbd framework and libresolve.tbd framework if not then add it to you project and replace few things #if !(TARGET_IPHONE_SIMULATOR) //@import dnssd; #import <dns_sd.h> #else

How to deal with buffered strings from C in Swift?

时光总嘲笑我的痴心妄想 提交于 2019-12-06 08:44:31
问题 I'm working with libxml2's sax parser to read large xml files. Most callback handlers are provided a NULL terminated char pointer. Using String.fromCString these can be converted to a regular string in Swift. However sax uses a buffer for reading the bytes, so one of the callbacks ( characters ) might be called with part of a string, namely the size of the buffer. This partial string might even start/end halfway a Unicode code point. The callback will be called multi times, until the complete

libxml2 errors. no such file or directory

谁都会走 提交于 2019-12-06 08:18:30
问题 I am having this problem with the libxml2 framework for at least 2 days. Even though there are plenty solutions on the web, none of them seem to work for me. This is what I have attempted so far. 1) Right click Frameworks and add existing Frameworks . Located the libxml2/libxml2.2 and added it into the Frameworks. 2) Clicked Projects -> Edit Project Settings and locate 2 sections: Search Paths and Linking . 3) In Search Paths I typed this in the following line: Header Search Paths: $(SDKROOT)

libxml2 get validation errors

一世执手 提交于 2019-12-06 06:30:38
I am using libxml2 to validate an xml file against an xsd schema. Using xmlSchemaSetParserErrors function, errors are output to stderr. I need to get these validation errors, store them in memory and display to the user. How can I redirect these errors ? Could you provide me some examples ? Thanks, Andrea This example uses the validation callback mechanism of the parser module. The signature of callbacks expected by xmlSchemaSetParserErrors seems to be the same. #include <iostream> #include <cstdarg> #include <cstdio> #include <vector> #include <string> #include <iterator> #include <libxml

libxml2 HTML chunk parsing

有些话、适合烂在心里 提交于 2019-12-06 06:21:09
I'm downloading HTML from a website. The file can be quite large so while the file's downloading, I want to already parse the available chunks of HTML so that the process appears faster for the end-user of my program. I don't have control over how the cunks are generated, so a chunk can begin in the middle of a word, e.g. like so: chunk 1 ---> <div class="storyti chunk 2 ---> tle"><a href="htt chunk 3 ---> p://www.xkcd.com/">XKCD</a> ...and so on. I have seen example where libxml2 was used to parse XML chunks exactly how I described. Can libxml2 also parse HTML chunks? I have checked with tidy

Xml validation with schema header and Catalog lookup

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 05:10:32
How to validate xml (using libxml) file without specifying the schema file explicitly? xsd file is in the header of the xml file. The corresponding xsd file URL should be located in the local file system using a Catalog.xml. Looks like it is not possible at the moment (libxml 2.8.0). This is taken from libxml page ( xmlschemas ): interface to the XML Schemas handling and schema validity checking, it is incomplete right now. As a workaround one may use a combined schema with lots of import elements. Superfluous namespaces may be specified. Finally the combined schema must be passed to the

Speeding up XML schema validations of a batch of XML files against the same XML schema (XSD)

左心房为你撑大大i 提交于 2019-12-06 03:34:23
问题 I would like to speed up the process of validating a batch of XML files against the same single XML schema (XSD). Only restrictions are that I am in a PHP environment. My current problem is that the schema I would like to validate against includes the fairly complex xhtml schema of 2755 lines (http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd). Even for very simple data this takes a long time (around 30 seconds pr. validation). As I have thousands of XML files in my batch, this doesn't

xml indent and newline for new child

有些话、适合烂在心里 提交于 2019-12-06 01:59:52
I have a xml file that looks like a following. <root> <children> <foo1 val="23"/> <foo2 val="14"/> </children> </root> I wish to add a new child with name foo to the node using the functions xmlNewChild() followed by xmlNewProp() . I would like to generate something like the following. <root> <children> <foo1 val="23"/> <foo2 val="14"/> <foo3 val="5"/> </children> </root> However, I always end up with the following. <root> <children> <foo1 val="23"/> <foo2 val="14"/> <foo3 val="5"/></children> </root> I do understand that libxml2 does not favor white spaces by default. However, is there a way

A swiftier way to convert String to UnsafePointer<xmlChar> in Swift 3 (libxml2)

早过忘川 提交于 2019-12-06 00:13:51
问题 I'm working on a Swift 3 wrapper for the libxml2 C-library. There are two convenience methods to convert String to UnsafePointer<xmlChar> and vice versa. In libxml2 xmlChar is declared as unsigned char . UnsafePointer<xmlChar> to String is uncomplicated func stringFrom(xmlchar: UnsafePointer<xmlChar>) -> String { let string = xmlchar.withMemoryRebound(to: CChar.self, capacity: 1) { return String(validatingUTF8: $0) } return string ?? "" } For String to UnsafePointer<xmlChar> I tried many

What is the right way to get attribute value in libXML sax parser (C++)?

可紊 提交于 2019-12-05 22:01:46
I am using the SAX interface of libXML to write a XML parser application in C++. <abc value="xyz "pqr""/> how do I parse this attribute? I tried using void startElementNsSAX2Func(void * ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar ** namespaces, int nb_attributes, int nb_defaulted, const xmlChar ** attributes) , incrementing attributes parameter( and checking for a " to indicate the end of the attribute value). It works for all the attributes other than *"* appearing in the attribute value. What is the right method to parse these