XML Load Fails

XML Load Fails

Post by Greg » Wed, 14 Nov 2001 02:56:21



I'm attempting to save an XML file to the server using
the .save method of the XMLDOM object. The problem is that
the when I use the .loadXML method, it fails. I have
checked to make sure that the XML string I am loading
contains XML, and it does.

What are reasons for the load failing?

 
 
 

XML Load Fails

Post by Saurabh Lakhi » Wed, 14 Nov 2001 03:28:37


Use.......
ObjDom.Load("C:\abc.xml")
instead of  ObjDOM.loadxml("C:\abc.xml")

Saurabh


Quote:> I'm attempting to save an XML file to the server using
> the .save method of the XMLDOM object. The problem is that
> the when I use the .loadXML method, it fails. I have
> checked to make sure that the XML string I am loading
> contains XML, and it does.

> What are reasons for the load failing?


 
 
 

XML Load Fails

Post by Saurabh Lakhi » Wed, 14 Nov 2001 03:22:53


Hi,

I have Namedpair array , which contain Name of the field and its value. Now
here I want to create XML string from that Array and that function should be
generic, So I could use in my all VB Component. Please help me out.

Thanks in Advacne.
Saurabh

 
 
 

XML Load Fails

Post by Dan » Wed, 14 Nov 2001 03:31:44


Try code like this:

if xmldoc.parseError.errorCode <> 0 then
     with xmldoc.parseError
          Response.write .errorCode & ":" & .reason & ":"
& .line
     end with
end if

Quote:>-----Original Message-----
>I'm attempting to save an XML file to the server using
>the .save method of the XMLDOM object. The problem is
that
>the when I use the .loadXML method, it fails. I have
>checked to make sure that the XML string I am loading
>contains XML, and it does.

>What are reasons for the load failing?
>.

 
 
 

1. Why is XML load failing ?

Hello All

Here are the files and the source code for validate..My question is why the
'price' not being recognized
as an attribute of book element .  When I remove the prefixes , the
validation goes throu.

What should I do for the 'price' to get picked when using namespace prefixes
in the xml document.

book.xml
<?xml version ="1.0"?>
<a:book a:price="$12" xmlns:a="x-schema:bookschema.xml">
  <a:title>Presenting XML</a:title>
  <a:author>Richard Light</a:author>
  <a:pages>334</a:pages>
</a:book>

bookschema.xml

<?xml version="1.0"?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data">
  <ElementType name="title"/>
  <ElementType name="author"/>
  <ElementType name="pages"/>
  <AttributeType name="price"/>
  <ElementType name="book" model="closed">
    <element type="title"/>
    <element type="author"/>
    <element type="pages"/>
    <attribute type="price"/>
  </ElementType>
</Schema>

VB source code
Private Sub Command1_Click()
   Dim oDoc As MSXML2.DOMDocument
   Set oDoc = New MSXML2.DOMDocument
  'The property below is set to 'true' to validate an XML document
   oDoc.validateOnParse = True
   oDoc.async = False

 'oDoc.setProperty "SelectionNamespaces",
"xmlns:a='x-schema:bookschema.xml'"

'For this example both book.xml and bookschema.xml are in the same
directory.
 If oDoc.Load("c:\book.xml") Then
     MsgBox "Load successful, the document is valid"
 Else

        Err.Raise vbObjectError, Me.Name, oDoc.parseError.reason
 End If
End Sub

Thanks

2. dns and bootp servers for Solaris 2.x

3. Should "load" method fail if Schema validation fails?

4. Canadian Stupidity

5. FAILED(hr) returned from pxml->load but object loaded

6. FS: Sharp Zaurus 5000

7. XMLDOMDocument load(request) fails under heavy load

8. Need Help! Robot Control Signal Transmission

9. Failed to load serverxmlhttpObj.responseXML into MS XML parser

10. Load XML fails over SSL connection

11. Failing to load XML

12. xml load/parsing of xmlhttp post failing

13. ADO Recordset.Open fails for DOMDocument loaded with XML file