# Xml schema api

**URL:** <https://rubytalk.org/t/xml-schema-api/16911>\
**Category:** ruby-talk\
**Created:** [13 March 2005 13:05 UTC](https://rubytalk.org/t/xml-schema-api/16911 "2005-03-13T13:05:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gavri\_Fernandez](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@Gavri\_Fernandez](https://rubytalk.org/u/Gavri_Fernandez)\
**Post date:** [13 March 2005 13:05 UTC](https://rubytalk.org/t/xml-schema-api/16911/1 "2005-03-13T13:05:22Z")

</div>

Hi,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Is there a xml schema api  
([http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html](http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html))  
ruby library?

Here are the docs for Apache's Java implementation:  
[http://xml.apache.org/xerces2-j/javadocs/xs/index.html](http://xml.apache.org/xerces2-j/javadocs/xs/index.html)

My intention is create a generator that produces code based on an xml  
schema. This output code, of course, is used to manipulate and more  
importantly \_represent\_ instances of the schema. (i'm creating a  
rest-client generator)

If there is no xml-schema api lib available for ruby, what is the best  
alternative way of doing what I want?

Or is all of this wrong and there is an easier approach?

> **···**
>
> --  
> Gavri  
> [http://gavri.blogspot.com](http://gavri.blogspot.com)

---

<div class="post-metadata">

**Author:** ![Mark\_Volkmann](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@Mark\_Volkmann](https://rubytalk.org/u/Mark_Volkmann)\
**Post date:** [13 March 2005 13:14 UTC](https://rubytalk.org/t/xml-schema-api/16911/2 "2005-03-13T13:14:52Z")

</div>

Quoting Gavri Fernandez \<gavri.fernandez@gmail.com\>:

> Hi,  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Is there a xml schema api

([http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html\](http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html%5C))

> ruby library?

I'm not aware of one. If you end up having to implement this yourself, you may  
find it easier to use RELAX NG instead of XML Schema. If you need to operate  
on existing XML Schemas, there is a tool called Trang that can convert XML  
Schema syntax to RELAX NG syntax. Actually, Trang performs many similar  
conversions.

> **···**
>
> > Here are the docs for Apache's Java implementation:  
> > [XML Schema API](http://xml.apache.org/xerces2-j/javadocs/xs/index.html)
> > 
> > My intention is create a generator that produces code based on an xml  
> > schema. This output code, of course, is used to manipulate and more  
> > importantly \_represent\_ instances of the schema. (i'm creating a  
> > rest-client generator)
> > 
> > If there is no xml-schema api lib available for ruby, what is the best  
> > alternative way of doing what I want?
> > 
> > Or is all of this wrong and there is an easier approach?
> > 
> > --  
> > Gavri  
> > [http://gavri.blogspot.com](http://gavri.blogspot.com)
> 
> --  
> R. Mark Volkmann  
> Partner, Object Computing, Inc.

---

<div class="post-metadata">

**Author:** ![Gavri\_Fernandez](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@Gavri\_Fernandez](https://rubytalk.org/u/Gavri_Fernandez)\
**Post date:** [13 March 2005 14:02 UTC](https://rubytalk.org/t/xml-schema-api/16911/3 "2005-03-13T14:02:42Z")

</div>

Thanks for your comments.  
I do need to operate on existing schemas and it seems TRANG cannot  
convert from XML schema to RELAX NG.

From [Trang](http://www.thaiopensource.com/relaxng/trang.html)  
"A schema written in any of the supported schema languages can be  
converted into any of the other supported schema languages, except  
that W3C XML Schema is supported for output only, not for input."

Or am I misunderstanding this statement?

> **···**
>
> On Sun, 13 Mar 2005 22:14:52 +0900, R. Mark Volkmann \<mark@ociweb.com\> wrote:
> 
> > find it easier to use RELAX NG instead of XML Schema. If you need to operate  
> > on existing XML Schemas, there is a tool called Trang that can convert XML  
> > Schema syntax to RELAX NG syntax. Actually, Trang performs many similar  
> > conversions.
> 
> --  
> Gavri  
> [http://gavri.blogspot.com](http://gavri.blogspot.com)

---

<div class="post-metadata">

**Author:** ![Anonymous\_Coward](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Anonymous\_Coward](https://rubytalk.org/u/Anonymous_Coward)\
**Post date:** [13 March 2005 14:12 UTC](https://rubytalk.org/t/xml-schema-api/16911/4 "2005-03-13T14:12:38Z")

</div>

> > find it easier to use RELAX NG instead of XML Schema. If you need to operate  
> > on existing XML Schemas, there is a tool called Trang that can convert XML  
> > Schema syntax to RELAX NG syntax. Actually, Trang performs many similar  
> > conversions.
> 
> Thanks for your comments.  
> I do need to operate on existing schemas and it seems TRANG cannot  
> convert from XML schema to RELAX NG.
> 
> From [Trang](http://www.thaiopensource.com/relaxng/trang.html)  
> "A schema written in any of the supported schema languages can be  
> converted into any of the other supported schema languages, except  
> that W3C XML Schema is supported for output only, not for input."
> 
> Or am I misunderstanding this statement?

You're right. However, all is not lost: see  
[http://www.relaxng.org/#conversion](http://www.relaxng.org/#conversion)

> Gavri

E

> **···**
>
> On 3/13/2005, "Gavri Fernandez" \<gavri.fernandez@gmail.com\> wrote:
> 
> > On Sun, 13 Mar 2005 22:14:52 +0900, R. Mark Volkmann \<mark@ociweb.com\> wrote:

---

<div class="post-metadata">

**Author:** ![Yohanes\_Santoso1](https://avatars.discourse-cdn.com/v4/letter/y/ccd318/32.png) [@Yohanes\_Santoso1](https://rubytalk.org/u/Yohanes_Santoso1)\
**Post date:** [16 March 2005 17:09 UTC](https://rubytalk.org/t/xml-schema-api/16911/5 "2005-03-16T17:09:10Z")

</div>

ES \<ruby-ml@magical-cat.org\> writes:

> You're right. However, all is not lost: see  
> [RELAX NG home page](http://www.relaxng.org/#conversion)

I've gotten good conversion from Sun's RELAX NG Converter listed in  
that page. 'Good' meaning emacs' nxml-mode (made by the creator of  
RelaxNG, James Clark) accepts the outputted relaxng schema.

YS.
