简体   繁体   English

DOMDocument / DOMXPath

[英]DOMDocument / DOMXPath

I am working with DOMDocument / DOMXPath to try and make CSS inline. 我正在使用DOMDocument / DOMXPath尝试使CSS内联。 It would work perfectly except that the HTML I am passing to it trips it up saying it's not valid XML. 它会完美地工作,除了我传递给它的HTML称它不是有效的XML之外。

How can I set these functions to ignore unknown tags? 如何设置这些功能以忽略未知标签?

Anyway I can make these functions less finicky? 无论如何,我可以减少这些功能的难度? I use the phpQuery classes to manipulate and output everything. 我使用phpQuery类来操纵和输出所有内容。 But when I pass it to the inlinify stuff it breaks. 但是,当我将其传递给inlinize的东西时,它就会破裂。

Other web-based inlinify apps have no problem with the output html I have. 其他基于Web的inlinify应用程序对我拥有的输出html没有问题。

And also.. anyone know a non-DOMDocument / DOMXPath way to do this? 还有..有人知道非DOMDocument / DOMXPath的方法吗? All CSS is between a single style pair of tags. 所有CSS都在一对样式的标记之间。 Maybe fancy regex or phpQuery itself or both? 也许花哨的正则表达式或phpQuery本身或两者兼而有之?

Thanks a ton! 万分感谢!

To be fair, it's not wrong. 公平地说,这没有错。 If you want to load HTML then you should be using DOMDocument::loadHTML*() . 如果要加载HTML,则应使用DOMDocument::loadHTML*()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM