← Prev in month ← Prev in thread
Next in thread → Next in month →

AW: How to remove elements from an XML instance document that is not part of the XML schema?

From
Peintner, Daniel <>
To
"Costello, Roger L." <>, "" <>
Date
2019-11-04T13:56:57Z
ID
<>
Thread
AW: How to remove elements from an XML instance document that is not part of the XML schema?
Hi,

not sure what exactly you mean by "tool" but what works is going through a databinding layer.
e.g., parse XML to JAXB classes and serialize to XML again.

Hope this helps,

-- Daniel


-----Ursprüngliche Nachricht-----
Von: Costello, Roger L. <> 
Gesendet: Mittwoch, 30. Oktober 2019 17:27
An: 
Betreff: [xml-dev] How to remove elements from an XML instance document that is not part of the XML schema?

Hi Folks,

Scenario: The XML Schema says the root element is Document and it contains a sequence of an A element followed by a B element. Here's a schema-valid XML instance:

<Document>
    <A>blah</A>
    <B>bar</B>
</Document>

I receive this instance document:

<Document>
    <A>blah</A>
    <B>bar</B>
    <C>oops</C>
</Document>

For the instance to be schema-valid, the C element must be removed. 

Is there a tool that, given an XML Schema and an XML instance, the tool returns the instance minus any invalid elements? That is, the tool returns a schema-valid instance.

/Roger

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS to support XML implementation and development. To minimize spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.oasis-open.org%2Fmlmanage%2F&amp;data=02%7C01%7Cdaniel.peintner.ext%40siemens.com%7Ce06cb8c66f634c2fa1a708d75d562220%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637080496828111477&amp;sdata=UwbIOOuRsa%2B0%2BLf6u6AQWPwMlg71USq%2FaeOjGSNhDF0%3D&amp;reserved=0
Or unsubscribe: 
subscribe:  List archive: https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.xml.org%2Farchives%2Fxml-dev%2F&amp;data=02%7C01%7Cdaniel.peintner.ext%40siemens.com%7Ce06cb8c66f634c2fa1a708d75d562220%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637080496828111477&amp;sdata=Pg0w5gdbXJ5LvRiLvD5nGQL7DTsuNrnJC%2Bul6OkorjI%3D&amp;reserved=0
List Guidelines: https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.oasis-open.org%2Fmaillists%2Fguidelines.php&amp;data=02%7C01%7Cdaniel.peintner.ext%40siemens.com%7Ce06cb8c66f634c2fa1a708d75d562220%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637080496828111477&amp;sdata=%2FpsdcyPnNKys%2F%2FvqkqTn1IZDc5PLRl4yUkjjKcuCFjQ%3D&amp;reserved=0
← Prev in month ← Prev in thread
Next in thread → Next in month →