Mike DiGesu
02-14-2010, 02:39 PM
Hello everyone
I have an xml document that looks like this:
<ToolData>
<TFinding>
<Finding>
<ToolName>Scanner name</ToolName>
<ToolVersion>Scanner Version</ToolVersion>
<ToolID>V0001076</ToolID>
<Description>No Description Given.</Description>
<Mitigation>No Mitigation Given.</Mitigation>
<Example>No Example Given</Example>
<ToolSeverity>2</ToolSeverity>
<AnalyzerSeverity>2</AnalyzerSeverity>
</Finding>
<Port>
<Number>No Port Given</Number>
<State>No State Given</State>
<Protocol>No Protocol Given</Protocol>
<Service>No Service Given</Service>
<ServiceVersion>No Service Version Given</ServiceVersion>
</Port>
<Machine>
<IPAddress>No IP Address Given</IPAddress>
<HostName>No Host Name Given</HostName>
<OperatingSystem>No Operating System Given</OperatingSystem>
<MACAddress>No MAC Address Given</MACAddress>
<MACVendor>No MAC Vendor Given</MACVendor>
<NetBios>No NetBios Given</NetBios>
</Machine>
</TFinding>
</ToolData>
And the schema I have defined for this is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="stringtype">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="analyzerseveritytype">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[1-3]"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="stringtype32">
<xsd:restriction base="xsd:string">
<xsd:length value="32"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="stringtype128">
<xsd:restriction base="xsd:string">
<xsd:length value="128"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="stringtype256">
<xsd:restriction base="xsd:string">
<xsd:length value="256"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="FindingType">
<xsd:sequence>
<xsd:element name="ToolName" type="stringtype128" minOccurs="1" />
<xsd:element name="ToolVersion" type="stringtype128" />
<xsd:element name="ToolID" type="stringtype32" minOccurs="1" />
<xsd:element name="Description" type="stringtype" />
<xsd:element name="Mitigation" type="stringtype" />
<xsd:element name="Example" type="stringtype" />
<xsd:element name="ToolSeverity" type="stringtype128" />
<xsd:element name="AnalyzerSeverity" type="analyzerseveritytype" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PortType">
<xsd:sequence>
<xsd:element name="Number" type="stringtype128" />
<xsd:element name="State" type="stringtype128" />
<xsd:element name="Protocol" type="stringtype128" />
<xsd:element name="Service" type="stringtype128" />
<xsd:element name="ServiceVersion" type="stringtype128" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MachineType">
<xsd:sequence>
<xsd:element name="IPAddress" type="stringtype256" />
<xsd:element name="HostName" type="stringtype256" />
<xsd:element name="OperatingSystem" type="stringtype128" />
<xsd:element name="MACAddress" type="stringtype128" />
<xsd:element name="MACVendor" type="stringtype128" />
<xsd:element name="NetBios" type="stringtype128" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TFindingType">
<xsd:sequence>
<xsd:element name="Finding" type="FindingType" />
<xsd:element name="Port" type="PortType" />
<xsd:element name="Machine" type="MachineType" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ToolData" type="ToolDataType" />
<xsd:complexType name="ToolDataType">
<xsd:sequence>
<xsd:element name="TFinding" type="TFindingType" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
My problem is that when I try to validate the xml file against the schema, I keep getting "The 'NetBios' element has an invalid value according to its data type."
I am at my wits end, I would appreciate any help you guys can give me.
Thanks in advance!
I have an xml document that looks like this:
<ToolData>
<TFinding>
<Finding>
<ToolName>Scanner name</ToolName>
<ToolVersion>Scanner Version</ToolVersion>
<ToolID>V0001076</ToolID>
<Description>No Description Given.</Description>
<Mitigation>No Mitigation Given.</Mitigation>
<Example>No Example Given</Example>
<ToolSeverity>2</ToolSeverity>
<AnalyzerSeverity>2</AnalyzerSeverity>
</Finding>
<Port>
<Number>No Port Given</Number>
<State>No State Given</State>
<Protocol>No Protocol Given</Protocol>
<Service>No Service Given</Service>
<ServiceVersion>No Service Version Given</ServiceVersion>
</Port>
<Machine>
<IPAddress>No IP Address Given</IPAddress>
<HostName>No Host Name Given</HostName>
<OperatingSystem>No Operating System Given</OperatingSystem>
<MACAddress>No MAC Address Given</MACAddress>
<MACVendor>No MAC Vendor Given</MACVendor>
<NetBios>No NetBios Given</NetBios>
</Machine>
</TFinding>
</ToolData>
And the schema I have defined for this is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="stringtype">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="analyzerseveritytype">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[1-3]"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="stringtype32">
<xsd:restriction base="xsd:string">
<xsd:length value="32"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="stringtype128">
<xsd:restriction base="xsd:string">
<xsd:length value="128"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="stringtype256">
<xsd:restriction base="xsd:string">
<xsd:length value="256"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="FindingType">
<xsd:sequence>
<xsd:element name="ToolName" type="stringtype128" minOccurs="1" />
<xsd:element name="ToolVersion" type="stringtype128" />
<xsd:element name="ToolID" type="stringtype32" minOccurs="1" />
<xsd:element name="Description" type="stringtype" />
<xsd:element name="Mitigation" type="stringtype" />
<xsd:element name="Example" type="stringtype" />
<xsd:element name="ToolSeverity" type="stringtype128" />
<xsd:element name="AnalyzerSeverity" type="analyzerseveritytype" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PortType">
<xsd:sequence>
<xsd:element name="Number" type="stringtype128" />
<xsd:element name="State" type="stringtype128" />
<xsd:element name="Protocol" type="stringtype128" />
<xsd:element name="Service" type="stringtype128" />
<xsd:element name="ServiceVersion" type="stringtype128" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MachineType">
<xsd:sequence>
<xsd:element name="IPAddress" type="stringtype256" />
<xsd:element name="HostName" type="stringtype256" />
<xsd:element name="OperatingSystem" type="stringtype128" />
<xsd:element name="MACAddress" type="stringtype128" />
<xsd:element name="MACVendor" type="stringtype128" />
<xsd:element name="NetBios" type="stringtype128" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TFindingType">
<xsd:sequence>
<xsd:element name="Finding" type="FindingType" />
<xsd:element name="Port" type="PortType" />
<xsd:element name="Machine" type="MachineType" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ToolData" type="ToolDataType" />
<xsd:complexType name="ToolDataType">
<xsd:sequence>
<xsd:element name="TFinding" type="TFindingType" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
My problem is that when I try to validate the xml file against the schema, I keep getting "The 'NetBios' element has an invalid value according to its data type."
I am at my wits end, I would appreciate any help you guys can give me.
Thanks in advance!