Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

BPEL how to remove invalid (over schema validation) nodes from XML

Damir DevJun 20 2019 — edited Jul 31 2019

Hello!

I want to find invalid nodes in XML over schema validation and remove it from XML.

I have

1. XSD

...

<xs:element name="Client" type="tns:ClientType" maxOccurs="unbounded"/>

<xs:complexType name="tns:ClientType">

<xs:sequence>

<xs:element name="ClientId" type="xs:int" minOccurs="1">

<xs:element name="MiddleName" type="xs:string" minOccurs="0"/>

<xs:element name="Birthday" type="xs:date" minOccurs="1">

<xs:element name="Comment" minOccurs="1">

  <xs:simpleType>

    <xs:restriction base="xs:string">

      <xs:maxLength value="5"/>

    </xs:restriction>

  </xs:simpleType>

</xs:element>

...

</xs:sequence>

</xs:complexType>

...

2. XML

    <Client>

      <ClientId>1</ClientId>

      <MiddleName>MiddleName1</MiddleName>

      <Birthday>1988-09-29</Birthday>

      <Comment>Com1</Comment>

      ...

    </Client>

    <Client>

      <ClientId>2</ClientId>

      <MiddleName>MiddleName2</MiddleName>

      <Birthday>not found</Birthday>

      <Comment>Com2</Comment>

      ...

    </Client>

    <Client>

      <MiddleName>MiddleName</MiddleName>

      <Birthday>1988-03-03</Birthday>

      <Comment>Com</Comment>

      ...

    </Client>

    <Client>

      <ClientId>3</ClientId>

      <MiddleName>MiddleName3</MiddleName>

      <Birthday>1986-06-09</Birthday>

      <Comment>Comment3</Comment>

      ...

    </Client>

Expected result

    <Client>

      <ClientId>1</ClientId>

      <MiddleName>MiddleName1</MiddleName>

      <Birthday>1988-09-29</Birthday>

      <Comment>Com1</Comment>

      ...

    </Client>

A Validate Activity fault does not provide information which one from "Client" nodes is not valid. A Schematron it is not XSD validation.

Could you tell me please how to remove invalid "Client" nodes from XML?

This post has been answered by Martien van den Akker on Jun 20 2019
Jump to Answer

Comments

Post Details

Added on Jun 20 2019
3 comments
170 views