Hi,
i have this file:
<?xml version="1.0"?>
<catalog xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- START OF SCHEMA -->
<xsd:schema>
<xsd:element name="book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="genre" type="xsd:string"/>
<xsd:element name="price" type="xsd:float"/>
<xsd:element name="publish_date" type="xsd:date"/>
<xsd:element name="description" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<!-- END OF SCHEMA -->
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<cost>44.95</cost>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with
XML.</description>
</book>
</catalog>
it's an microsoft example.
Why when i try to validate this file the object return me that the file
is valid?!
(there is a <cost> element that is not declared in xsd schema).
Anybody knows why?
I've used this script to validate:
<%
' Validate files and display output in text box.
Dim sOutput
sOutput = ValidateFile("novalid.xml")
response.write sOutput
Function ValidateFile(strFile)
Path = "C:\inetpub\cmssviluppo1\wwwroot\sviluppo\esempi2"
' Create an XML DOMDocument object.
set x = CreateObject("MSXML2.DOMDocument.6.0")
' Load and validate the specified file into the DOM.
x.async = False
x.validateOnParse = True
x.resolveExternals = True
x.Load Path & "\" & strFile
' Return validation results in message to the user.
If x.parseError.errorCode <> 0 Then
ValidateFile = "Validation failed on " & _
strFile & vbCrLf & _
"=====================" & vbCrLf & _
"Reason: " & x.parseError.reason & _
vbCrLf & "Source: " & _
x.parseError.srcText & _
vbCrLf & "Line: " & _
x.parseError.Line & vbCrLf
Else
ValidateFile = "Validation succeeded for " & _
strFile & vbCrLf & _
"======================" & _
vbCrLf & x.xml & vbCrLf
End If
End Function
%>
Thanks!!
Processing of inline schemas is off by default in MSXML6. You need to set
UseInlineSchema property to true:
x.validateOnParse = True
x.resolveExternals = True
x.useInlineSchema = True
More info on msdn:
http://msdn.microsoft.com/library/de...3695c318bf.asp
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"maurox" <mrago@.inwind.it> wrote in message
news:1140540428.842442.100810@.f14g2000cwb.googlegr oups.com...
> Hi,
> i have this file:
> <?xml version="1.0"?>
> <catalog xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <!-- START OF SCHEMA -->
> <xsd:schema>
> <xsd:element name="book">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="author" type="xsd:string"/>
> <xsd:element name="title" type="xsd:string"/>
> <xsd:element name="genre" type="xsd:string"/>
> <xsd:element name="price" type="xsd:float"/>
> <xsd:element name="publish_date" type="xsd:date"/>
> <xsd:element name="description" type="xsd:string"/>
> </xsd:sequence>
> <xsd:attribute name="id" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> <!-- END OF SCHEMA -->
> <book id="bk101">
> <author>Gambardella, Matthew</author>
> <title>XML Developer's Guide</title>
> <genre>Computer</genre>
> <cost>44.95</cost>
> <publish_date>2000-10-01</publish_date>
> <description>An in-depth look at creating applications with
> XML.</description>
> </book>
> </catalog>
> it's an microsoft example.
> Why when i try to validate this file the object return me that the file
> is valid?!
> (there is a <cost> element that is not declared in xsd schema).
> Anybody knows why?
> I've used this script to validate:
> <%
> ' Validate files and display output in text box.
> Dim sOutput
> sOutput = ValidateFile("novalid.xml")
> response.write sOutput
> Function ValidateFile(strFile)
> Path = "C:\inetpub\cmssviluppo1\wwwroot\sviluppo\esempi2"
> ' Create an XML DOMDocument object.
> set x = CreateObject("MSXML2.DOMDocument.6.0")
> ' Load and validate the specified file into the DOM.
> x.async = False
> x.validateOnParse = True
> x.resolveExternals = True
> x.Load Path & "\" & strFile
> ' Return validation results in message to the user.
> If x.parseError.errorCode <> 0 Then
> ValidateFile = "Validation failed on " & _
> strFile & vbCrLf & _
> "=====================" & vbCrLf & _
> "Reason: " & x.parseError.reason & _
> vbCrLf & "Source: " & _
> x.parseError.srcText & _
> vbCrLf & "Line: " & _
> x.parseError.Line & vbCrLf
> Else
> ValidateFile = "Validation succeeded for " & _
> strFile & vbCrLf & _
> "======================" & _
> vbCrLf & x.xml & vbCrLf
> End If
> End Function
> %>
> Thanks!!
>
|||ok, i do this but the page return me that the property is no supported
by object...
i use vbscript in asp page.
maybe i can't validate a file with an inline schema by vbscript?
|||anybody can help me?
|||ok, i have fix the problem.
UseInlineSchema is a second-level property. to set it true is necessary
type this:
x.setProperty "UseInlineSchema", true
http://windowssdk.msdn.microsoft.com...3695c318bf.asp
thank
Showing posts with label gtlt-. Show all posts
Showing posts with label gtlt-. Show all posts
Friday, March 23, 2012
Problem with inline validation
Hi,
i have this file:
<?xml version="1.0"?>
<catalog xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- START OF SCHEMA -->
<xsd:schema>
<xsd:element name="book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="genre" type="xsd:string"/>
<xsd:element name="price" type="xsd:float"/>
<xsd:element name="publish_date" type="xsd:date"/>
<xsd:element name="description" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<!-- END OF SCHEMA -->
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<cost>44.95</cost>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with
XML.</description>
</book>
</catalog>
it's an microsoft example.
Why when i try to validate this file the object return me that the file
is valid?!
(there is a <cost> element that is not declared in xsd schema).
Anybody knows why'
I've used this script to validate:
<%
' Validate files and display output in text box.
Dim sOutput
sOutput = ValidateFile("novalid.xml")
response.write sOutput
Function ValidateFile(strFile)
Path = " C:\inetpub\cmssviluppo1\wwwroot\sviluppo
\esempi2"
' Create an XML DOMDocument object.
set x = CreateObject("MSXML2.DOMDocument.6.0")
' Load and validate the specified file into the DOM.
x.async = False
x.validateOnParse = True
x.resolveExternals = True
x.Load Path & "\" & strFile
' Return validation results in message to the user.
If x.parseError.errorCode <> 0 Then
ValidateFile = "Validation failed on " & _
strFile & vbCrLf & _
"=====================" & vbCrLf & _
"Reason: " & x.parseError.reason & _
vbCrLf & "Source: " & _
x.parseError.srcText & _
vbCrLf & "Line: " & _
x.parseError.Line & vbCrLf
Else
ValidateFile = "Validation succeeded for " & _
strFile & vbCrLf & _
"======================" & _
vbCrLf & x.xml & vbCrLf
End If
End Function
%>
Thanks!!Processing of inline schemas is off by default in MSXML6. You need to set
UseInlineSchema property to true:
x.validateOnParse = True
x.resolveExternals = True
x.useInlineSchema = True
More info on msdn:
http://msdn.microsoft.com/library/d...e3695c318bf.asp
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"maurox" <mrago@.inwind.it> wrote in message
news:1140540428.842442.100810@.f14g2000cwb.googlegroups.com...
> Hi,
> i have this file:
> <?xml version="1.0"?>
> <catalog xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <!-- START OF SCHEMA -->
> <xsd:schema>
> <xsd:element name="book">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="author" type="xsd:string"/>
> <xsd:element name="title" type="xsd:string"/>
> <xsd:element name="genre" type="xsd:string"/>
> <xsd:element name="price" type="xsd:float"/>
> <xsd:element name="publish_date" type="xsd:date"/>
> <xsd:element name="description" type="xsd:string"/>
> </xsd:sequence>
> <xsd:attribute name="id" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> <!-- END OF SCHEMA -->
> <book id="bk101">
> <author>Gambardella, Matthew</author>
> <title>XML Developer's Guide</title>
> <genre>Computer</genre>
> <cost>44.95</cost>
> <publish_date>2000-10-01</publish_date>
> <description>An in-depth look at creating applications with
> XML.</description>
> </book>
> </catalog>
> it's an microsoft example.
> Why when i try to validate this file the object return me that the file
> is valid?!
> (there is a <cost> element that is not declared in xsd schema).
> Anybody knows why'
> I've used this script to validate:
> <%
> ' Validate files and display output in text box.
> Dim sOutput
> sOutput = ValidateFile("novalid.xml")
> response.write sOutput
> Function ValidateFile(strFile)
> Path = " C:\inetpub\cmssviluppo1\wwwroot\sviluppo
\esempi2"
> ' Create an XML DOMDocument object.
> set x = CreateObject("MSXML2.DOMDocument.6.0")
> ' Load and validate the specified file into the DOM.
> x.async = False
> x.validateOnParse = True
> x.resolveExternals = True
> x.Load Path & "\" & strFile
> ' Return validation results in message to the user.
> If x.parseError.errorCode <> 0 Then
> ValidateFile = "Validation failed on " & _
> strFile & vbCrLf & _
> "=====================" & vbCrLf & _
> "Reason: " & x.parseError.reason & _
> vbCrLf & "Source: " & _
> x.parseError.srcText & _
> vbCrLf & "Line: " & _
> x.parseError.Line & vbCrLf
> Else
> ValidateFile = "Validation succeeded for " & _
> strFile & vbCrLf & _
> "======================" & _
> vbCrLf & x.xml & vbCrLf
> End If
> End Function
> %>
> Thanks!!
>|||ok, i do this but the page return me that the property is no supported
by object...
i use vbscript in asp page.
maybe i can't validate a file with an inline schema by vbscript?|||anybody can help me'|||ok, i have fix the problem.
UseInlineSchema is a second-level property. to set it true is necessary
type this:
x.setProperty "UseInlineSchema", true
http://windowssdk.msdn.microsoft.co...e3695c318bf.asp
thank
i have this file:
<?xml version="1.0"?>
<catalog xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- START OF SCHEMA -->
<xsd:schema>
<xsd:element name="book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="genre" type="xsd:string"/>
<xsd:element name="price" type="xsd:float"/>
<xsd:element name="publish_date" type="xsd:date"/>
<xsd:element name="description" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<!-- END OF SCHEMA -->
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<cost>44.95</cost>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with
XML.</description>
</book>
</catalog>
it's an microsoft example.
Why when i try to validate this file the object return me that the file
is valid?!
(there is a <cost> element that is not declared in xsd schema).
Anybody knows why'
I've used this script to validate:
<%
' Validate files and display output in text box.
Dim sOutput
sOutput = ValidateFile("novalid.xml")
response.write sOutput
Function ValidateFile(strFile)
Path = " C:\inetpub\cmssviluppo1\wwwroot\sviluppo
\esempi2"
' Create an XML DOMDocument object.
set x = CreateObject("MSXML2.DOMDocument.6.0")
' Load and validate the specified file into the DOM.
x.async = False
x.validateOnParse = True
x.resolveExternals = True
x.Load Path & "\" & strFile
' Return validation results in message to the user.
If x.parseError.errorCode <> 0 Then
ValidateFile = "Validation failed on " & _
strFile & vbCrLf & _
"=====================" & vbCrLf & _
"Reason: " & x.parseError.reason & _
vbCrLf & "Source: " & _
x.parseError.srcText & _
vbCrLf & "Line: " & _
x.parseError.Line & vbCrLf
Else
ValidateFile = "Validation succeeded for " & _
strFile & vbCrLf & _
"======================" & _
vbCrLf & x.xml & vbCrLf
End If
End Function
%>
Thanks!!Processing of inline schemas is off by default in MSXML6. You need to set
UseInlineSchema property to true:
x.validateOnParse = True
x.resolveExternals = True
x.useInlineSchema = True
More info on msdn:
http://msdn.microsoft.com/library/d...e3695c318bf.asp
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"maurox" <mrago@.inwind.it> wrote in message
news:1140540428.842442.100810@.f14g2000cwb.googlegroups.com...
> Hi,
> i have this file:
> <?xml version="1.0"?>
> <catalog xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <!-- START OF SCHEMA -->
> <xsd:schema>
> <xsd:element name="book">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="author" type="xsd:string"/>
> <xsd:element name="title" type="xsd:string"/>
> <xsd:element name="genre" type="xsd:string"/>
> <xsd:element name="price" type="xsd:float"/>
> <xsd:element name="publish_date" type="xsd:date"/>
> <xsd:element name="description" type="xsd:string"/>
> </xsd:sequence>
> <xsd:attribute name="id" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> <!-- END OF SCHEMA -->
> <book id="bk101">
> <author>Gambardella, Matthew</author>
> <title>XML Developer's Guide</title>
> <genre>Computer</genre>
> <cost>44.95</cost>
> <publish_date>2000-10-01</publish_date>
> <description>An in-depth look at creating applications with
> XML.</description>
> </book>
> </catalog>
> it's an microsoft example.
> Why when i try to validate this file the object return me that the file
> is valid?!
> (there is a <cost> element that is not declared in xsd schema).
> Anybody knows why'
> I've used this script to validate:
> <%
> ' Validate files and display output in text box.
> Dim sOutput
> sOutput = ValidateFile("novalid.xml")
> response.write sOutput
> Function ValidateFile(strFile)
> Path = " C:\inetpub\cmssviluppo1\wwwroot\sviluppo
\esempi2"
> ' Create an XML DOMDocument object.
> set x = CreateObject("MSXML2.DOMDocument.6.0")
> ' Load and validate the specified file into the DOM.
> x.async = False
> x.validateOnParse = True
> x.resolveExternals = True
> x.Load Path & "\" & strFile
> ' Return validation results in message to the user.
> If x.parseError.errorCode <> 0 Then
> ValidateFile = "Validation failed on " & _
> strFile & vbCrLf & _
> "=====================" & vbCrLf & _
> "Reason: " & x.parseError.reason & _
> vbCrLf & "Source: " & _
> x.parseError.srcText & _
> vbCrLf & "Line: " & _
> x.parseError.Line & vbCrLf
> Else
> ValidateFile = "Validation succeeded for " & _
> strFile & vbCrLf & _
> "======================" & _
> vbCrLf & x.xml & vbCrLf
> End If
> End Function
> %>
> Thanks!!
>|||ok, i do this but the page return me that the property is no supported
by object...
i use vbscript in asp page.
maybe i can't validate a file with an inline schema by vbscript?|||anybody can help me'|||ok, i have fix the problem.
UseInlineSchema is a second-level property. to set it true is necessary
type this:
x.setProperty "UseInlineSchema", true
http://windowssdk.msdn.microsoft.co...e3695c318bf.asp
thank
Subscribe to:
Posts (Atom)