거대한 데이터 크기를 가진 XML 파일이 있습니다. XML 파일이SAX Python을 사용하여 XML을 CSV로 변환
<us-bibliographic-data-grant>
<publication-reference>
<document-id>
<country>US</country>
<doc-number>D0607176</doc-number>
<kind>S1</kind>
<date>20100105</date>
</document-id>
</publication-reference>
<application-reference appl-type="design">
<document-id>
<country>US</country>
<doc-number>29327507</doc-number>
<date>20081107</date>
</document-id>
</application-reference>
<invention-title id="d0e55">Doughnut product with six appendages</invention-title>
<applicants>
<applicant sequence="001" app-type="applicant-inventor" designation="us-only">
<addressbook>
<last-name>Peters</last-name>
<first-name>Brian Jeffery</first-name>
<address>
<street>7052 Moonlight Cir.</street>
<city>Huntington Beach</city>
<state>CA</state>
<postcode>92647</postcode>
<country>US</country>
</address>
</addressbook>
<nationality>
<country>omitted</country>
</nationality>
<residence>
<country>US</country>
</residence>
</applicant>
</applicants>
</us-bibliographic-data-grant>
를 포함한다
는하는 방법이있다, 나는 모든 XML에 아무런 경험이없는이
last-name,first-name,street,city,state,postcode,country
peters,brian jeffery, 7052 moonlight cir.,huntington beach,CA,92647
같은 출력이 XML 코드에서 도와주세요 얻을 수 있습니다 <addressbook>
의 다수 그러면 첫 번째 행에있는 applicant
내부의 모든 속성을 얻으려면 어떻게해야하며 다음 행은 모든 값으로 채워집니다. 나중에 ssql 파일로 CSV 파일을 가져 오기 때문에이 작업을 수행하려고합니다.
이 XML은 유효하지 않습니다. – dawg
왜? 난 그저 그 부분을 복사, 너무 많은 endElements하지 않은 일부 startElements는 –
붙여 넣기 XML을 [여기] (http://www.xmlvalidation.com) 또는 다른 유효성 검사기. 파서를 통해 실행 해보십시오. 유효하지 않거나 완전하게 형성되지 않았습니다. – dawg