Valid xml and Schema
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 1
- Joined: Wed Mar 16, 2022 9:54 pm
Valid xml and Schema
I need to verify xml is correct and I need help writing my XML Schema.
Code: Select all
<?xml version="1.0 encoding="UTF-8" standalone="yes">
<data-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<0>
<fname>John</fname>
<lname>Doe</lname>
<email>doejohn@gmail.com</email>
</0>
<1>
<fname>Jane</fname>
<lname>Doe</lname>
<email>doejane@yahoo.com</email>
</1>
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Valid xml and Schema
Hi,
Something like this <0> is not a valid XML element name, a valid element name starts with a letter or underscore:
https://www.w3schools.com/xml/xml_elements.asp
Also you cannot build an XML schema to validate an XML document which may contain an arbitrary number of tag names, for example <0>, <1>....<1000>.
If your XML would look like this:
an XML Schema for it would look like this:
Regards,
Radu
Something like this <0> is not a valid XML element name, a valid element name starts with a letter or underscore:
https://www.w3schools.com/xml/xml_elements.asp
Also you cannot build an XML schema to validate an XML document which may contain an arbitrary number of tag names, for example <0>, <1>....<1000>.
If your XML would look like this:
Code: Select all
<data-set>
<person number="0">
<fname>John</fname>
<lname>Doe</lname>
<email>doejohn@gmail.com</email>
</person>
<person number="1">
<fname>Jane</fname>
<lname>Doe</lname>
<email>doejane@yahoo.com</email>
</person>
</data-set>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="data-set">
<xs:complexType>
<xs:sequence>
<xs:element name="person" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="fname" type="xs:string"/>
<xs:element name="lname" type="xs:string"/>
<xs:element name="email" type="xs:string"/>
</xs:sequence>
<xs:attribute name="number" type="xs:integer"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service