in reply to Re^6: XML::LibXML - parsing question!!
in thread XML::LibXML - parsing question!!
Well here goes....
XML
<?xml version="1.0" encoding="UTF-8"?> <instruction_request xmlns="http://www.finra.org/market_reg/admin_serv +er/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.finra.org/market_reg/admin_server/1 +.0 admin_server.xsd"> <request> <!-- The action to be performed => stop / start / reset --> <action_request> <action>START</action> <!-- Application instance information. --> <instance_information> <!-- Application name. --> <application_type> app_type </application_type> <!-- The instance name. --> <application_name> some_app </application_name> <!-- This defines the environment: QC / DEV / PROD -- +> <environment>QC</environment> <!-- This is the IP address of the application that is + --> <!-- being controlled in ASCII dotted-quad notation. + --> <application_host_ip>123.123.24.56</application_host_i +p> <!-- The hostname of the machine on which the machine +is exeucting. --> <application_host_name> somehost.finra.org </applicati +on_host_name> </instance_information> </action_request> </request> <request> <!-- The action to be performed => stop / start / reset --> <action_request> <action>STOP</action> <!-- Application instance information. --> <instance_information> <!-- Application name. --> <application_type> appname </application_type> <!-- The instance name. --> <application_name> app_instance </application_name> <!-- This defines the environment: QC / DEV / PROD -- +> <environment>QC</environment> <!-- This is the IP address of the application that is + --> <!-- being controlled in ASCII dotted-quad notation. + --> <application_host_ip>123.123.24.56</application_host_i +p> <!-- The hostname of the machine on which the machine +is exeucting. --> <application_host_name> somehost.finra.org </applicati +on_host_name> </instance_information> </action_request> </request> <request> <info_request> <action>GET_INFO</action> </info_request> </request> </instruction_request>
XML Schema
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:admin_server="http://www.finra.org/market_reg/admin_server/1 +.0" targetNamespace="http://www.finra.org/market_reg/admin_server/1.0" elementFormDefault="qualified"> <xs:annotation> <xs:appinfo xml:lang="English">This schema defines the XML str +ucture that the admin server expects from the catalyst server.</xs:ap +pinfo> </xs:annotation> <xs:element name="instruction_request"> <xs:annotation> <xs:documentation>The root element. An instruction request + can contain 1 or more requests.</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence maxOccurs="1"> <xs:element name="request" type="admin_server:request_ +choice_type" maxOccurs="unbounded"> <xs:annotation> <xs:documentation>A request must outline: (1) The action to be taken. (2) The application on which action is to be taken. (This can be optio +nal if the action is to request information about all known applicati +on instances.).</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="request_choice_type"> <xs:choice> <xs:element name="action_request" type="admin_server:actio +n_request_type"> <xs:annotation> <xs:documentation>The list of actions that are to +be carried out by the server.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="info_request" type="admin_server:info_re +quest_type"> <xs:annotation> <xs:documentation>The list of information requests +. These are used to request information for specific application inst +ances if specified. If application instances are not specified, the s +erver replies back with information about all instances about which i +t has information.</xs:documentation> </xs:annotation> </xs:element> </xs:choice> </xs:complexType> <xs:complexType name="instance_info_type"> <xs:all> <xs:element name="application_type"> <xs:annotation> <xs:documentation>The type of application. </xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="1"/> <xs:maxLength value="1024"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="application_name"> <xs:annotation> <xs:documentation>The name of the application.</xs +:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="1"/> <xs:maxLength value="1024"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="environment"> <xs:annotation> <xs:documentation>The environment in which the app +lication is executing. The environment types are enumerated. For instance: QC.</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="DEV"> <xs:annotation> <xs:documentation>Development environm +ent.</xs:documentation> </xs:annotation> </xs:enumeration> <xs:enumeration value="QC"> <xs:annotation> <xs:documentation>QC environment.</xs: +documentation> </xs:annotation> </xs:enumeration> <xs:enumeration value="PROD"> <xs:annotation> <xs:documentation>Production environme +nt.</xs:documentation> </xs:annotation> </xs:enumeration> <xs:minLength value="1"/> <xs:maxLength value="4"/> <xs:whiteSpace value="collapse"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="application_host_ip"> <xs:annotation> <xs:documentation>The IP address of the host on wh +ich the application is executing.</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="15"/> <xs:minLength value="7"/> <xs:whiteSpace value="collapse"/> <xs:pattern value="([0-9]{1,3}\.){3}[0-9]{1,3} +"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element minOccurs="0" name="application_host_name"> <xs:annotation> <xs:documentation>The hostname of the machine on w +hich the application is executing.</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="1"/> <xs:maxLength value="1024"/> <xs:whiteSpace value="collapse"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:all> </xs:complexType> <xs:complexType name="action_request_type"> <xs:sequence> <xs:element name="action"> <xs:annotation> <xs:documentation>The action to be taken. The list + of valid actions are enumerated.</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="START"/> <xs:enumeration value="STOP"/> <xs:enumeration value="RESTART"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="instance_information" type="admin_server +:instance_info_type"> <xs:annotation> <xs:documentation>The unique application specifica +tion on which the action is to be taken.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> <xs:complexType name="info_request_type"> <xs:sequence> <xs:element maxOccurs="1" name="action"> <xs:annotation> <xs:documentation>The list of actions to be taken. + In these instance, these are read_only actions. The list of actions +are enumerated.</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="GET_INFO"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element minOccurs="0" name="instance_information" type="admin_server:instance_info_type"> <xs:annotation> <xs:documentation>This is optional in this case. I +f specified, the info is returned about the said instances.</xs:docum +entation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:schema>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: XML::LibXML - parsing question!!
by ikegami (Patriarch) on Dec 20, 2009 at 06:43 UTC | |
|
Re^8: XML::LibXML - parsing question!!
by ikegami (Patriarch) on Dec 21, 2009 at 14:20 UTC | |
by MarkovChain (Sexton) on Dec 22, 2009 at 15:59 UTC |