Я пытаюсь использовать jaxb для компиляции некоторых предоставленных Veracode файлов .xsd
, когда "detailreport.xsd" выдает эту ошибку:
[ERROR] Property "Vulnerabilities" is already defined. Use <jaxb:property> to resolve this conflict.
line 930 of file:detailedreport.xsd
[ERROR] The following location is relevant to the above error
line 936 of detailedreport.xsd
, когда я смотрю на XSD файл, я вижу, что Vulnerabilities
является и атрибутом, и типом:
<xs:complexType name="Component">
<xs:annotation>
<xs:documentation>
The element describe the details of vulnerable component.
* file_paths: File paths of the component.
-----> * vulnerabilities : Vulnerabilities of the component.
* violated_policy_rules: Violated policy rules of the component.
* component_id: The id of the component.
* file_name: File name of the component.
-----> * vulnerabilities: Number of vulnerabilities available in the component.
* max_cvss_score: Max cvss_score of the component.
* library: Library name of the component.
* version: Version of the component.
* vendor: Vendor name of the component.
* description: Description about component.
* blacklisted: Component's blacklisted status.
* new: Component added newly.
* added_date: Component's added_date.
* component_affects_policy_compliance: COmponent's policy violation status.
* licenses: Contains license details of the component.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="file_paths" minOccurs="0" maxOccurs="1" type="tns:FilePathList"/>
<xs:element name="licenses" minOccurs="0" maxOccurs="1" type="tns:LicenseList"/>
-----> <xs:element name="vulnerabilities" minOccurs="0" maxOccurs="1" type="tns:VulnerabilityList" />
<xs:element name="violated_policy_rules" minOccurs="0" maxOccurs="1" type="tns:ViolatedRuleList" />
</xs:sequence>
<xs:attribute name="component_id" type="xs:string" use="required"/>
<xs:attribute name="file_name" type="xs:string" use="required"/>
<xs:attribute name="sha1" type="xs:string" use="required"/>
-----> <xs:attribute name="vulnerabilities" type="xs:integer" use="required"/>
<xs:attribute name="max_cvss_score" type="xs:string" use="required"/>
<xs:attribute name="library" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:string" use="required"/>
<xs:attribute name="vendor" type="xs:string" use="required"/>
<xs:attribute name="description" type="xs:string" use="required"/>
<xs:attribute name="blacklisted" type="xs:string"/>
<xs:attribute name="new" type="xs:string"/>
<xs:attribute name="added_date" type="xs:string"/>
<xs:attribute name="component_affects_policy_compliance" type="xs:string"/>
</xs:complexType>
вот xsd, который они публикуют sh: https://analysiscenter.veracode.com/resource/detailedreport.xsd
из что я могу понять, мне нужно создать файл detailedreport.xjb
и (в качестве выходных состояний) настроить <jaxb:property>
для преобразования целочисленного атрибута vulnerabilities
в нечто вроде vulnerabilityCount
.
, который я создал detailsreport.xjb:
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<!-- Used to avoid the duplicate element/attribute name conflict -->
<jaxb:bindings node="//xsd:attribute[@name='vulnerabilities']">
<jaxb:property name="vulnerabilityCount"/>
</jaxb:bindings>
</jaxb:bindings>
но мой xpath неверен:
[ERROR] XPath evaluation of "//xsd:attribute[@name='vulnerabilities']" results in empty target node
line 10 of file: detailedreport.xjb
- Я даже на правильном пути
- любая помощь xpath приветствуется