Content-Completion can't work in some situation, when using master file.
Posted: Fri Feb 16, 2018 6:38 pm
In order to describe this question, let me give two examples:
First example:
I write the following xsd:
Then I create xml instance which using xi:include to modular them, the xml instance file be splited to 3 files:
test-db-5.xml (which be set to master file):
tableA.xml:
tableB.xml:
My question is:
Why these 3 files can be validated successfully, but the Content-Completion can't work in tableA and tableB?
(Maybe have some element proposal, but they are in cache, not collect from XSD, press F5 to clean them.)
Second example:
I write the following xsd:
Then I create xml instance which using xi:include to modular them, the xml instance file be splited to 3 files:
test-db-4.xml (which be set to master file):
tableA.xml:
tableB.xml:
The major difference between the first example and second example is: The second example has a global element for Table and use type alternatives + inheritable attribute to determin Type.
My question is:
Why these 3 files can be validated successfully, but the Content-Completion can't work in tableA and tableB?
(Maybe have some element proposal, but they are in cache, not collect from XSD, press F5 to clean them.)
Is this strange behavior in line with expectations of master file?
I said the behavior is strange becuase it can validate successful, but Content-Completion is not synchronized.
(PS: I try to use framework and write some elementProposals in cc_config.xml which satisfy XSD, but the result is the same.)
Thanks.
First example:
I write the following xsd:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="Table"> </xs:complexType>
<xs:complexType name="TableA">
<xs:complexContent>
<xs:extension base="Table">
<xs:all>
<xs:element maxOccurs="unbounded" minOccurs="0" name="A-Record-1">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyA1"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" minOccurs="0" name="A-Record-2">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyA1"/>
<xs:element name="PropertyA2"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="TableB">
<xs:complexContent>
<xs:extension base="Table">
<xs:all>
<xs:element name="B-Record-1" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyB1"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
<xs:element name="B-Record-2" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyB2"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
<xs:element name="B-Record-3" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyB3"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="TestDB5">
<xs:complexType>
<xs:all>
<xs:element maxOccurs="1" minOccurs="1" name="TableContainerA">
<xs:complexType>
<xs:sequence>
<xs:element name="Table" type="TableA"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="1" minOccurs="1" name="TableContainerB">
<xs:complexType>
<xs:sequence>
<xs:element name="Table" type="TableB"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
test-db-5.xml (which be set to master file):
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<TestDB5 xmlns:xi="http://www.w3.org/2001/XInclude">
<TableContainerA>
<xi:include href="tableA.xml"/>
</TableContainerA>
<TableContainerB>
<xi:include href="tableB.xml"/>
</TableContainerB>
</TestDB5>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Table>
<A-Record-1 name="name0">
<PropertyA1>
</PropertyA1>
</A-Record-1>
<A-Record-2 name="name2">
<PropertyA1>
</PropertyA1>
<PropertyA2>
</PropertyA2>
</A-Record-2>
</Table>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Table>
<B-Record-1 name="name6">
<PropertyB1>
</PropertyB1>
</B-Record-1>
<B-Record-2 name="name8">
<PropertyB2>
</PropertyB2>
</B-Record-2>
</Table>
Why these 3 files can be validated successfully, but the Content-Completion can't work in tableA and tableB?
(Maybe have some element proposal, but they are in cache, not collect from XSD, press F5 to clean them.)
Second example:
I write the following xsd:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="Table"> </xs:complexType>
<xs:complexType name="TableA">
<xs:complexContent>
<xs:extension base="Table">
<xs:all>
<xs:element maxOccurs="unbounded" minOccurs="0" name="A-Record-1">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyA1"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" minOccurs="0" name="A-Record-2">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyA1"/>
<xs:element name="PropertyA2"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="TableB">
<xs:complexContent>
<xs:extension base="Table">
<xs:all>
<xs:element name="B-Record-1" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyB1"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
<xs:element name="B-Record-2" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyB2"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
<xs:element name="B-Record-3" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyB3"/>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="Table" type="Table">
<xs:alternative type="TableA" test="@kind = 'A'"/>
<xs:alternative type="TableB" test="@kind = 'B'"/>
</xs:element>
<xs:element name="TestDB4">
<xs:complexType>
<xs:all>
<xs:element maxOccurs="unbounded" minOccurs="0" name="TableContainer">
<xs:complexType>
<xs:sequence>
<xs:element ref="Table" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute inheritable="true" name="kind"/>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
test-db-4.xml (which be set to master file):
Code: Select all
<TestDB4 xmlns:xi="http://www.w3.org/2001/XInclude">
<TableContainer kind="A">
<xi:include href="tableA.xml"/>
</TableContainer>
<TableContainer kind="B">
<xi:include href="tableB.xml"/>
</TableContainer>
</TestDB4>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Table>
<A-Record-1 name="name0">
<PropertyA1>
</PropertyA1>
</A-Record-1>
<A-Record-2 name="name2">
<PropertyA1>
</PropertyA1>
<PropertyA2>
</PropertyA2>
</A-Record-2>
</Table>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Table>
<B-Record-1 name="name6">
<PropertyB1>
</PropertyB1>
</B-Record-1>
<B-Record-2 name="name8">
<PropertyB2>
</PropertyB2>
</B-Record-2>
<B-Record-3 name="name10">
<PropertyB3>
</PropertyB3>
</B-Record-3>
</Table>
My question is:
Why these 3 files can be validated successfully, but the Content-Completion can't work in tableA and tableB?
(Maybe have some element proposal, but they are in cache, not collect from XSD, press F5 to clean them.)
Is this strange behavior in line with expectations of master file?
I said the behavior is strange becuase it can validate successful, but Content-Completion is not synchronized.
(PS: I try to use framework and write some elementProposals in cc_config.xml which satisfy XSD, but the result is the same.)
Thanks.