Jump to content

RobertB

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About RobertB

  • Rank
    Newbie
  1. Hi,Does anybody know of an easy way in a XSD to have a validation based on an attribute from the parent node ?My XML: .... <product no="218"> <part type="é" /> </product> <product no="205"> <participant>N</participant> <part type="é"> <nb>1</nb> </part> </product>...In the XSD:...<xs:element name="participant" minOccurs="0" maxOccurs="1">...<xs:element name="part" minOccurs="1" maxOccurs="12">The tag participant can only occur if the product no is 205, and the maxOccu
  2. I found a solution, thank's anyway !FYI, my solution is to assign a type for product2, to define that type in another xsd and to include it in the header of the main XML document. The product2 xml doc only contains the standard header plus the type definition:main XML doc:...<xs:element name="product2" maxOccurs="1" type="sel205Type" />...product2 XML doc:<?xml version="1.0" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:simpleType name="sel205Type"> <xs:restriction base="xs:string"> ... </xs:schema>
  3. Hi,I am new to XSD and cannot find how to do the following. I will have a bunch of XML documents that consist basically of 2 products. Th 1st product will vary in each XML doc but the second product (with all its restrictions) will always be the same.<?xml version="1.0" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="trxml"> <xs:complexType> <xs:sequence> <xs:element name="product1" minOccurs="1" maxOccurs="1"> <xs:complexType> <xs:restriction
×
×
  • Create New...