XMLSchema problem with XML document

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Samji
    New Member
    • Dec 2006
    • 23

    #1

    XMLSchema problem with XML document

    Hello. I have this XML document:
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <vbtagsconf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:noNamespaceSchemaLocation="vbtags.xsd">	
    	
        <vbtag name="bold" params="false" group="basic">
            <regexp>\[/?b]</regexp>
            <code>&lt;b&gt;</code>
        </vbtag>
        <vbtag name="italic" params="false" group="basic">
            <regexp>\[/?i]</regexp>
            <code>&lt;i&gt;</code>
        </vbtag>
    
    </vbtagsconf>
    I have this XMLSchema:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    	<!-- root element -->
    	<xs:element name="vbtagsconf">
    		<xs:complexType>
    			<xs:sequence minOccurs="1" maxOccurs="unbounded">
    				<!-- first tag with three attributes -->
    				<xs:element name="vbtag">
    					<xs:complexType>
    						<xs:attribute name="name" type="xs:string"/>
    						<xs:attribute name="params" type="xs:string"/>
    						<xs:attribute name="group" type="xs:string"/>
    					</xs:complexType>
    				</xs:element>
    				<!-- next two tags with no attributes -->
    				<xs:element name="regexp" type="xs:string"/>
    				<xs:element name="code" type="xs:string"/>
    			</xs:sequence>			
    		</xs:complexType>
    	</xs:element>
    </xs:schema>
    When I validate the document against the schema, I get this error message:
    "No character data is allowed by content model". What does that mean? What have I done wrong?

    Thanks in advance.
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by Samji
    Hello. I have this XML document:
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <vbtagsconf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:noNamespaceSchemaLocation="vbtags.xsd">	
    	
        <vbtag name="bold" params="false" group="basic">
            <regexp>\[/?b]</regexp>
            <code>&lt;b&gt;</code>
        </vbtag>
        <vbtag name="italic" params="false" group="basic">
            <regexp>\[/?i]</regexp>
            <code>&lt;i&gt;</code>
        </vbtag>
    
    </vbtagsconf>
    I have this XMLSchema:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    	<!-- root element -->
    	<xs:element name="vbtagsconf">
    		<xs:complexType>
    			<xs:sequence minOccurs="1" maxOccurs="unbounded">
    				<!-- first tag with three attributes -->
    				<xs:element name="vbtag">
    					<xs:complexType>
    						<xs:attribute name="name" type="xs:string"/>
    						<xs:attribute name="params" type="xs:string"/>
    						<xs:attribute name="group" type="xs:string"/>
    					</xs:complexType>
    				</xs:element>
    				<!-- next two tags with no attributes -->
    				<xs:element name="regexp" type="xs:string"/>
    				<xs:element name="code" type="xs:string"/>
    			</xs:sequence>			
    		</xs:complexType>
    	</xs:element>
    </xs:schema>
    When I validate the document against the schema, I get this error message:
    "No character data is allowed by content model". What does that mean? What have I done wrong?

    Thanks in advance.
    Hello, Samji!

    Just to be sure, could you look to see if your XML file is also saved as UTF-8?

    Comment

    Working...