私はxmllintをSQLのtransform XMLに使ってみることができます。私はxmllintを使うことができますが見つかりませんでした
私はこのXMLを持っており、私はSQLで変換が必要です。
<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>
I変換
#!/bin/bash
file="$1"
table=$(xmllint --xpath "name()" "$file")
value=$(xmllint --xpath "//*/*/text()" "$file")
cat << EOF
INSERT INTO \`${table}\`
VALUES
(${value})
EOF
そして、私の出力のためxmllintとbashでこのスクリプトを持っている:私はXML_LOAD()を使用しようとすることができ
XPath set is empty
。 SQLサーバーでは私が見つかりませんでした。データはプライベートなので削除されます。