开发者

Parse XML using a XSD in PHP

开发者 https://www.devze.com 2023-01-06 21:52 出处:网络
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?You can use the DOM or XmlReader extensions

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?


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消