Forcing the output to be XHTML compliant

24 views
Skip to first unread message

TheiGuy

unread,
Apr 9, 2009, 2:56:42 PM4/9/09
to phpQuery
I am using phpQuery to load and manipulate a fragment of XHTML.
However when I go to print the result it forces all single tags such
as <br /> to html versions <br>. Is there a way to force the output to
be XHTML compliant?

Tobiasz Cudnik

unread,
Apr 9, 2009, 5:48:03 PM4/9/09
to phpQuery
XHTML autodetection doesn't work for fragments.You need to specify
content-type ether by using newDocumentXHTML() or manually as param to
newDocument().

TheiGuy

unread,
Apr 9, 2009, 11:18:43 PM4/9/09
to phpQuery
Everytime I try to use newDocumentXHTML I get the error below. I have
checked the fragment and it is valid XHTML.

Fatal error: Uncaught exception 'Exception' with message 'Error
loading XML markup'

Tobiasz Cudnik

unread,
Apr 10, 2009, 2:11:46 AM4/10/09
to phpQuery
Then it may be true ;) How did you checked the fragment ?
You can try to force output by changing $doc->documentWrapper->isXML
flag to true or directly using saveXML() on $doc->document object, but
both ways are not recommended.
Reply all
Reply to author
Forward
0 new messages