Solved

XML doesn't validate

Posted on 2009-04-10
8
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 
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
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
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, …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

726 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