473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

import problem

I have an XSD which has an import to an XSD located on the web which has a DTD within it. (Using VS-2005 2.0 framework)

If I load the XSD using the following, it can't find elements defined within the "xmldsig-core-schema.xsd" file, when I validate.
[HTML]Dim oXmlReaderSettings As New XmlReaderSettings()
oXmlReaderSettings.ProhibitDtd = False
'-- Set for schema validation
oXmlReaderSettings.ValidationType = ValidationType.Schema
oXmlReaderSettings.Schemas.Add(Nothing, "WS-TDL.xsd")
Dim oRequestReader As New StringReader(...
Dim oPayloadXmlReader As XmlReader = XmlReader.Create(oRequestReader, oSchemasSettings
[/HTML]

If I explicitly load the xsd from the web, I can validate except when the doc has a element which requires a definition that is in the XSD on the web.
FOR example:
-- Load xsd
' do something like the following to explicitly load the xsd
oXmlReaderSettings.Schemas.Add(Nothing,
http://www.w3.org/TR/2002/REC-xmldsi...re-schema.xsd)
I get the following type of error
The element 'X509IssuerSerial' has invalid child element 'X509IssuerName'. List of possible elements expected: 'X509IssuerName' in namespace 'http://www.w3.org/2000/09/xmldsig#'.


Any Ideas as to why this is or how to correct the problem? (WS-TDL.XSD file being loaded is listed below)
[HTML]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:aix_tdl="http://www.accessitx.com/TDL_Interface" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd" />
<xs:import namespace="http://www.accessitx.com/TDL_Interface" schemaLocation="TDL_Interface.xsd" />
<xs:complexType name="TDLRequest_DateType">
<xs:sequence>
<xs:element name="StartDate" type="xs:dateTime" />
<xs:element name="EndDate" type="xs:dateTime" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="TDLRequest_SNType">
<xs:sequence>
<xs:element name="SerialNumber" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="TDLRequest_X509NameType">
<xs:sequence>
<xs:element name="X509IssuerSerial" type="ds:X509IssuerSerialType" minOccurs="0" />
<xs:element name="X509SubjectName" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="TDLRequest_All">
<xs:sequence>
<xs:element name="All" />
</xs:sequence>
</xs:complexType>
<xs:element name="TDLRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="SequenceID" type="xs:long" />
<xs:element name="UserNameToken" type="xs:base64Binary" />
<xs:element name="RequestPayload" type="TDLRequest_PayloadType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="TDLRequest_PayloadType">
<xs:choice>
<xs:element name="CertificationDateRange" type="TDLRequest_DateType" />
<xs:element name="InstallationDateRange" type="TDLRequest_DateType" />
<xs:element name="ChangedDateRange" type="TDLRequest_DateType" />
<xs:element name="SerialNo" type="TDLRequest_SNType" />
<xs:element name="X509Name" type="TDLRequest_X509NameType" />
<xs:element name="All" type="TDLRequest_All" />
</xs:choice>
</xs:complexType>
<xs:complexType name="tdlAction">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="scope" type="xs:anyURI" use="optional" default="http://www.accessitx.com/TDL_Interface#action" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="TDLUpdate">
<xs:complexType>
<xs:sequence>
<xs:element name="SequenceID" type="xs:long" />
<xs:element name="UserNameToken" type="xs:base64Binary" />
<xs:element name="UpdatePayload">
<xs:complexType>
<xs:sequence>
<xs:element name="Action" type="tdlAction" />
<xs:choice>
<xs:element name="Add">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Site" type="aix_tdl:FacilityType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Update">
<xs:complexType>
<xs:sequence>
<xs:element name="Old_Site" type="aix_tdl:FacilityType" />
<xs:element name="New_Site" type="aix_tdl:FacilityType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Delete">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Site" type="aix_tdl:FacilityType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TDLResponse">
<xs:complexType>
<xs:choice>
<xs:element name="Ack" />
<xs:element name="Sites" type="aix_tdl:FacilityType" maxOccurs="unbounded" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
[/HTML]
Jul 20 '07 #1
4 1896
jkmyoung
2,057 Expert 2GB
It sounds like the elements in your xml file are not in the correct namespace, and/or do not have a namespace.
Is the xml file you are receiving actually valid?
Jul 20 '07 #2
>>It sounds like the elements in your xml file are not in the correct namespace, >>and/or do not have a namespace.
>>Is the xml file you are receiving actually valid?

I believe that the "file" is valid I am able to validate it unless it has tags defined in the "imported" namespace

'sample that validates
Dim sRequest As String = "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf "<TDLRequest><SequenceID>35266737</SequenceID><UserNameToken>ZAVsbG9gQ29ybGQ=</UserNameToken><RequestPayload><X509Name><X509Subje ctName>MyTest</X509SubjectName></X509Name></RequestPayload></TDLRequest>"
'sample that won't validate
Dim sRequest As String = "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf & "<TDLRequest><SequenceID>2735266737</SequenceID><UserNameToken>ZAVsbG9gQ29ybGQ=</UserNameToken><RequestPayload><X509Name><X509Issue rSerial><X509IssuerName>Steve</X509IssuerName><X509SerialNumber>1001</X509SerialNumber></X509IssuerSerial><X509SubjectName>MyTest</X509SubjectName></X509Name></RequestPayload></TDLRequest>"
Jul 23 '07 #3
jkmyoung
2,057 Expert 2GB
The elements in the schema http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd appear to be in the namespace, http://www.w3.org/2000/09/xmldsig#"

I would think this would validate:
Dim sRequest As String = "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf & "<TDLRequest><SequenceID>2735266737</SequenceID><UserNameToken>ZAVsbG9gQ29ybGQ=</UserNameToken><RequestPayload><X509Name><X509Issue rSerial><X509IssuerName xmlns="http://www.w3.org/2000/09/xmldsig#" >Steve</X509IssuerName><X509SerialNumber>1001</X509SerialNumber></X509IssuerSerial><X509SubjectName>MyTest</X509SubjectName></X509Name></RequestPayload></TDLRequest>"
Jul 23 '07 #4
Thanks!
Your answer may be correct, but I found another way.
I specifed the namespace in the initial element and in the specific tags which point to the namespace.

<?xml version="1.0" encoding="UTF-8"?>
<TDLRequest xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><SequenceID>2735266737...<ds:X509IssuerN ame>Steve</ds:X509IssuerName><ds:X509SerialNumber>1001</ds:X509SerialNumber>...</TDLRequest>"
Jul 24 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John Roth | last post by:
I've found a case where it seems that Python is importing two copies of a module without any reason or indication. It took me a while to verify that this is what is occuring: I had to write a...
5
by: Steve Holden | last post by:
This is even stranger: it makes it if I import the module a second time: import dbimp as dbimp import sys if __name__ == "__main__": dbimp.install() #k = sys.modules.keys() #k.sort() #for...
2
by: Jon | last post by:
It appears that (windows) python searches in the current working directory before looking in the local site-packages directory, or that '.' comes first in sys.path? The problem arises when I made...
2
by: Panard | last post by:
Hi, I'm experiencing a strange problem while trying to manage a ftp connection into a separate thread. I'm on linux, python 2.4.3 Here is a test : ------ ftp_thread.py ------ import ftplib...
6
by: robert | last post by:
I get python crashes and (in better cases) strange Python exceptions when (in most cases) importing and using cookielib lazy on demand in a thread. It is mainly with cookielib, but remember the...
1
by: Nick Craig-Wood | last post by:
I've been dumping a database in a python code format (for use with Python on S60 mobile phone actually) and I've noticed that it uses absolutely tons of memory as compared to how much the data...
0
by: Victor Lin | last post by:
Hi, I got some problem with import. I have some python file that should be executed. Something like unit-test or other small tool. The project is not so small. So I want to separate these files...
5
by: Stef Mientki | last post by:
hello, The import statement "import sqlite3" gives the error given below. In simple programs, the import statement (sometimes) succeed, and I can indeed access the database. So I guess there is...
10
by: nisp | last post by:
Hi all ! I'm trying to capture stderr of an external module I use in my python program. I'm doing this by setting up a class in my module overwriting the stderr file object method write. The...
13
by: Rafe | last post by:
Hi, I am in a situation where I feel I am being forced to abandon a clean module structure in favor of a large single module. If anyone can save my sanity here I would be forever grateful. My...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.