Jump to content

mrmacro

Members
  • Posts

    3
  • Joined

  • Last visited

Previous Fields

  • Languages
    C++, Java

Profile Information

  • Location
    Massachusetts, USA

mrmacro's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. When I read the documentation regarding the "group" element, it looks like it would be used similar to the "all", "any" or "choice" tags. It also says that it has optional "name" and "ref" attributes that cannot be used simultaneously. However, when I try to create a group within a sequence, I get a validation complaint that the required "ref" attribute is missing. The page at http://www.w3schools.com/schema/el_group.asp does not say anything about a situation where this would be required. It does have an example where a group is declared with a name and then used, by reference, later within a complex type definition. There it makes sense that the "ref" attribute is required to reference the pre-defined group. Is this something like a macro that can be used to name some elements to be used in multiple type definitions by reference? Can a group be created within a sequence without a name or ref attribute?
  2. If an element is to potentially contain one or more other elements, then it needs one or more of these to contain the "member" elements. Undue complexity is never the right thing to do. However, in this case it may actually be necessary complexity. You didn't post any real details so I cannot get into any specifics. You may also want to look at grouping to help you out. Good Luck
  3. mrmacro

    schema help

    What did was fine; as you have proven, it works. However, if the "jobs" element was one in a sequence, it would become obscured by the in-line element type definition. Since you already had a "jobtype" defined, you could have done the following: <xsd:element name="jobs"> <xsd:complexType> <xsd:sequence> <xsd:element name="job" type="jobtype" maxOccurs="unbounded"> </xsd:sequence> </xsd:complexType></xsd:element> As you can see this is easier to read which in your case is not important, but in a larger sequence it is much cleaner to define the types of the elements in the sequence and then just name the elements with their occurrence restrictions. I hope that this helps you and others with this type of problem in the future.
×
×
  • Create New...