xml


How to extend an abstract xsd element from another NS


I'm working on a SCAP implementation and I need to add a vendor asset type to ARF reports.
The ARF schema is located here https://scap.nist.gov/schema/asset-reporting-format/1.1/asset-reporting-format_1.1.0.xsd (used with arf prefix)
The asset identification xsd is here https://scap.nist.gov/schema/asset-identification/1.1/asset-identification_1.1.0.xsd (used with ai prefix)
So what I fail to achieve is adding some vendor ai:asset-type implementation in an ARF report that still validates ARF schema. I wrote a vendor namespace that only define an element wich extends ai:asset-type and has a substitutionGroup="ai:asset" attribute but when validating a report that uses this vendor element against ARF schema, the validation tool returns that arf:asset only alllow children defined in the asset identification NS. Though, the AI schema is supposed to allow extensions. Any Idea ?
Edit :
Here's how I tried to add the custom vendor element my-asset :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ai="http://scap.nist.gov/schema/asset-identification/1.1"
xmlns:my-ns="http://mydomain/schema/scap/asset-identification/1.0"
targetNamespace="http://mydomain/schema/scap/asset-identification/1.0" elementFormDefault="qualified"
attributeFormDefault="unqualified" version="1.1.1" xmlns:cpe-name="http://cpe.mitre.org/naming/2.0">
<xs:import namespace="http://scap.nist.gov/schema/asset-identification/1.1" schemaLocation="https://scap.nist.gov/schema/asset-identification/1.1/asset-identification_1.1.0.xsd"/>
<xs:element name="my-asset" type="my-ns:my-asset-type" substitutionGroup="ai:asset" />
<xs:complexType name="my-asset-type">
<xs:complexContent>
<xs:extension base="ai:asset-type">
<xs:sequence>
<xs:element ref="ai:cpe" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="id" type="xs:string" />
<xs:anyAttribute namespace="##other"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Edit 2:
The instance that I'm trying to validate against ARF schema :
<?xml version="1.0" encoding="UTF-8"?>
<arf:asset-report-collection xmlns:ai="http://scap.nist.gov/schema/asset-identification/1.1"
xmlns:arf="http://scap.nist.gov/schema/asset-reporting-format/1.1"
xmlns:core="http://scap.nist.gov/schema/reporting-core/1.1"
xmlns:my-ns="http://mydomain/schema/scap/asset-identification/1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://mydomain/schema/scap/asset-identification/1.0
http://mydomain/schema/scap/asset-identification/1.0/asset-identification_1.0.a.xsd
http://scap.nist.gov/schema/asset-reporting-format/1.1
https://scap.nist.gov/schema/asset-reporting-format/1.1/asset-reporting-format_1.1.0.xsd
">
<core:relationships xmlns:arfvocab="http://scap.nist.gov/specifications/arf/vocabulary/relationships/1.0#"
xmlns:aivocab="https://scap.nist.gov/specifications/ai/vocabulary/relationships/1.0/#"
xmlns:myvocab="https://mydomain/riskmanager/relationships/#">
<core:relationship type="myvocab:supports" subject="asset_id_generated_by_app_2">
<core:ref>asset_id_generated_by_app_3</core:ref>
</core:relationship>
<core:relationship type="aivocab:installedOnDevice" subject="asset_2">
<core:ref>asset_1</core:ref>
</core:relationship>
</core:relationships>
<arf:assets>
<arf:asset id="asset_id_generated_by_app_1">
<my-ns:my-asset id="uniq_vendor_id_1">
<ai:cpe>cpe:/a:linux:debian:7.0</ai:cpe>
<ai:cpe>cpe:/a:apache:http_server:2.2</ai:cpe>
</my-ns:my-asset>
</arf:asset>
<arf:asset id="asset_id_generated_by_app_2">
<my-ns:my-asset id="uniq_vendor_id_2">
<ai:cpe>cpe:/a:linux:debian:7.0</ai:cpe>
</my-ns:my-asset>
</arf:asset>
<arf:asset id="asset_id_generated_by_app_3">
<my-ns:my-asset id="uniq_vendor_id_3">
<ai:cpe>cpe:/a:apache:http_server:2.2</ai:cpe>
</my-ns:m-asset>
</arf:asset>
<arf:asset id="asset_1">
<ai:computing-device>
<ai:connections>
<ai:connection>
<ai:ip-address>
<ai:ip-v4>192.168.2.10</ai:ip-v4>
</ai:ip-address>
</ai:connection>
</ai:connections>
<ai:fqdn>comp1234.tempuri.org</ai:fqdn>
</ai:computing-device>
</arf:asset>
<arf:asset id="asset_2">
<ai:software>
<ai:cpe>cpe:/a:apache:http_server:2.2</ai:cpe>
</ai:software>
</arf:asset>
</arf:assets>
<arf:reports>
<arf:report id="report_1">
<arf:content>
<report xmlns="http://mydomain/riskmanager/report" />
</arf:content>
</arf:report>
</arf:reports>
</arf:asset-report-collection>
There may be something wrong with the instance. The schema looks fine. The following validates successfully against the my-ns schema on my side. Maybe this helps?
<?xml version="1.0" encoding="UTF-8"?>
<arf:asset-report-collection
xmlns:arf="http://scap.nist.gov/schema/asset-reporting-format/1.1"
xmlns:my-ns="http://mydomain/schema/scap/asset-identification/1.0"
xmlns:ai="http://scap.nist.gov/schema/asset-identification/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mydomain/schema/scap/asset-identification/1.0 test.xsd http://scap.nist.gov/schema/asset-reporting-format/1.1 asset-reporting-format_1.1.0.xsd.xml">
<arf:assets>
<arf:asset id="a">
<my-ns:my-asset>
<ai:cpe>cpe:/</ai:cpe>
</my-ns:my-asset>
</arf:asset>
</arf:assets>
<arf:reports>
<arf:report id="foo">
<arf:content><my-ns:foo/></arf:content>
</arf:report>
</arf:reports>
</arf:asset-report-collection>

Related Links

Loading data from XML: How to skip error in/incorrect XML file?
xml to excel Asp.net MVC. Parser Error. Encountered end tag “ss:Row” with no matching start tag
Can't call method “rs_namespace_uri” on an undefined value at GetRss.pl line 25
'Serialization of 'SimpleXMLElement' is not allowed Error insert in session xml value [duplicate]
Find all prefix:url namespaces in an XML file - quickly
Redirect to third party payment gateway using POST authentication
SimpleXML addChild Errors
Using XPath for building hierarchical Menu with recursive elements
is there something wrong with my xml file?
How to transform dataset in xml using xslt
where to declare xquery functions?
How to replace a xml tag with DTD entity
XSLT to replace element value if it starts-with a given prefix but leave the rest of the XML as is
How can I include an ampersand (&) character in an XML document?
XSD restrict element occurrence with an specific attribute
Cacheing e-tags viewing

Categories

HOME
windows
microsoftgraph
turing-machines
jpa
developer-tools
nunit
jsf-2.2
onclick
settings
mapbox
data-visualization
google-schemas
fhir
github-enterprise
opengl-es-3.0
code-generation
frequency-distribution
cumulocity
symbol
azure-powershell
modbus-tcp
feathersjs
forgot-password
jersey-1.0
pyramid
asp.net-core-webapi
symbols
guzzle
jquery-ias
short-url
corpus
outliers
nstimer
apktool
handler
openmdao
cppreference
dotspatial
volatile
mustache
utorrent
android-sugarorm
wurfl
playframework-2.1
xcode7.3
imagenet
openalpr
cd
z-notation
protein-database
health-monitoring
mcustomscrollbar
azure-arm
dcmtk
getchar
clarifai
mschart
fclose
manova
posixct
payara-micro
context-switch
stdmap
static-cast
ngmaterial
cubism.js
beamer
ng-grid
hclust
gogs
deep
sklearn-pandas
uiactionsheet
cycle2
relativelayout
boomerang
gocql
coda
rpart
ember-cli-rails
haskell-warp
fits
qtwebengine
entry-point
psr-4
strawberry-perl
codeplex
xml-dsig
spring-remoting
terminate
drupal-nodes
rfc5322
kendo-dataviz
modular
pstack
nokia-s40
adobe-media-server
jdb
luabind
denied
maven-1
binomial-heap
blender-2.49
interop-domino
online-storage

Resources

Encrypt Message