true_atlantis has asked for the wisdom of the Perl Monks concerning the following question:

So, I am pretty new to XML in general, and am confused about the whole style sheet concept. First, I have been using 'RPC::XML::Client' to send XML requests, but have been given specific XML classes/functions with the arguments that the XML functions are expecting. Now, all I have are many XML style sheets and am trying to get a feel for how to understand the format of the xsd. For example, I have:

<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefa +ult="qualified" attributeFormDefault="unqualified"> <xs:include schemaLocation="archer.xsd"/> <xs:element name="CreateNDTicket"> <xs:complexType> <xs:sequence> <xs:element name="Request"> <xs:complexType> <xs:sequence> <xs:element name="RequestHeader" type="Req +uestHeaderType"/> <xs:element name="RequestBody"> <xs:complexType> <xs:sequence> <xs:element name="CreateCriter +ia"> <xs:complexType> <xs:sequence> <xs:element name=" +SystemId" type="xs:string"/> <xs:element name=" +IndicatorCity" type="xs:string"/> <xs:element name=" +IndicatorState" type="xs:string"/> <xs:element name=" +AlarmStart" type="DateTimeType"/> <xs:element name=" +AttributeList" type="AttributeListType"/> <xs:element name=" +ContactInformation" type="ContactInformationType"/> <xs:element name=" +NextAction" type="xs:string" minOccurs="0"/> <xs:element name=" +ProblemCode" type="xs:string"/> <xs:element name=" +Source" type="xs:string"/> <xs:element name=" +SourceReference" type="xs:string"/> <xs:element name=" +ServiceAffected" type="xs:boolean"/> <xs:element name=" +Worklog" type="WorklogType" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Response" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="ResponseHeader" type="Re +sponseHeaderType"/> <xs:element name="ResponseBody" minOccurs= +"0"> <xs:complexType> <xs:sequence> <xs:element name="TicketId" ty +pe="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Does this mean there is a function called CreateNDTicket that is expecting the arguments SystemId, IndicatorCity, ... , Worklog (variable types defined by xs:string/boolean etc)? Or does it mean there is a function called CreateNDTicket that is expecting an array that starts with 'Request' and contains another array with 'RequestHeader' which contains another array 'RequestBody' etc? Or, am I way off?

I know that types like 'DateTimeType' are defined in the included archer.xsd file.

Thanks.

Replies are listed 'Best First'.
Re: XML xds To RPC::XML::Client call
by Cody Pendant (Prior) on Sep 13, 2007 at 23:55 UTC
    That file describes the format, rather than the content, of an XML-RPC request and its response, i.e. it's a kind of meta-file.

    The "CreateNDTicket" thing is just a wrapper around the description of both the request and the response which identifies it by name.

    So what you've got is a file which says "'CreateNDTicket' is an RPC request, it will send the following kinds of data as a request, and it expects the following kinds of data as the response."

    So, what do you actually need to know -- how to send one of those requests? What to do with the response?

    It's nothing to do with style sheets or XSL as far as I can see.



    Nobody says perl looks like line-noise any more
    kids today don't know what line-noise IS ...
Re: XML xds To RPC::XML::Client call
by starX (Chaplain) on Sep 13, 2007 at 21:05 UTC
    Disclaimer: I'm extremely rusty at this.

    I poked XSL with a stick once upon a time, and found it to be extremely clunky. Hence, I didn't poke around very long. What you need to understand about XSL is that it's intended to define a way of transforming a valid XML document into another type of document. If you wanted to write something in XML and publish it both on the web and as plain text to a list serv, say, this would in theory be a good way of doing it.

    In practice, it's not all that great. 'CreateNDTicket' isn't a function, it's an element (like anything else in XML), which describes how to transform another element. XSL still relies on a processor to parse the XML file into the document type described in the XSL file, though, so you don't "run" an XML Style sheet per se.

    In all honesty, this was right about the same time I started picking up Perl; I want to put this in perspective. For me to learn the XSL markup to create the transformation I was looking for took me a couple weeks and a book. I was able to write a simple XML parser based on what I had gleaned from Learning Perl in a couple afternoons that did the transformation I needed just as well.

    YMMV though, as I said, I only messed with this once because I didn't like it, and that was about 6 or 7 years ago, so maybe I'm remembering wrong.