Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

XML doesn't validate

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
gplana
Asked:
gplana
  • 4
  • 4
1 Solution
 
numberkruncherCommented:
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
 
gplanaAuthor Commented:
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
 
numberkruncherCommented:
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
gplanaAuthor Commented:
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
 
gplanaAuthor Commented:
Sorry, I have forgotten the file. I Attach it now.
xml2.txt
0
 
numberkruncherCommented:
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
 
gplanaAuthor Commented:
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
 
numberkruncherCommented:
No problem.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now