Parsing an XML and their respective XSD

2

I need to parse a WADL manually and create an XML specification that I have here.

Example:

- > File YahooSearch.wadl

[...]

<application
* xmlns:yn="urn:yahoo:yn" *
>
  <grammars>
    <include 
      href="NewsSearchResponse.xsd"/>
    <include
      href="NewsSearchError.xsd"/>
  </grammars>

[...]

<method name="GET" id="search">
        <request> 
// Aqui há uma requisição com um paramêtro, 
// eu preciso descrever esse parametro no xml posteriormente criado, até aqui OK, dou um jeito
          <param name="appid" type="xsd:string" 
            style="query" required="true"/>
        </request>
        <response status="200"> 
// Aqui há uma resposta do tipo xml,
// aonde o tipo do objeto no conteúdo é um ResultSet,
// que está sendo referenciado lá em cima e descrito logo abaixo
          <representation mediaType="application/xml"
            element="yn:ResultSet"/>
        </response>
</method>

- > NewsSearchResponse.xsd file:

[...]

<!-- Preciso inserir esse cara de uma forma mais descritiva no novo XML,
ou seja, preciso parsear esse XSD, existe uma API para facilitar isso, se não tenho que ir pegando nó por nó e ir construindo um elemento ? -->

  <xs:complexType name="ResultType">
<xs:sequence>
  <xs:element name="Title" type="xs:string"/>
  <xs:element name="Summary" type="xs:string"/>
  <xs:element name="Url" type="xs:string"/>
  <xs:element name="ClickUrl" type="xs:string"/>
  <xs:element name="NewsSource" type="xs:string"/>
  <xs:element name="NewsSourceUrl" type="xs:string"/>
  <xs:element name="Language" type="xs:string"/>
  <xs:element name="PublishDate" type="xs:string"/>
  <xs:element name="ModificationDate" type="xs:string" minOccurs="0"/>
  <xs:element name="Thumbnail" type="ImageType" minOccurs="0"/>
</xs:sequence>

[...]

What API do you suggest I use for the above case and suggestions on how to do it?

    
asked by anonymous 04.11.2014 / 19:00

0 answers