English 中文(简体)
你们如何界定具有某种模式的XML化学特征?
原标题:How do you define an XML schema ID attribute that has a pattern?

This XML documentation seems to say that the ID derived type supports a pattern, but when I try to define one with this code:

      <complexType name="CourseType">
          <attribute name="courseNumber" type="ID">
              <pattern value="[A-Z]{2}(d{3}).(d{3})" />
          </attribute>
          <attribute name="numOfCredits" type="university:CourseCredits" />
          <element name="course_name" type="university:MixedName" />
          <element name="course_professor" type="string" />
      </complexType>>


...I get an error in the oXygen XML editor that says The content of courseNumber must match (annotation?, (simpleType?)). A problem was found starting at: pattern.

我对这一身份特征正确地界定我的图谋?

最佳回答

如果你需要限制所建的简单数据类型,你应自行创建simpleType。 http://www.w3.org/TR/xmlschema-2/#derivation-by-restriction”rel=“nofollow”>。 类似情况:

<simpleType name= better-ID >
  <restriction base= ID >
    <pattern value= (d{3}).(d{3}) />
  </restriction>
</simpleType>

<complexType name="CourseType">
      ...
      <attribute name="courseNumber" type="better-ID"/>
      <attribute name="numOfCredits" type="university:CourseCredits" />
</complexType>

或您仅可插入simpleType:

   <complexType name="CourseType">
          ...
          <attribute name="courseNumber">
              <simpleType>
                  <restriction base= ID >
                     <pattern value= (d{3}).(d{3}) />
                  </restriction>
              </simpleType>
          </attribute>
          <attribute name="numOfCredits" type="university:CourseCredits" />
    </complexType>

www.un.org/Depts/DGACM/index_spanish.htm 并参看下文“jasso”的评论意见,以在您的科学、科学和技术部中确定一些其他错误。

问题回答

暂无回答




相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签