Skip to main content
Solved

XMLFragmenter/XMLXQuery*: only get root elements


mariaka
Contributor
Forum|alt.badge.img+13

Hi there,

I don’t see the forest for the trees 🤔

Input data

XML excerpt (source https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/annex-a-xsd.html):

<?xml version='1.0' encoding='ASCII'?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifc="https://standards.buildingsmart.org/IFC/RELEASE/IFC4/3/DEV/9d19c824" targetNamespace="https://standards.buildingsmart.org/IFC/RELEASE/IFC4/3/DEV/9d19c824" elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:element name="uos" type="ifc:uos" abstract="true"/>
 <xs:simpleType name="Seq-anyURI">
  <xs:list itemType="xs:anyURI"/>
 </xs:simpleType>
 <xs:complexType name="uos" abstract="true">
  <xs:sequence>
   <xs:element name="header" minOccurs="0">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="name" type="xs:string" minOccurs="0"/>
      <xs:element name="time_stamp" type="xs:dateTime" minOccurs="0"/>
      <xs:element name="author" type="xs:string" minOccurs="0"/>
      <xs:element name="organization" type="xs:string" minOccurs="0"/>
      <xs:element name="preprocessor_version" type="xs:string" minOccurs="0"/>
      <xs:element name="originating_system" type="xs:string" minOccurs="0"/>
      <xs:element name="authorization" type="xs:string" minOccurs="0"/>
      <xs:element name="documentation" type="xs:string" minOccurs="0"/>
     </xs:sequence>
    </xs:complexType>
   </xs:element>
  </xs:sequence>
  <xs:attribute name="id" type="xs:ID" use="optional"/>
  <xs:attribute name="express" type="ifc:Seq-anyURI" use="optional"/>
  <xs:attribute name="configuration" type="ifc:Seq-anyURI" use="optional"/>
 </xs:complexType>
 <xs:element name="ifcXML" type="ifc:ifcXML" substitutionGroup="ifc:uos"/>
 <xs:complexType name="ifcXML">
  <xs:complexContent>
   <xs:extension base="ifc:uos">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
     <xs:element ref="ifc:Entity"/>
    </xs:choice>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <xs:element name="IfcActionRequest" type="ifc:IfcActionRequest" substitutionGroup="ifc:IfcControl" nillable="true"/>
 <xs:complexType name="IfcActionRequest">
  <xs:complexContent>
   <xs:extension base="ifc:IfcControl">
    <xs:attribute name="PredefinedType" type="ifc:IfcActionRequestTypeEnum" use="optional"/>
    <xs:attribute name="Status" type="ifc:IfcLabel" use="optional"/>
    <xs:attribute name="LongDescription" type="ifc:IfcText" use="optional"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <xs:element name="IfcActor" type="ifc:IfcActor" substitutionGroup="ifc:IfcObject" nillable="true"/>
 <xs:complexType name="IfcActor">
  <xs:complexContent>
   <xs:extension base="ifc:IfcObject">
    <xs:sequence>
     <xs:element name="TheActor">
      <xs:complexType>
       <xs:group ref="ifc:IfcActorSelect"/>
      </xs:complexType>
     </xs:element>
    </xs:sequence>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <xs:element name="IfcWarpingMomentMeasure-wrapper" nillable="true">
  <xs:complexType>
   <xs:simpleContent>
    <xs:extension base="ifc:IfcWarpingMomentMeasure">
     <xs:attributeGroup ref="ifc:instanceAttributes"/>
    </xs:extension>
   </xs:simpleContent>
  </xs:complexType>
 </xs:element>
</xs:schema>

Goal

I want to have all the root elements ‘xs:element’ as features:

  1. <xs:element name="uos" type="ifc:uos" abstract="true"/>
  2. <xs:element name="ifcXML" type="ifc:ifcXML" substitutionGroup="ifc:uos"/>
  3. <xs:element name="IfcActionRequest" type="ifc:IfcActionRequest" substitutionGroup="ifc:IfcControl" nillable="true"/>

 

  1. <xs:element name="IfcActor" type="ifc:IfcActor" substitutionGroup="ifc:IfcObject" nillable="true"/>
  2. <xs:element name="IfcWarpingMomentMeasure-wrapper" nillable="true">
     <xs:complexType>
      <xs:simpleContent>
       <xs:extension base="ifc:IfcWarpingMomentMeasure">
        <xs:attributeGroup ref="ifc:instanceAttributes"/>
       </xs:extension>
      </xs:simpleContent>
     </xs:complexType>
    </xs:element>

What I did so far

If I use the XMLFragmenter or XMLXQueryExtractor it always gets me additionally the child-elements from xs:complexType etc.

I may have troubles the the XQuery expression.

Can anybody help me out?

 

Cheers,
Maria


FME Form version: 2024.0.1.0 (20240328 - Build 24202 - WIN64)

Best answer by geomancer

Use /*/xs:element as XQuery Expression in XMLXQueryExtractor or XMLXQueryExploder, or as value for Elements to Match in XMLFragmenter. 

 

View original
Did this help you find an answer to your question?

2 replies

geomancer
Evangelist
Forum|alt.badge.img+51
  • Evangelist
  • Best Answer
  • April 10, 2024

Use /*/xs:element as XQuery Expression in XMLXQueryExtractor or XMLXQueryExploder, or as value for Elements to Match in XMLFragmenter. 

 


mariaka
Contributor
Forum|alt.badge.img+13
  • Author
  • Contributor
  • April 10, 2024

Thanks @geomancer ! That’s it! 


Did this help you find an answer to your question?

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings