Schema specification in root element only
See original GitHub issueMove all prefix declarations to the root element, or allow control over prefix setting (disable prefix insertion at the place of use).
example model:
@Serializable
@XmlSerialName("document", Namespaces.view, Namespaces.prefixView)
data class Document(
val head: Head,
val body: Body,
val blocks: List<Block> = emptyList(),
val nature: String? = null,
val background: String? = null,
val zoomable: Boolean? = null,
@XmlOtherAttributes
val other: Map<String, String> = emptyMap()
)
example structure:
val document = Document(
head = Head(
variables = listOf(Variable("x", "internal"), Variable("y", "internal"),)
),
body = Body(cdaTopic = "topic",
elements = listOf(
Div(listOf(If(condition = Expression("foo")))),
Select(variable = "foo", elements = listOf(Select.Repeat(Repeat("test")))),
Edit(Edit.Type.STRING, "foo"),
)
),
other = mapOf(Namespaces.xmlnsNaming.toCName() to Namespaces.naming)
)
output:
<d:document xmlns:d="http://www.webui-ap.com/schemata/view/1.0" n:xmlns="http://www.webui-ap.com/schemata/naming/1.0">
<d:head>
<d:variable name="x" type="internal"/>
<d:variable name="y" type="internal"/>
</d:head>
<d:body xmlns:n="http://www.webui-ap.com/schemata/naming/1.0" n:cda-topic="topic">
<xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml">
<d:if condition="foo"/>
</xhtml:div>
<d:select variable="foo">
<d:repeat from="test"/>
</d:select>
<d:edit variable="foo"/>
</d:body>
</d:document>
Desired view
<d:document xmlns:d="http://www.webui-ap.com/schemata/view/1.0"
n:xmlns="http://www.webui-ap.com/schemata/naming/1.0"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<d:head>
<d:variable name="x" type="internal"/>
<d:variable name="y" type="internal"/>
</d:head>
<d:body n:cda-topic="topic">
<xhtml:div>
<d:if condition="foo"/>
</xhtml:div>
<d:select variable="foo">
<d:repeat from="test"/>
</d:select>
<d:edit variable="foo"/>
</d:body>
</d:document>
Issue Analytics
- State:
- Created a year ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
W3C XML Schema Definition Language (XSD) 1.1 Part 1
This specification depends on XML Schema Definition Language 1.1 Part ... A document is root-valid against a given XSD schema if and only...
Read more >Internal spec schema basics - IBM
The internal schema is an XSD document that is used at runtime to validate spec values, which are provided as an XML document...
Read more >xml property and root schemas · Issue #1435 - GitHub
This is a question about the specification, and the intent of the following description in the Schema Object, relating to the xml property:...
Read more >XML Schema: Understanding Namespaces - Oracle
It is not mandatory to declare namespaces only at the root element; ... attributes as defined in W3C XML Schema Structures Specification and...
Read more >Schema Basics (XML in a Nutshell, 2nd Edition)
Assuming that the fullName element can only contain a simple string value, the schema ... Every schema document consists of a single root...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Btw. if you want to put something in the default namespace you can use the empty string for both. You can also set a namespace for unprefixed elements by specifying the prefix to be the empty string. On prefixes, note that the library will try to reuse prefixes before using the ones specified.
I’ve fixed this (and #107 that was triggered upon solving the base problem). The problem was an infinite recursion in the descriptor tree that wasn’t considered possible (and thus not detected) - to collate namespace declarations the code walks the entire tree.