2012-01-11 2 views
0

내 테이블의 라인을 XML 계층 구조로 변환하려고합니다. MySQL의 테이블은 다음과 같이 구성된다 :Mysql 테이블을 XML 파일로 자동 변환 - 계층 구조 보존

---table structure 

CREATE TABLE IF NOT EXISTS `carrier_template_helper` (
    `carrier_id` int(5) NOT NULL DEFAULT '0', 
    `tarifs_v` int(10) NOT NULL DEFAULT '0', 
    `customer_f` varchar(30) NOT NULL, 
    `templates_f` varchar(30) NOT NULL, 
    `page` int(2) NOT NULL DEFAULT '1', 
    `customer_f_contains_str` varchar(100) NOT NULL, 

replace_str VARCHAR (100) NULL NOT, add_str_before VARCHAR (100) NULL NOT, add_str_after VARCHAR (100) NOT NULL, call_method VARCHAR (50) NOT NULL, NOT NULL DEFAULT 플로트 font_size '8',
add_xy VARCHAR (10) NOT NULL DEFAULT '0 : 0'키를 carrier_id (carrier_id, tarifs_v, customer_f, templates_f)) = ENGINE의 MyISAM 기본 문자 집합 = latin1;

INSERT INTO `carrier_template_helper` (`carrier_id`, `tarifs_v`, `customer_f`, `templates_f`, `page`, `customer_f_contains_str`, `replace_str`, `add_str_before`, `add_str_after`, `call_method`, `font_size`, `add_xy`) VALUES 
(80, 2, 'billing_city', 'posbilling_city', 1, '', '', '', '', 'switch_to_city', 8, ''), 
(80, 2, 'billing_street1', 'posbilling_street1', 1, '', '', '', '', 'switch_to_street1', 8, ''); 

(80, 11, 'billing_city', 'posbilling_city', 1, '', '', '', '', 'switch_to_city', 8, ''), 
(80, 11, 'billing_street1', 'posbilling_street1', 1, '', '', '', '', 'switch_to_street1', 8, ''); ' 

와 나는 의사

내가 정말 자동화 싶어요
<?xml version="1.0"?> 
<!DOCTYPE ...........> 
<carriers> 
<tarifs> 
<customer_f>2</customer_f> 
<tarifs_v>billing_city</tarifs_v> 
<templates_f>posbilling_city</templates_f> 
. 
. 
. 
<tarifs> 

<tarifs> 
<customer_f>11</customer_f> 
<tarifs_v>billing_city</tarifs_v> 
<templates_f>posbilling_city</templates_f> 
. 
. 
. 
<tarifs> 

</carriers> 

에 carrier_id-> tarifs_v의 계층 구조하고 나머지 ... 이런 식으로 뭔가 함께 내 XML이 필요합니다. .. 가장 쉬운 도구는 무엇입니까?

답변

0

-X 옵션과 함께 mysql 콘솔을 사용하여 결과를 XML + XSLT 변환으로 반환합니다.

+0

감사합니다. newtover .... 내가 필요로하는 계층 구조를 어떻게 인식할까요? – Confidence