Parse XML using a XSD in PHP

后端 未结 2 1880
闹比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.

    0 讨论(0)
  • 2021-01-11 18:16

    Check this tool - http://github.com/moyarada/XSD-to-PHP. It sounds exactly what you're asking. You can marshal/unmarshal XML usind generated from XSD PHP classes.

    0 讨论(0)
提交回复
热议问题