0

I have some xml document and this xml has some elements whose attribute value is unique(eg: name). I want to use xs:ID to identify it in XSD. My question is: Is there any way to extend xs:ID to make it support characters: colon, slash, space? Because the attribute "name" maybe have these characters.

I know there are some alternatives, eg: using xsd:key in XSD or using XSLT to validate by xsl:key. But I still like to ask if there is a way to extend xs:ID (eg: override some facts).

The main reason is the auto-completion feature of my xml editor (Oxygen XML Editor) only support xs:ID and xs:IDREF. (Maybe we can write some Editor plugin to support it, but it's very ugly. Because it will lead to editor dependency and we will write java code instead of xml.)

chansey
  • 1,266
  • 9
  • 20

2 Answers2

1

No, ID and IDREF values are constrained (for arcane reasons connected with SGML) to have the syntax of XML names.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
1

Maybe as a workaround for what you want, Oxygen XML Editor does have the possibility to control the values of an attribute by calling an XSLT script which may be used to gather those values from various places in the document: http://blog.oxygenxml.com/2015/07/controlled-attribute-values-part-2.html

Radu Coravu
  • 1,754
  • 1
  • 9
  • 8
  • Thanks, it seems to be really what I want. I read the article you mentioned, but I found I lack a lot of Oxygen XML Editor domain concept (eg: DITA, framework, resources folder, Classpath,...)It may need to take some effort e to understand. Does the Content Completion Configuration file support scoping base Content Completion? – chansey Jan 05 '18 at 14:15
  • I will probably need a small example to understand what you need, a small XML file and some details about what values you want to obtain in various places. Maybe you could write to "support@oxygenxml.com" and provide more details. – Radu Coravu Jan 08 '18 at 06:45