0

There are several questions with similar titles as this one, asking about using TouchXML with HTML Tidy. But almost all of them were trying to ask how to set up Tidy.

Mine is trying to ask (if you allow me :D) how exactly I can parse HTML with TouchXML.

So

  1. Should I only give XHTML to TouchXML for parsing?

  2. Can TouchXML automatically convert HTML to XHTML, using Tidy? How to do it?

  3. Should I use CXHTMLDocument to construct the docNode?

  4. I searched lots of pages about HTML & TouchXML, but it seems nothing is really useful for how to exactly do it. I also found a tutorial page about TouchXML, but it is for XML. I also found people are talking about turning on some switch in TouchXML for HTML, could you please tell me more about where and how to do those switches?

Sorry, please forgive me being newbie. I just got totally lost.

Thanks

Jackson Tale
  • 25,428
  • 34
  • 149
  • 271
  • This didnt help you? http://stackoverflow.com/questions/5336406/using-touchxml-with-html-tidy – Perception Aug 11 '11 at 12:29
  • @Perception. that post is about how to set up the environment. not a hint for how to use it. – Jackson Tale Aug 11 '11 at 12:49
  • Im pretty sure it answers 1, 2, and part of 4 in your question. What have you tried so far? – Perception Aug 11 '11 at 12:52
  • @Perception. Thanks. So you mean, 1. I can only give XHTML to TouchXML. 2, 4 TOUCHXMLUSETIDY <- use this switch to turn it on? what I have got is I am trying to turn TOUCHXMLUSETIDY on, but no luck. I get the error of "Undefined symbols for architecture armv7: "_OBJC_CLASS_$_CTidy", referenced from: objc-class-ref in...". btw, I installed libtidy and set the header path and set the linker frag. Can you please tell me how to exactly turn it on? – Jackson Tale Aug 11 '11 at 13:02
  • Yea you got it. Question, how did you set your linker flag? The libtidy framework has to be in the list of referenced frameworks for your project. – Perception Aug 11 '11 at 13:26
  • @Perception. my linker flag are -lxml2 -ltidy. Headers are /usr/include/libxml2/** /usr/include/tidy/** referenced frameworks are libtidy.dylib and libxml2.dylib. I suspect i am doing wrong about turn TOUCHXMLUSETIDY on. I just write #define TOUCHXMLUSETIDY in a head file – Jackson Tale Aug 11 '11 at 13:43
  • @Perception let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/2369/discussion-between-jackson-tale-and-perception) – Jackson Tale Aug 11 '11 at 13:44

1 Answers1

2

To enable HTML Tidy in Touch XML, make sure to define TOUCHXMLUSETIDY in your project, before the first include of CTidy.h. Due to some code choices in the Touch XML framework your define cannot be empty. So something like this:

#define TOUCHXMLUSETIDY TRUE

// not

#define TOUCHXMLUSETIDY

That should fix the linking problem you had. I will expand this answer to include more useful information when I get some time.

Perception
  • 79,279
  • 19
  • 185
  • 195
  • This works equally well if you are parsing XML and you want it tidied up automatically. – Edwin May 19 '13 at 00:56