Re: Am I a doofus?
Brought to you by:
bs_php,
nigelswinson
From: Nigel S. <nig...@us...> - 2002-08-07 23:15:24
|
> first off I want to thank you Nigel for the tremendous effort you put into this and I want you to > know that it's greatly appreciated. Keep up the good work. Thanks for your kind comments. :o) > Just to comment on Daniels problems: > > > XPath error in XPath.class.php:1586 In importFromString(): XML error > > in given string on line 1 column 0. Reason:syntax error > > I get the same sort of error - that is varying 'XPath.class.php:####' errors followed by the 'line 1 > column 0' hint. Means you probably need to convert from "tag" to "<tag/>" in your calls to appendChild() etc? > One further problem is in the code below. I know it's a bit lengthy - I hope you won't mind it. > - Begin code ----- > $myindex = new xpath(); > $myindex->setSkipWhiteSpaces($onOff=TRUE); > $myindex->setXmlOption('XML_OPTION_TARGET_ENCODING', 'UTF-8'); > $myindex->importFromString("<searchindex/>"); > $searchindex = $myindex->evaluate("searchindex"); > foreach ($resultarray as $page => $pagename) > { > $xmlpage = $myindex->appendChild("searchindex","<$page/>"); > foreach ($pagename as $itemkey => $itemvalue) > { > $myitem = $myindex->appendChild($xmlpage,"<item/>"); > } > } > $myindex->exportToFile("../search_index.xml"); > - End code ----- > The problem is, that the child in the line '$myitem = $myindex->appendChild($xmlpage,"<item/>");' > doesn't seem to work. Now, if placed outside the foreach loop it does work, which strikes me as odd. > I've tried with manual as well as automatic reindexing, which doesn't seem to have an influence. > I am presented with a blank screen when running the script - no error messages. I'm not really sure what isn't working if anything, or what it's meant to do.... but $resultarray is never set, so it will never execute any of the inside of the foreach($resultarray as ....) loop, hence the above code isn't really going to do a whole lot... > Thank you very much for your time. No problem. It would be most helpful if you could attach .php/.xml/.html files that I can copy out and run and examine the output against your output to a) see if I get the same results and then b) work out if those results are "correct". Cheers, Nigel |