Please help - i don't find the answer - xml and xsd
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 6
- Joined: Tue Feb 20, 2007 10:52 am
Please help - i don't find the answer - xml and xsd
From my customer I get 4 files, 1 xml and 3 xsd. I wont to get them in oxygen and have validate the xml. I know that i have to type in the reference to the xsd with schemalocation, but i have problems with the prefixes. I do not want to change the xml more than only type in the reference to xsd, i may not change or add prefixes like ns0 or e2b to elements. How do i do that in oxygen ?
my xml
<?xml version="1.0" encoding="UTF-8"?>
<Envelope
xsi:schemaLocation="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox Mailbox.xsd"
xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header Version="2.0">
<Origin>2000</Origin>
<Destination>003X</Destination>
</Header>
<Body>
<Mailbox>
<MailboxNbr>000000000000125</MailboxNbr>
<MessageCount>000000000000010</MessageCount>
<CreationDate>2007-02-08</CreationDate>
<CreationTime>16:02:06</CreationTime>
<Message>
<MessageHeader Version="1.0">
<DocumentID>ST2B</DocumentID>
</MessageHeader>
<MessageBody>
<ns0:NISSE
xmlns:e2B="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B"
xmlns:ns0="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport">
<AppHeader>
<DocumentId>ST2B</DocumentId>
<Origin>PENS</Origin>
</AppHeader>
<AppBody>
<e2B:E2B>
<E2BHeader VersionNbr="1.0">
<MessageStep>1</MessageStep>
</E2BHeader>
</e2B:E2B>
</AppBody>
</ns0:NISSE>
</MessageBody>
</Message>
</Mailbox>
</Body>
</Envelope>
my xsd for e2b
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B" finalDefault="restriction" targetNamespace="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0">
<xs:element name="E2B">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="E2BHeader">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="MessageStep" type="xs:unsignedInt" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
my xsd for transport
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0">
<xs:element name="NISSE">
<xs:complexType>
<xs:sequence>
<xs:element name="AppHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="DocumentId" type="xs:string"/>
<xs:element name="Origin" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AppBody" type="xs:anyType" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
my mailbox xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- edited with XMLSpy v2006 sp2 U (http://www.altova.com) by Ardatis N.V. (Ardatis N.V.) -->
<!--W3C Schema generated by XMLSpy v2005 rel. 3 U (http://www.altova.com)-->
<xs:schema
xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="2.0">
<xs:element name="Body">
<xs:complexType>
<xs:sequence>
<xs:element ref="Mailbox"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CreationDate" type="xs:date"/>
<xs:element name="Destination">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4"/>
<xs:minLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Message">
<xs:complexType>
<xs:sequence>
<xs:element name="MessageHeader">
<xs:complexType>
<xs:sequence>
<xs:element ref="DocumentID"/>
</xs:sequence>
<xs:attribute name="Version" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="MessageBody" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Header">
<xs:complexType>
<xs:sequence>
<xs:element ref="Origin"/>
<xs:element ref="Destination"/>
</xs:sequence>
<xs:attribute name="Version" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Mailbox">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element ref="MailboxNbr"/>
<xs:element ref="MessageCount"/>
<xs:element ref="CreationDate"/>
<xs:element ref="CreationTime"/>
<xs:element ref="Message" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Envelope">
<xs:annotation>
<xs:documentation>Mailbox voor xml berichten</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="Header"/>
<xs:element ref="Body"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MailboxNbr" type="xs:positiveInteger"/>
<xs:element name="MessageCount" type="xs:positiveInteger"/>
<xs:element name="Origin">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4"/>
<xs:minLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CreationTime" type="xs:time"/>
<xs:element name="DocumentID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>
my xml
<?xml version="1.0" encoding="UTF-8"?>
<Envelope
xsi:schemaLocation="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox Mailbox.xsd"
xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header Version="2.0">
<Origin>2000</Origin>
<Destination>003X</Destination>
</Header>
<Body>
<Mailbox>
<MailboxNbr>000000000000125</MailboxNbr>
<MessageCount>000000000000010</MessageCount>
<CreationDate>2007-02-08</CreationDate>
<CreationTime>16:02:06</CreationTime>
<Message>
<MessageHeader Version="1.0">
<DocumentID>ST2B</DocumentID>
</MessageHeader>
<MessageBody>
<ns0:NISSE
xmlns:e2B="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B"
xmlns:ns0="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport">
<AppHeader>
<DocumentId>ST2B</DocumentId>
<Origin>PENS</Origin>
</AppHeader>
<AppBody>
<e2B:E2B>
<E2BHeader VersionNbr="1.0">
<MessageStep>1</MessageStep>
</E2BHeader>
</e2B:E2B>
</AppBody>
</ns0:NISSE>
</MessageBody>
</Message>
</Mailbox>
</Body>
</Envelope>
my xsd for e2b
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B" finalDefault="restriction" targetNamespace="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0">
<xs:element name="E2B">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="E2BHeader">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="MessageStep" type="xs:unsignedInt" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
my xsd for transport
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0">
<xs:element name="NISSE">
<xs:complexType>
<xs:sequence>
<xs:element name="AppHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="DocumentId" type="xs:string"/>
<xs:element name="Origin" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AppBody" type="xs:anyType" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
my mailbox xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- edited with XMLSpy v2006 sp2 U (http://www.altova.com) by Ardatis N.V. (Ardatis N.V.) -->
<!--W3C Schema generated by XMLSpy v2005 rel. 3 U (http://www.altova.com)-->
<xs:schema
xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="2.0">
<xs:element name="Body">
<xs:complexType>
<xs:sequence>
<xs:element ref="Mailbox"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CreationDate" type="xs:date"/>
<xs:element name="Destination">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4"/>
<xs:minLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Message">
<xs:complexType>
<xs:sequence>
<xs:element name="MessageHeader">
<xs:complexType>
<xs:sequence>
<xs:element ref="DocumentID"/>
</xs:sequence>
<xs:attribute name="Version" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="MessageBody" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Header">
<xs:complexType>
<xs:sequence>
<xs:element ref="Origin"/>
<xs:element ref="Destination"/>
</xs:sequence>
<xs:attribute name="Version" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Mailbox">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element ref="MailboxNbr"/>
<xs:element ref="MessageCount"/>
<xs:element ref="CreationDate"/>
<xs:element ref="CreationTime"/>
<xs:element ref="Message" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Envelope">
<xs:annotation>
<xs:documentation>Mailbox voor xml berichten</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="Header"/>
<xs:element ref="Body"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MailboxNbr" type="xs:positiveInteger"/>
<xs:element name="MessageCount" type="xs:positiveInteger"/>
<xs:element name="Origin">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4"/>
<xs:minLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CreationTime" type="xs:time"/>
<xs:element name="DocumentID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
You have to add the following two attributes to the ns0:NISSE element:
and the following attribute to the E2BHeader element:
Regards,
Sorin
You have to add the following two attributes to the ns0:NISSE element:
Code: Select all
xsi:schemaLocation="
http://www.rsvz-inasti.fgov.be/schemas/Pen/Exchanges/Stencil2B e2b.xsd
http://www.rsvz-inasti.fgov.be/schemas/Common/Exchanges/Transport transport.xsd"
xmlns="http://www.rsvz-inasti.fgov.be/schemas/Common/Exchanges/Transport"
Code: Select all
xmlns="http://www.rsvz-inasti.fgov.be/schemas/Pen/Exchanges/Stencil2B"
Sorin
-
- Posts: 6
- Joined: Tue Feb 20, 2007 10:52 am
Hoi Sorin
Sorry, but i am a newbie. When i change the xml like suggested
<?xml version="1.0" encoding="UTF-8"?>
<Envelope
xsi:schemaLocation="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox Mailbox.xsd"
xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header Version="2.0">
<Origin>2000</Origin>
<Destination>003X</Destination>
</Header>
<Body>
<Mailbox>
<MailboxNbr>000000000000125</MailboxNbr>
<MessageCount>000000000000010</MessageCount>
<CreationDate>2007-02-08</CreationDate>
<CreationTime>16:02:06</CreationTime>
<Message>
<MessageHeader Version="1.0">
<DocumentID>ST2B</DocumentID>
</MessageHeader>
<MessageBody>
<ns0:NISSE
xmlns:e2B="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B"
xmlns:ns0="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport"
xsi:schemaLocation="
http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B e2b.xsd
http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport transport.xsd"
xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport">
<AppHeader>
<DocumentId>ST2B</DocumentId>
<Origin>PENS</Origin>
</AppHeader>
<AppBody>
<e2B:E2B>
<E2BHeader xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B" VersionNbr="1.0">
<MessageStep>1</MessageStep>
</E2BHeader>
</e2B:E2B>
</AppBody>
</ns0:NISSE>
</MessageBody>
</Message>
</Mailbox>
</Body>
</Envelope>
i get an error "content not allowed in prolog".
When i change a little I get it right, but is doesn't validate anymore. Can you help me once again ? Perhaps give the complete xml like it should be and tested with the xsd ?
Thx in advance
Albert
Sorry, but i am a newbie. When i change the xml like suggested
<?xml version="1.0" encoding="UTF-8"?>
<Envelope
xsi:schemaLocation="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox Mailbox.xsd"
xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... es/Mailbox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header Version="2.0">
<Origin>2000</Origin>
<Destination>003X</Destination>
</Header>
<Body>
<Mailbox>
<MailboxNbr>000000000000125</MailboxNbr>
<MessageCount>000000000000010</MessageCount>
<CreationDate>2007-02-08</CreationDate>
<CreationTime>16:02:06</CreationTime>
<Message>
<MessageHeader Version="1.0">
<DocumentID>ST2B</DocumentID>
</MessageHeader>
<MessageBody>
<ns0:NISSE
xmlns:e2B="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B"
xmlns:ns0="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport"
xsi:schemaLocation="
http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B e2b.xsd
http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport transport.xsd"
xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... /Transport">
<AppHeader>
<DocumentId>ST2B</DocumentId>
<Origin>PENS</Origin>
</AppHeader>
<AppBody>
<e2B:E2B>
<E2BHeader xmlns="http://www.rsvz-inasti.fgov.be/schemas/ ... /Stencil2B" VersionNbr="1.0">
<MessageStep>1</MessageStep>
</E2BHeader>
</e2B:E2B>
</AppBody>
</ns0:NISSE>
</MessageBody>
</Message>
</Mailbox>
</Body>
</Envelope>
i get an error "content not allowed in prolog".
When i change a little I get it right, but is doesn't validate anymore. Can you help me once again ? Perhaps give the complete xml like it should be and tested with the xsd ?
Thx in advance
Albert
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
There is a validation error
and it is caused by the attribute VersionNbr which is not declared in e2b.xsd. If the attribute should be allowed you have to add it to the definition of the E2BHeader in e2b.xsd, if it should not be allowed you have to remove it from the E2BHeader element. Go to an XML Schema tutorial for learning about declaring attributes in an XML Schema.
Regards,
Sorin
There is a validation error
Code: Select all
Description: cvc-complex-type.3.2.2: Attribute 'VersionNbr' is not allowed to appear in element 'E2BHeader'.
Regards,
Sorin
Return to “General XML Questions”
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