libxml2

docs/examples on libxml2 type system?

I'm reading through the libxml2 API and examples on xmlsoft.com and having some real difficulty wrapping my head around the type system. For example, the _xmlAttribute struct has an xmlChar* field called name. This obviously refers to the name of the attribute (e.g., "bar" for the struct tied to the element <foo bar='baz' />). The _xmlAt...

How do you use the --pattern option of xmllint?

I'm trying to see how libxml implements XPath support, so it made sense to me to test using xmllint. However, the obvious option, --pattern, is somewhat obscure, and I ended up using something like the following: test.xml: <foo><bar/><bar/></foo> > xmllint --shell test.xml / > dir /foo ELEMENT foo / > dir /foo/* ELEMENT bar ELEMENT b...

libxml2 xmlChar* cast to char*

How would you convert / cast an xmlChar* to char* from the libxml2 library? Thanks. ...

Parsing XML using libxml

Hello, I've got a small problem with parsing XML. I cannot get the name of a child node. Here's my XML code: <?xml version="1.1" encoding='UTF-8'?> <SceneObject> <ParticleSystem> </ParticleSystem> </SceneObject> Here's how I parse the XML file: SceneObject::SceneObject(const char *_loadFromXMLFile, const char *_childType) { xmlNod...

do i need 32bit libxml2 for python on snow leopard?

i'm having a hell of a time installing scrapy on my sl mbp. it requires libxml2, so i set about installing that. installing it from macports doesn't seem to pull down the python binding. installing it from source through scrapy's instructions (here) does install the python bindings, but when i run 'python -c "import libxml2"' i get an a...

Using perl's XML::LibXML how do you use XML Prefixes and not xmlns attributes?

I believe this question might have been previously attempted in 2006 on a different site. But, my current XML/RDF writer (XML::LibXML 1.70) outputs element namespaces in the form of xmlns attributes. This will exclude people using non-namespace aware parsers who just do a look_down for foaf:Person. I'm wondering if anyone knows of an eas...

Error installing scrapy on Mac Os X 10.6

Trying to install Scrapy on Mac OSX 10.6 using this guide: When running these commands from Terminal: cd libxml2-2.7.3/python sudo make install I get the following error: Making install in . make[1]: *** No rule to make target `../libxslt/libxslt.la', needed by `libxsltmod.la'. Stop. make: *** [install-recursive] Error 1 Followin...

How to parse the content of the tag with attribute in iphone?

I am new to iphone development.I want to parse and retrieve a particular content from the HTML file at the url.I have a sample code from this link http://blog.objectgraph.com/index.php/2010/02/24/parsing-html-iphone-development/ NSData *htmlData = [[NSString stringWithContentsOfURL:[NSURL URLWithString: @"http://www.objectgraph.com/...

I can't use dashes in XPATH on iphone using libxml2

I'm trying to parse HTML data using KissXML for iphone. I've noticed that I can't have dashes in the id() tag, otherwise it won't evaluate. For example, if I'm trying to get the element at I would do id("foo") However, if I try to get at element , and I try id("foo-bar") the libxml2 XPATH engine doesn't seem to return anything. It w...

How do I return '' for an empty node's text() in XPath?

<td></td><td>foo</td> I would like to return ['', 'foo'] but libxml's xpath //td/text() returns just ['foo']. How do I find the empty tag as '' instead of (not matched)? ...

Weird XPath behavior in libxml2

I have this XML tree that looks like this (I've changed the tag names but if you're really clever you may figure out what I'm actually doing.) <ListOfThings> <Thing foo:action="add"> <Bar>doStuff --slowly</Bar> <Index>1</Index> </Thing> <Thing foo:action="add"> <Bar>ping yourMother.net</Bar> <Index>2</In...

Loading a RSA private key from memory using libxmlsec

Hello, I'm currently using libxmlsec into my C++ software and I try to load a RSA private key from memory. To do this, I searched trough the API and found this function. It takes binary data, a size, a format string and several PEM-callback related parameters. When I call the function, it just stucks, uses 100% of the CPU time and nev...

Looking for streaming xml pretty printer in C/C++ using expat or libxml2

I'm looking for a streaming xml pretty printer for C/C++ that's either self contained or that uses libxml2 or expat and has a BSD-ish license. I've searched a bit and not found one. It seems like something that would be generally useful. Am I missing an obvious tool that does this? Background: I have a library that outputs xml without w...

Problem with libxml2 and Unicode char in XML Soap with Qotes (") and &amp;quot;

I'm using libxml2 for SOAP-Actions in an iPhone App. The big problem is that i want send an SQL-Statement with NSString *query = @"SELECT test FROM database WHERE test = \"string\"" But libxml2 converts the qotes " into &amp;quot; Any ideas how to prevent this? ...

Parsing XHTML with inline tags

Hi, I'm trying to parse an XHTML document using TBXML on the iPhone (although I would be happy to use either libxml2 or NSXMLParser if it would be easier). I need to extract the content of the body as a series of paragraphs and maintain the inline tags, for example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/T...

getting namespace using libxml2

Hi, How can i get name space of an xml file using libxml2. ...

NSStrings, C strings, pathnames and encodings in iPhone

I am using libxml2 in my iPhone app. I have an NSString that holds the pathname to an XML file. The pathname may include non-ASCII characters. I want to get a C string representation of the NSString for to pass to xmlReadFile(). It appears that cStringUsingEncoding gives me the representation I seek. I am not clear on which encoding to u...

why libxml2 quotes starting double slash in CDATA with javascript

This is my code: <?php $data = <<<EOL <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html> <script type="text/javascript"> //<![CDATA[ var a = 123; // JS code //]]> </script> </html> EOL; $dom = new DOMDocument(); $dom-...

Errors when using libxml2 wrappers - XPathQuery with iPhone OS 4

Ok I am trying to use libxml2 with the iPhone OS 4.0 SDK, but for some reason it is throwing errors. Is this not supported in iPhone OS 4? ...

getting attributes of href using libxml

Hi, I have xml file nameed Hello as under with starting node as under: /Hello xmlns:xsi: = "some text" xmlns:xsd = "some text" version="1.0"/ I tried to get the first and second attributes of node named Hello, using xmlAttr *attr = nodePtr->properties;//nurrent node is Hello while ( attr ) { NSLog(@"\n Attribute name:%s value...