I want to check an existing XML file's element, if it exists I want it to close window using:
print ("<script>window.close();</script>");
开发者_StackOverflow社区
What exactly I would like to do is, open a specific .xml file, "www.xxxx.com/10/test.xml" for example, and keep opening window by an increasement value of +1 to the '/10/' directory, so it keeps opening /11/, /12/, /13/. . . and so on. Obviously with delay on each window that will be opened, I would like to check if an specific element exists.
For example two types of errors occur in the XML file :
<?xml version="1.0" encoding="UTF-8"?>
<error><![CDATA[This is an error Message, No such thing exists]]></error>
and
<?xml version="1.0" encoding="UTF-8"?>
<msg2><![CDATA[ERROR MSG]]></msg2>
as it keeps opening different directories , ...www.xxxx.com/22/test.xml, on each directory opened I would like to check if <error>
and <msg2>
exists, if it does, I want it to close window, if it doesn't I want to grab <list>
only and show that
For the past week, I've started using Javascript and JQuery I failed because of 'Same origin policy' (also back then it wasn't .xml file) then i went over PHP tried few stuff failed again, and found a way that you can view the html file in xml (using ?xml=1)
How can this be done?
In PHP you can do this quite simply using ( SimpleXML ) like explained in the following question's answer.
Check if xml node exists in PHP
精彩评论