Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2004, 12:31 PM
lxu lxu is offline
Authorized User
 
Join Date: Oct 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting xsd to xml

I need to convert a .xsd file to .xml file using xslt. Thanks for any suggestion. I have trouble on finding the right xpath. I used the following for loop:

...
<xsl:for-each select="xs:simpleType">
   ...
</xsl:for-each>
...

It does not work.

Here is thexsd file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:simpleType name="CommentTypeCode">
        <xs:annotation>
            <xs:documentation>
                <term name="CommentTypeCode" code-list-type="enumerated" definition="The type of comment being submitted for consideration." source="" alias=""/>
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="General">
                <xs:annotation>
                    <xs:documentation>
                        <term name="General" definition="Comment being submitted is of a general nature." source="" alias=""/>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="Specific">
                <xs:annotation>
                    <xs:documentation>
                        <term name="Specific" definition="Comment being submitted is of a specific nature and includes such things as line number, figure number, paragraph, etc." source="" alias=""/>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

     â€¦â€¦
</xs:schema>

Here is the xml file:

<dataroot>
<Code-Data-1>
  <Code-List-Name>CommentTypeCode</Code-List-Name>
  <Code-List-Type>enumerated</Code-List-Type>
  <definition>Comment Type Code (CommentTypeCode) - The type of comment being submitted for consideration.</definition>
    <LValue>General</LValue>
    <LDefinition>Comment being submitted is of a general nature.</LDefinition>
</Code-Data-1>
<Code-Data-1>
   <Code-List-Name>CommentTypeCode</Code-List-Name>
   <Code-List-Type>enumerated</Code-List-Type>
   <definition>Comment Type Code (CommentTypeCode) - The type of comment being submitted for consideration.</definition>
    <LValue>Specific</LValue>
    <LDefinition>Comment being submitted is of a specific nature and includes such things as line number, figure number, paragraph, etc.</LDefinition>
</Code-Data-1>

….
</dataroot>

Thanks again,

lxu






Similar Threads
Thread Thread Starter Forum Replies Last Post
XML to XSD gagsy Pro Java 0 March 3rd, 2008 02:38 AM
XML validation with XSD ksskumar XML 0 October 12th, 2007 04:46 AM
XML To XML, using XSL & XSD supercop75 XSLT 1 April 8th, 2006 02:48 AM
Validating XML against XSD ShaileshShinde General .NET 0 September 20th, 2005 01:22 AM
ASP with xml (along with .xsd) software_developer_kk Classic ASP Basics 0 April 18th, 2005 12:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.