user1590425
user1590425

Reputation: 31

How can I validate a XML file?

my contacts.xml file is:

<?xml version="1.1" encoding="UTF-8" standalone="no" ?>
 <Directory>
   <Contacts DeviceID="" FolderID="" FolderName="">    
      <Contact contacttype="0" id="111" optype="0">
         <FirstName>shiva1</FirstName>
         <wsuniqueid>00000000A4DACC2711A8D24C9AC2C2999311125BC4306A00</wsuniqueid>
      </Contact>
      <Contact contacttype="0" id="222" optype="0">
         <FirstName>shiva2</FirstName>
         <wsuniqueid>00000000A4DACC2711A8D24C9AC2C2999311125BC4306A01</wsuniqueid>
      </Contact>
   </Contacts>
</Directory>

when i want to insert some node or data by query:

insert node <a/> into doc('contacts.xml')//Directory/Contacts/Contact[@id = '111'] 

from linux command it is giving error XQDY0084 ..

Upvotes: 0

Views: 173

Answers (1)

grtjn
grtjn

Reputation: 20414

The error code is not related to the insertion (directly). It indicated you are using strict validation somewhere, and you are not adhering to the strict validation rules. Perhaps because the system cannot find an appropriate schema file in which Directory is a valid root element.

Namespace your elements, and use an appropriate XML Schema, or decide not to validate at all.

HTH!

Upvotes: 0

Related Questions