?
Solved

XML doesn't validate

Posted on 2009-04-10
8
Medium Priority
?
248 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

770 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