I have a complex XML schema consisting of multiple namespaces defined in different files. Below is a figure created in XSD Diagram that shows a small part of the schema.
Note that party is of type partyType, which is defined in a different namespace than parties. The (simplified) XML for parties in the main file (veg.xsd) looks like this:
...
<xsd:element name="parties" minOccurs="0">
<xsd:annotation>
<xsd:documentation>...</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="party" type="misc:partyType" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation source="EML" xml:lang="en">...</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
...
Now, my aim is to derive the hierarchy of elements for the entire schema (across namespaces), pretty much like in the figure above. However, when I parse veg.xsd in R, I have no access to the imported namespaces. For example, when list all elements having a name attribute, I only get the names of elements defined in veg.xsd.
library(xml2)
def_xsd = read_xml("vegx_schema/veg.xsd")
xml_find_all(def_xsd, "//xsd:element") %>%
xml_attr("name") %>%
length()
[1] 52 # Should be much larger
Any help appreciated!
