Hướng dẫn phpstorm xsd to xml

  1. With the desired Schema .xsd file opened in the active editor tab, choose from the main menu. The Generate Instance Document from Schema dialog opens.

  2. In the Schema Path text box, specify the location of the Schema to base the XML document generation on. By default, the field shows the full path to the current file. Accept this suggestion or click Browse

    Hướng dẫn phpstorm xsd to xml
    and select the desired file in the dialog that opens.

  3. In the Instance Document Name field, specify the name of the output file to place the generated XML in.

  4. Specify the location of the generated document. By default, it will be placed in the same directory as the source Schema file. To specify another location, click Browse and select the desired path in the dialog that opens.

  5. From the Element Name list, select the local name of the global element to be used as the root of the generated XML document.

  6. Specify whether to take restriction and uniqueness particles into consideration by selecting the corresponding checkboxes.

Last modified: 01 August 2022

An XSD (XML Schema Definition) is required for running structure validation checks on a Web content file. PhpStorm can scan any XML file for the existing elements and attributes and generate a Schema for it.

Generate a Schema based on an XML document

  1. With the desired XML document opened in the active editor tab, choose on the main menu. The Generate Schema From Instance Document dialog box opens.

  2. In the Instance Document Path text box, specify the location of the file to be used as the basis for Schema generation. By default, the field shows the full path to the current file. Accept this suggestion or click Browse and select the desired file in the dialog that opens.

  3. In the Result Schema File Name text box, specify the name of the output file to place the generated Schema in.

  4. Specify the location of the generated Schema. By default, the generated Schema file will be placed in the same directory as the source XML instance document. To specify another location, click Browse and select the desired path in the dialog that opens.

  5. From the Design Type drop-down list, select the way to declare elements and complex types.

  6. From the Detect Simple Content Type drop-down list, select the type to use for leaf text.

  7. In the Detect Enumerations Limit text box, type the number of occurrences to cause appearance of the Schema enumeration.

Last modified: 01 August 2022

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

How to: Create an XML document based on an XSD schema

  • Bài viết
  • 06/30/2022
  • 2 phút để đọc

Trong bài viết này

Applies to:

Hướng dẫn phpstorm xsd to xml
Visual Studio
Hướng dẫn phpstorm xsd to xml
Visual Studio for Mac
Hướng dẫn phpstorm xsd to xml
Visual Studio Code

The Generate Sample XML feature generates a sample XML file based on your XML Schema (XSD) file.

You can use this option for the following scenarios:

  • To understand the use of various constructs in your schema.

  • To confirm that the schema does what it is intended to do.

The Generate Sample XML feature is only available on global elements, and requires a valid XML schema set.

This feature typically generates valid XML documents. However, if the schema contains one or more of the following, the sample might not be valid:

  • The xs:key, xs:keyref, and xs:unique identity constraints.

  • xs:pattern facets.

  • Enumerations of the xs:QName type.

  • xs:ENTITY, xs:ENTITIES, and xs:NOTATION types.

Also, note that xs:base64Binary content will be generated only if enumerations occur in the schema for that type.

To generate an XML instance document based on the XSD file

  1. Follow the steps in How to: Create and edit an XSD schema file.

  2. In the XML Schema Explorer, right-click the PurchaseOrder global element, and then select Generate Sample XML.

    When you select this option, the PurchaseOrder.xml file with the following sample XML content will be generated and opened in the XML editor:

    
    
      
        name1
        street1
        city1
        state1
        1
      
      
        name2
        street2
        city2
        state2
        -79228162514264337593543950335
      
      
        name1
        street1
        city1
        state1
        1
      
    
    

Phản hồi

Gửi và xem ý kiến phản hồi dành cho