Solved

XML doesn't validate

Posted on 2009-04-10
8
238 Views
Last Modified: 2012-05-06
Dear Expert:

I'm trying to create an XML for the new Microsoft Office 14, but I cannot reach to validate it to his XSD Schema. It seems to fail on the first character, so maybe it's because its encoding on UTF-16.

I attach the XML file as well as XSD file. I wonder if someone can help me solving this issue.

Thank you a lot.
xsd.txt
xml.txt
0
Comment
Question by:gplana
  • 4
  • 4
8 Comments
 
LVL 13

Expert Comment

by:numberkruncher
ID: 24119684
There are a lot of validation issues with your XML/Schema; but depending upon your technology there may also be an issue with reading the XML content.

- It would be worth making sure that you are opening the files in UTF-16 for the XML and UTF-8 for the schema (this applies if you are programming, not if you are using an XML tool like Oxygen). If you are opening the file in ASCII format, then there are clearly going to be problems.

- Your schema does not specify what the "vendorProductSets" tag is. According to the schema there is no such element, so that fails immediately.

- Your schema states that the first element must be a "vendorProductSet".
0
 
LVL 15

Author Comment

by:gplana
ID: 24119720
Thank you. I understand what you say about vendorProductSets. However, I think there are problems on XML validation too (without applying to any schema) as if you double-click the XML file, it says "wrong character <", which I think is the initial < character (????).

Can you help me on this ?
0
 
LVL 13

Expert Comment

by:numberkruncher
ID: 24119801
The XML does not validate because the XML file is incomplete, all tags must be closed for an XML file to be valid. Take a look at the end of the file in a text editor, at the very least it should be something like the following (second part):
WHAT YOU HAVE ATM:

==================

                <masterPanel masterID="0" height="29.4" width="52.5" />

                <sheet height="294" width="210" allowPartialSheet="True" >

                    <sheetGrid numAcross="4" numDown="10" horizGap="0" vertGap="0" posX="0" posY="0" 
 
 

WHAT YOU NEED:

==============

                <masterPanel masterID="0" height="29.4" width="52.5" />

                <sheet height="294" width="210" allowPartialSheet="True" >

                    <sheetGrid numAcross="4" numDown="10" horizGap="0" vertGap="0" posX="0" posY="0">

                        

                    </sheetGrid>

                </sheet>

            </product>

        </vendorProductSet>

    </vendorProductSets>

</vps>

Open in new window

0
 
LVL 15

Author Comment

by:gplana
ID: 24119950
Sorry, I generated a new xml file following your advices, but it seems it doesn't validate yet.

I attach the new file. Can you fell me what I missed ?

I noticed that it says the error is the invalid character < which says is on the second position on the file (and it's really on first position, but it's codified on UTF-16, so it last 2 bytes). Could it be this the issue ?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 15

Author Comment

by:gplana
ID: 24119971
Sorry, I have forgotten the file. I Attach it now.
xml2.txt
0
 
LVL 13

Accepted Solution

by:
numberkruncher earned 500 total points
ID: 24119983
If the program that you are using is loading the text file in ASCII or UTF-8 then the XML processor sees the following:

< ? x m l   v e r s i o n = " 1 . 0 "   e n c o d i n g = " u t f - 1 6 " ? >  
 < v p s >  
         < v e n d o r P r o d u c t S e t s >

Instead of:

<?xml version="1.0" encoding="utf-16"?>

   

Thus the processor cannot read the second character because it is expecting "?" but finding " ". Make sure that your software is loading the file using the correct encoding.
0
 
LVL 15

Author Comment

by:gplana
ID: 24120023
Excellent. now I understand. I opened the file from the notepad and saved as Unicode Big Endian. I generated the file from a VB6 program I made, and I think I put the inverse byte order.

Thank you a lot.
0
 
LVL 13

Expert Comment

by:numberkruncher
ID: 24120026
No problem.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now