Last active
September 21, 2018 07:54
-
-
Save thewilkybarkid/29ebd1a299d8f5eacd45959d084e285f to your computer and use it in GitHub Desktop.
XML element replacement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<document> | |
<meta> | |
<title replaced-by="1">Some text</title> | |
<full-title id="1">Some text</full-title> | |
</meta> | |
<content> | |
<p>Some <italic replaced-by="2"><em id="2">inline</em></italic> content</p> | |
<image replaced-by="3"> | |
<src>http://www.example.com/image.jpg</src> | |
</image> | |
<figure id="3"> | |
<src>http://www.example.com/image.jpg</src> | |
</figure> | |
</content> | |
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<document> | |
<meta> | |
<title>Some text</title> | |
<full-title>Some text</full-title> | |
</meta> | |
<content> | |
<p>Some <italic><em>inline</em></italic> content</p> | |
<image> | |
<src>http://www.example.com/image.jpg</src> | |
</image> | |
<figure> | |
<src>http://www.example.com/image.jpg</src> | |
</figure> | |
</content> | |
</document> |
This attributes usage seems reasonable and clear.
Being a pointer from old to new, it supports the joining case but not the splitting case, I think:
<figure replaced-by="4?">
<image>
<src>http://www.example.com/image.jpg</src>
</image>
<caption>Lorem ipsum</caption>
</figure>
<image id="4a">
<src>http://www.example.com/image.jpg</src>
</image>
<caption id="4b">Lorem ipsum</caption>
(tag names are hypothetical)
Can use IDREFS
rather than IDREF
to allow referencing multiple IDs in that case:
<figure replaced-by="4a 4b">
<image>
<src>http://www.example.com/image.jpg</src>
</image>
<caption>Lorem ipsum</caption>
</figure>
<image id="4a">
<src>http://www.example.com/image.jpg</src>
</image>
<caption id="4b">Lorem ipsum</caption>
Wonder about bi-directional?
<?xml version="1.0" encoding="UTF-8"?>
<document>
<meta>
<title replaced-by="1" id="i">Some text</title>
<full-title id="1" replaces="i">Some text</full-title>
</meta>
<content>
<p>Some <italic replaced-by="2" id="ii"><em id="2" replaces="ii">inline</em></italic> content</p>
<image replaced-by="3" id="iii">
<src>http://www.example.com/image.jpg</src>
</image>
<figure id="3" replaces="iii">
<src>http://www.example.com/image.jpg</src>
</figure>
<figure replaced-by="4a 4b" id="iv">
<image>
<src>http://www.example.com/image.jpg</src>
</image>
<caption>Lorem ipsum</caption>
</figure>
<image id="4a" replaces="iv">
<src>http://www.example.com/image.jpg</src>
</image>
<caption id="4b" replaces="iv">Lorem ipsum</caption>
</content>
</document>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These are the three types of changes I can imagine:
2 and 3 look unclear without the attribute. The spec is currently saying that you have to just ignore things you don't recognise, but this is hard to do for Libero-namespaced code as we should support any Libero-namespaced things, which covers both.