2009-06-26 2 views
1

안녕하세요, this function을 사용하여 배송 계산기를 배포하고 있으며 IE를 사용할 때만이 오류가 발생합니다. 파이어 폭스는 배송 계산기로 잘 처리됩니다. 나는이 오류에 익숙하지 않고, Google 검색은 xml 형식의 문제라고 말해 준다. 문제점 : UPS 배송 계산 서버의 XML 응답에이 내용이 없어야합니다. 제 질문은, 그 버그가 어디 있다고 생각합니까? 확인하고 싶은 답변과 제안에 감사드립니다. 나는 공백을 그리고있다.php, xml, ups shipping : "XSL을 사용하여 XML 입력을 볼 수 없습니다 ..."버그는 어디에 있습니까?

오류 IE를 사용하여 (VRS 8. 7, 6) :

는 XML 페이지 는 XSL 스타일을 시트를 사용하여 XML 입력을 볼 수 없습니다 표시 할 수 없습니다. 오류를 수정하고 을 클릭 한 다음 새로 고침 버튼을 클릭하거나 나중에 을 다시 시도하십시오.


주석에 올바르지 않은 구문이 사용되었습니다. 오류 프로세싱 리소스 'http://mgxvideo.com/mgxcopy-alpha-3/shopping/cart_displa ...

<!------------------- main content -------------------------> 

----------^서버로부터 요청 PHP 코드

비중 :

$ch = curl_init("https://www.ups.com/ups.app/xml/Rate"); 
     curl_setopt($ch, CURLOPT_HEADER, 1); 
     curl_setopt($ch,CURLOPT_POST,1); 
     curl_setopt($ch,CURLOPT_TIMEOUT, 90); 
     curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
     curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); 
     curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); 
     curl_setopt($ch,CURLOPT_POSTFIELDS,$data); 
     $result=curl_exec ($ch); 
    echo '<!-- '. $result. ' -->'; // THIS LINE IS FOR DEBUG PURPOSES ONLY-IT WILL SHOW IN HTML COMMENTS 
     $data = strstr($result, '<?'); 
     $xml_parser = xml_parser_create(); 
     xml_parse_into_struct($xml_parser, $data, $vals, $index); 
     xml_parser_free($xml_parser); 
     $params = array(); 
     $level = array(); 
     foreach ($vals as $xml_elem) { 
     if ($xml_elem['type'] == 'open') { 
     if (array_key_exists('attributes',$xml_elem)) { 
      list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']); 
     } else { 
      $level[$xml_elem['level']] = $xml_elem['tag']; 
     } 
     } 
     if ($xml_elem['type'] == 'complete') { 
     $start_level = 1; 
     $php_stmt = '$params'; 
     while($start_level < $xml_elem['level']) { 
      $php_stmt .= '[$level['.$start_level.']]'; 
      $start_level++; 
     } 
     $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];'; 
     eval($php_stmt); 
     } 
     } 
     curl_close($ch); 
     #print_r($params); 
     #echo "<br/><br/>"; 
     return $params['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['TOTALCHARGES']['MONETARYVALUE']; 

위의 코드에서 "이 라인은 디버그 목적만을위한 것입니다"라는 라인이 있습니다 :

<!-- HTTP/1.1 100 Continue 

HTTP/1.1 200 OK 
Date: Fri, 26 Jun 2009 21:58:04 GMT 
Server: Apache 
Pragma: no-cache 
Content-Length: 1524 
Content-Type: application/xml 

<?xml version="1.0"?><RatingServiceSelectionResponse><Response><TransactionReference><CustomerContext>Bare Bones Rate Request</CustomerContext><XpciVersion>1.0</XpciVersion></TransactionReference><ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription></Response><RatedShipment><Service><Code>02</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.34</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.34</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>2</GuaranteedDaysToDelivery><ScheduledDeliveryTime></ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.34</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.34</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment></RatingServiceSelectionResponse> --> 

아이디어가 있으십니까?

+0

그래서 댓글이 제대로 작성되지 않은 것은 문제가되는 페이지였습니다. 은 분명히 즉 어떤 이유로 든 불법입니다. 이제 내 문제는 페이지가 렌더링 된 html 대신 html 코드를 표시한다는 것입니다. – montooner

+0

제목에 "[해결]"을 추가 할 필요없이 대답의 윤곽선이있는 확인 표시를 클릭하여 답변을 수락 할 수 있습니다 (자신의 대답 일 수도 있음). – VolkerK

답변

4

기술적으로 XML 주석 안에 '-'기호를 사용할 수 없습니다. 그래서 당신은 변경해야합니다 :

<!------------------- main content -------------------------> 

<!--     main content      --> 

에 ... 또는 이와 유사한. UPS가 UPS를 보내면. 브라우저로 보내기 전에 대체 할 수 있습니다. 마크 업이 아닌 렌더링 된 HTML을 표시에 관한

편집

: 당신이 (< RatingServiceSelectionResponse 등) 파이어 폭스와 같은 일을 보는 경우 그 HTML이 아니다 - 그것은 XML입니다. XSLT로 변환하거나 XPath (또는 XQuery 등)를 사용하여 특정 값을 가져올 수 있습니다. 당신이 참조한 ups-php API에서 $ myRate-> getRate() 함수를 사용할 수도있는 것처럼 보입니다.

+0

srsly? 코멘트를위한 thx. 렌더링 된 html은 html에서 구문 오류를 처벌하는 ie8의 방식 인 것으로 보입니다. 구문 오류가 발생할 때까지 모든 코드를 렌더링하고 강조 표시하고 "div 태그가 여는 br 태그와 일치하지 않습니다"라고 말합니다. 그 특별한 오류는 지체되었다. wt 태그가 일치하지 않습니다. 알아요? – montooner

1

문제는 html 형식이 잘못되었습니다. 나는 내 의견을 모두 지웠고 어떤 이유로 지금은 더 잘 작동하고 있습니다.

관련 문제