Parse XML using a XSD in PHP

后端 未结 2 1911
闹比i
闹比i 2021-01-11 17:32

I have a XML file and a a bunch of XSD files with schemas. How do I parse the XML file using the correct XSD file and schema in PHP?

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-11 18:02

    You can use the DOM or XmlReader extensions

    • DOMDocument::schemaValidate — Validates a document based on a schema
    • XMLReader::setSchema — Validate document against XSD

    to validate documents against a schema.

提交回复
热议问题