Did you really intend to use this as an xml file? If not please post
complete xml file....but you probably should find a more on topic group.
Errors:
line 2, :
error (1102): tag uses GI for an undeclared element: Message
line 2, :
error (1203): attribute can't be checked because element is not defined:
Message
line 2, :
error (1203): attribute can't be checked because element is not defined:
Message
line 2, :
error (1203): attribute can't be checked because element is not defined:
Message
line 2, :
error (1203): attribute can't be checked because element is not defined:
Message
line 3, :
error (1102): tag uses GI for an undeclared element: id
line 3, :
error (1203): attribute can't be checked because element is not defined:
id
line 3, :
error (1150): enclosing tag undefined or lacks content model; can't
check child: id
line 4, :
error (1102): tag uses GI for an undeclared element: creationTime
line 4, :
error (1203): attribute can't be checked because element is not defined:
creationTime
line 4, :
error (1150): enclosing tag undefined or lacks content model; can't
check child: creationTime
line 5, :
error (1203): attribute can't be checked because element is not defined:
acknowledgement
line 5, :
error (1102): tag uses GI for an undeclared element: acknowledgement
line 6, :
error (1102): tag uses GI for an undeclared element: messageRef
line 7, :
error (1102): tag uses GI for an undeclared element: id
line 7, :
error (1203): attribute can't be checked because element is not defined:
id
line 7, :
error (1150): enclosing tag undefined or lacks content model; can't
check child: id
line 8, :
error (1103): end tag uses GI for an undeclared element: messageRef
line 8, :
error (1150): enclosing tag undefined or lacks content model; can't
check child: messageRef
line 9, :
error (1103): end tag uses GI for an undeclared element: acknowledgement
line 9, :
error (1150): enclosing tag undefined or lacks content model; can't
check child: acknowledgement
line 10, :
error (1103): end tag uses GI for an undeclared element: Message
line 11, :
error (402): EOF encountered; no doctype declaration found: Message
--------------------------------------------------------------------------------
Original Document:
line 2: <Message xmlns="urn:myurl-org:ns2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:myurl-org:ns2 ..\Schemas\schema.xsd"
type="Message">
line 3: <id root="7DC0FFE7-1224-4598-8F20-3B7662D416A1"/>
line 4: <creationTime value="2004"/>
line 5: <acknowledgement typeCode="AE">
line 6: <messageRef>
line 7: <id root="04074443-DE90-4FE8-9D4A-DBF9A7E81FFA"/>
line 8: </messageRef>
line 9: </acknowledgement>
line 10: </Message>
end-of-file
"Mike [MCP VB]" <www.evolvedsoftwarestudios.com> wrote in message
news:#n**************@TK2MSFTNGP11.phx.gbl:
Hi, I hope this is the right place to ask.
I have an xml file thus:
<?xml version="1.0" encoding="UTF-8"?>
<Message xmlns="urn:myurl-org:ns2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:myurl-org:ns2
..\Schemas\schema.xsd" type="Message">
<id root="7DC0FFE7-1224-4598-8F20-3B7662D416A1"/>
<creationTime value="2004"/>
<acknowledgement typeCode="AE">
<messageRef>
<id root="04074443-DE90-4FE8-9D4A-DBF9A7E81FFA"/>
</messageRef>
</acknowledgement>
</Message>
I wish to be able to parse the file such that I can return the root
attribute of the id node within messageRef.
Unfortunately, I cannot do this using msxml. getElementByTagName doesn't
work because a default namespace is provided. In fact, I cannot loop
through
the nodes either, as msxml only suggests the document has one node
<Message
/>, but no children.
I am considering swapping over from VB6 to VB.NET to accomplish this task,
as I've heard the system.xml namespace contains a revised implementation
of
the DOM object that will allow use of getElementByTagName with default
namespaces.
Could anyone proffer the code to return the above attribute (as string, or
ixmlattributenode)?
Many thanks in advance.
Mike