SQL에서 XML 변환에 xmllint를 사용해 볼 수 있습니다.xmllint를 사용할 수는 있지만 찾을 수 없습니다.
이 XML이 있고 SQL에서 변환이 필요합니다.
#!/bin/bash
file="$1"
table=$(xmllint --xpath "name()" "$file")
value=$(xmllint --xpath "//*/*/text()" "$file")
cat << EOF
INSERT INTO \`${table}\`
VALUES
(${value})
EOF
그리고 내 출력 변환을위한
<CommunicationLog xmlns="http://knx.org/xml/telegrams/01">
<RecordStart Timestamp="" Mode="" Host="" ConnectionName="" ConnectionOptions="" ConnectorType="" MediumType="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<RecordStart Timestamp="" Mode="" Host="" ConnectionName="" ConnectionOptions="" ConnectorType="" MediumType="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<RecordStop Timestamp="" />
</CommunicationLog>
나는 xmllint가와 bash는이 스크립트가 :
XPath set is empty
내가 (사용 XML_LOAD을 시도 할 수 있습니다) SQL 서버에 있지만 나를 찾지 못했습니다. 비공개 데이터이므로 삭제됩니다.