0

Good morning, I am looking to convert html to xml using chilkat library. but it throws this error at me.

import chilkat 

a = "asd asd asd asd"
xml = a.toXml()
print(xml)
Traceback (most recent call last):                                                                                                                                                                                         
  File "C:\Users\acalobish\Desktop\iaa.py", line 4, in <module>                                                                                                                                                            
    xml = a.toXml()                                                                                                                                                                                                        
AttributeError: 'str' object has no attribute 'toXml'   
1
  • This program doesn't actually use chilkat. I think some basic chilkat tutorials, examples and documentation would help. I don't see how we can help any better than resources you can find on the net. Commented Jul 18, 2020 at 4:00

1 Answer 1

1
import chilkat

htmlToXml = chilkat.CkHtmlToXml()

# Indicate the charset of the output XML we'll want.
htmlToXml.put_XmlCharset("utf-8")

success = htmlToXml.ConvertFile("test.html","out.xml")
if (success != True):
    print(htmlToXml.lastErrorText())
else:
    print("Success")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.