From GridLAB-D Wiki
Jump to: navigation, search

The --xsd command line option is used to request the XML Schema Document or XSD for a GridLAB-D module or class, which described the rules to which XML files that are processed by GridLAB-D must conform.

The primary reason for defining an XML schema is to formally describe an XML document; however the resulting schema has a number of other uses that go beyond simple validation.

Code generation 
The schema can be used to generate code, referred to as XML Data Binding. This code allows contents of XML documents to be treated as objects within the programming environment.
Document generation 
The schema can be used to generate human-readable documentation; this is especially useful where the authors have made use of the annotation elements. No formal standard exists for documentation generation, but a number of tools are available, such as the Xs3p stylesheet, that will produce high quality readable HTML and printed material.

Command line

To generate the XSD for a module, use the syntax

host% gridlabd --xsd module
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/" xmlns="http://www.w3.org/" elementFormDefault="qualified">
  <xs:element name="class_1">
  </xs:element>
  <xs:element name="class_2">
  </xs:element>
  <xs:element name="class_N">
  </xs:element>
</xs:schema>

To generate the XSD for a single class, use the syntax

host% gridlabd --xsd module:class
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/" xmlns="http://www.w3.org/" elementFormDefault="qualified">
  <xs:element name="class">
  </xs:element>
</xs:schema>

See also