XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
AW: How to remove elements from an XML instance document that is notpart 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. <costello@mitre.org> 
Gesendet: Mittwoch, 30. Oktober 2019 17:27
An: xml-dev@lists.xml.org
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: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org 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



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS