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 April 26th, 2006, 06:27 AM
Authorized User
 
Join Date: Jan 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default child element

hello

I am trying to write an element with childs. I write this:

<xs:element name="application">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="integration"/>
                <xs:element ref="pw"/>
                <xs:element ref="sla-entity"/>
                <xs:element ref="collection"/>
                <xs:element ref="service-time"/>
                <xs:element ref="zoom-displays"/>
                <xs:element ref="performace"/>
            </xs:sequence>
            <xs:attribute name="tid" type="xs:integer" use="required"/>
            <xs:attribute name="internal_name" type="xs:string" use="required"/>
            <xs:attribute name="guid" type="xs:integer" use="required"/>
            <xs:attribute name="id" type="xs:integer" use="required"/>
            <xs:attribute name="range" type="xs:integer" use="required"/>
        </xs:complexType>
        <xs:element name="integration">
            <xs:complexType>
                <xs:attribute name="network" type="xs:string"/>
                <xs:attribute name="availability" type="xs:string"/>
                <xs:attribute name="instace-is-server" type="xs:string"/>
                <xs:attribute name="agent-type" type="xs:string"/>
                <xs:attribute name="alerts" type="xs:string"/>
                <xs:attribute name="foresight" type="xs:string"/>
            </xs:complexType>
        </xs:element>
        <xs:element name="collection">
            <xs:complexType>
                <xs:attribute name="dir" type="xs:string" use="required"/>
                <xs:attribute name="remote" type="xs:string" use="required"/>
                <xs:attribute name="min-activity-report" type="xs:string" use="required"/>
                <xs:attribute name="max-activity-report" type="xs:string" use="required"/>
                <xs:attribute name="availability-report" type="xs:string" use="required"/>
            </xs:complexType>
        </xs:element>
    </xs:element>

and for some reason it is shouting that there are problem. what is the correct way to write the elements integration and collection to be childs of application?

thank you very much

 
Old April 26th, 2006, 06:36 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you tell me what the error message is, then I might be able to explain to you what it means.

Think about the person responding to your questions. Try and make their life a bit easier. The chances are that anyone who can answer your question will be familiar with the error messages, and will be able to respond much more quickly if you supply the message.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 26th, 2006, 06:39 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

With a second glance, it's pretty obvious: the child elements must be within the <complexType>.

I'm wondering how you made this error. You're not going to write schemas by guessing the syntax - it's one of the most unguessable languages around. You need a good reference book.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 26th, 2006, 07:35 AM
Authorized User
 
Join Date: Jan 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry for the Q but I didnt realy under stand. I am trying to put the collection element as a child of the application element.
<xs:element name="application">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="integration"/>
                <xs:element ref="pw"/>
                <xs:element ref="sla-entity"/>
                <xs:element ref="collection"/>
                <xs:element ref="service-time"/>
                <xs:element ref="zoom-displays"/>
                <xs:element ref="performace"/>
            </xs:sequence>
            <xs:attribute name="tid" type="xs:integer" use="required"/>
            <xs:attribute name="internal_name" type="xs:string" use="required"/>
            <xs:attribute name="guid" type="xs:integer" use="required"/>
            <xs:attribute name="id" type="xs:integer" use="required"/>
            <xs:attribute name="range" type="xs:integer" use="required"/>
        </xs:complexType>
        <xs:element name="collection">
            <xs:complexType>
                <xs:attribute name="dir" type="xs:string" use="required"/>
                <xs:attribute name="remote" type="xs:string" use="required"/>
                <xs:attribute name="min-activity-report" type="xs:string" use="required"/>
                <xs:attribute name="max-activity-report" type="xs:string" use="required"/>
                <xs:attribute name="availability-report" type="xs:string" use="required"/>
            </xs:complexType>
        </xs:element>
        </>
    </xs:element>

after doing it (through the grid, by adding a child), I get an empty </> that there is nothing add to, and I get a message
Name ((Letter|'_''.'|)(Name-Character)*) expected.
since this is my first time, I dont know what this error means, and how can I write correct to makecollection a child of application

 
Old April 27th, 2006, 01:51 AM
Authorized User
 
Join Date: Apr 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kfir
Default

I have the same problem with creating child.
appreaciate if some one will solve this example.

thanks

kfir





Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the first child element humansky XSLT 5 April 17th, 2008 08:46 AM
Attribute to Child element Conversion kudzuconf XSLT 6 July 13th, 2007 04:02 AM
Access specific Element and its Child elements! suersh79 XML 3 November 22nd, 2006 12:58 AM
Match element based on attribute of child? transom XSLT 1 September 11th, 2005 03:26 PM
XSL select by child element value vivhost XSLT 3 May 21st, 2005 02:58 AM





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