|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
schema trouble
Hi all, I'm having a problem with how to make a schema based on the following snippet.
I have a element Class, and there is many Classes distinguised by their attribute Name, each Class is different in structure. <Computers> <Computer Name="COM20"> <Class Name="Win32_LogicalDisk"> <Caption>A:</Caption> <Size /> <FreeSpace /> </Class> <Class Name="Win32_LogicalDisk"> <Caption>C:</Caption> <Size>4293562368</Size> <FreeSpace>1856524288</FreeSpace> </Class> <Class Name="Win32_PageFileUsage"> <Caption>C:\pagefile.sys</Caption> <AllocatedBaseSize>768</AllocatedBaseSize> <CurrentUsage>139</CurrentUsage> <Name>C:\pagefile.sys</Name> <PeakUsage>556</PeakUsage> </Class> </Computer> </Computers> *********End of XML document. So far so good, now I define each class ******* <?xml version="1.0"?> <xsd:schema > <xsd:element name="Class" > <xsd:complexType> <xsd:attribute name = "Win32_LogicalDisk" type="xsd:string"/> <xsd:sequence> <xsd:element name="Caption" type="xsd:string"/> <xsd:element name="Size" type="xsd:double"/> <xsd:element name="FreeSpace" type="xsd:double"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name= "Class" > <xsd:complexType> <xsd:attribute name = "Win32_PageFileUsage" type="xsd:string"/> <xsd:sequence> <xsd:element name="Caption" type="xsd:string"/> <xsd:element name="AllocatedBaseSize" type="xsd:int"/> <xsd:element name="CurrentUsage" type="xsd:int"/> <xsd:element name="Name" type="xsd:string"/> <xsd:element name="PeakUsage" type="xsd:int"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Computer" > <xsd:complexType> <xsd:sequence> *****And here my logic is flawed, when I define the structure for computer. First I want the Win32_LogicalDisk Class, and after that the Win32_PageFileUsage. The following line is NOT correct, but I can't see how I can reference a Class element by its Name attribute**** <element ref="Class" minOccurs="1" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > schema trouble |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|