
XML 파서 옵션을 설정할 때, xml_parser_set_option 함수를 호출할 때는 옵션을 설정한 후 xml_parse 함수를 호출하기 전에 호출해야 합니다.
예를 들어, 아래와 같이 옵션을 설정한 후 xml_parse 함수를 호출할 수 있습니다.
#hostingforum.kr
php
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
xml_parse($xml_parser, $xml_string);
xml_parse 함수를 호출한 후 xml_parser_set_option 함수를 호출하여 옵션을 변경할 수 없습니다.
하지만, xml_parser_set_option 함수를 호출할 때 옵션을 변경할 수 있습니다.
예를 들어, 아래와 같이 옵션을 설정한 후 변경할 수 있습니다.
#hostingforum.kr
php
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
xml_parse($xml_parser, $xml_string);
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
이러한 경우, xml_parse 함수가 호출된 후 옵션을 변경하는 것은 의미가 없습니다.
따라서, xml_parser_set_option 함수를 호출할 때는 옵션을 설정한 후 xml_parse 함수를 호출하기 전에 호출하는 것이 좋습니다.
2025-06-10 00:13