Solved

XML doesn't validate

Posted on 2009-04-10
8
240 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

920 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

14 Experts available now in Live!

Get 1:1 Help Now