I have some XML file like that:

===
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>affiliateId</key>
<string>AFL9124395098</string>
..........................
===

Now when I'm reading them with XmlDocument or XmlTextReader the reader try
to connect to aple (because of <!DOCTYPE plist PUBLIC "-//Apple
Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">)
and that causes exception when there is no network (and of course the
XmlTextReader or XmlDocument fail to read the text)

The problem is: I don't care about apple schema, I do the reading myself and
it's going to be alllright.
Is there a way I could skip over it?

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>

Re: XML reading issue.... by John

John
Sun Aug 27 20:53:26 CDT 2006

"Lloyd Dupont" <net.galador@ld> wrote in message
news:%23qBd%23ijyGHA.3428@TK2MSFTNGP02.phx.gbl...
>I have some XML file like that:
>
> ===
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
> <key>affiliateId</key>
> <string>AFL9124395098</string>
> ..........................
> ===
>
> Now when I'm reading them with XmlDocument or XmlTextReader the reader try
> to connect to aple (because of <!DOCTYPE plist PUBLIC "-//Apple
> Computer//DTD PLIST 1.0//EN"
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">)
> and that causes exception when there is no network (and of course the
> XmlTextReader or XmlDocument fail to read the text)
>
> The problem is: I don't care about apple schema, I do the reading myself
> and it's going to be alllright.
> Is there a way I could skip over it?

I believe that if you set the XmlResolver property of the XmlTextReader to
null, it will ignore the remote DTD. If that doesn't do it, you could define
your own XmlResolver derived class which processes the remote DTD in any way
you like.

John



Re: XML reading issue.... by Lloyd

Lloyd
Mon Aug 28 05:54:40 CDT 2006

Thanks John!

However that doesn't work, if I disable the DTD, I get an XmlException: "The
DTD is deactivate, activate it this way..."

So I'm stuck between a rock and a hard place.
I don't want to valid the DTD because there is no network and the XML reader
doesn't want to read the XML document because the DTD is not validated...

"John Saunders" <john.saunders at trizetto.com> wrote in message
news:uPhDCTkyGHA.2392@TK2MSFTNGP03.phx.gbl...
> "Lloyd Dupont" <net.galador@ld> wrote in message
> news:%23qBd%23ijyGHA.3428@TK2MSFTNGP02.phx.gbl...
>>I have some XML file like that:
>>
>> ===
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
>> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>> <plist version="1.0">
>> <dict>
>> <key>affiliateId</key>
>> <string>AFL9124395098</string>
>> ..........................
>> ===
>>
>> Now when I'm reading them with XmlDocument or XmlTextReader the reader
>> try to connect to aple (because of <!DOCTYPE plist PUBLIC "-//Apple
>> Computer//DTD PLIST 1.0//EN"
>> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">)
>> and that causes exception when there is no network (and of course the
>> XmlTextReader or XmlDocument fail to read the text)
>>
>> The problem is: I don't care about apple schema, I do the reading myself
>> and it's going to be alllright.
>> Is there a way I could skip over it?
>
> I believe that if you set the XmlResolver property of the XmlTextReader to
> null, it will ignore the remote DTD. If that doesn't do it, you could
> define your own XmlResolver derived class which processes the remote DTD
> in any way you like.
>
> John
>
>



Re: XML reading issue.... by Peter

Peter
Mon Aug 28 17:09:27 CDT 2006

Lloyd Dupont wrote:
> Thanks John!
>
> However that doesn't work, if I disable the DTD, I get an XmlException: "The
> DTD is deactivate, activate it this way..."
>
> So I'm stuck between a rock and a hard place.
> I don't want to valid the DTD because there is no network and the XML reader
> doesn't want to read the XML document because the DTD is not validated...

Just cut out the DocType Declaration before the file gets processed
(ie pass it through a filter of some kind, like sed).

Or filter it so that the SYSTEM Identifier resolves to a local file,
and keep a copy of the DTD at that filename.

///Peter
--
XML FAQ: http://xml.silmaril.ie/

> "John Saunders" <john.saunders at trizetto.com> wrote in message
> news:uPhDCTkyGHA.2392@TK2MSFTNGP03.phx.gbl...
>> "Lloyd Dupont" <net.galador@ld> wrote in message
>> news:%23qBd%23ijyGHA.3428@TK2MSFTNGP02.phx.gbl...
>>> I have some XML file like that:
>>>
>>> ===
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
>>> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>>> <plist version="1.0">
>>> <dict>
>>> <key>affiliateId</key>
>>> <string>AFL9124395098</string>
>>> ..........................
>>> ===
>>>
>>> Now when I'm reading them with XmlDocument or XmlTextReader the reader
>>> try to connect to aple (because of <!DOCTYPE plist PUBLIC "-//Apple
>>> Computer//DTD PLIST 1.0//EN"
>>> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">)
>>> and that causes exception when there is no network (and of course the
>>> XmlTextReader or XmlDocument fail to read the text)
>>>
>>> The problem is: I don't care about apple schema, I do the reading myself
>>> and it's going to be alllright.
>>> Is there a way I could skip over it?
>> I believe that if you set the XmlResolver property of the XmlTextReader to
>> null, it will ignore the remote DTD. If that doesn't do it, you could
>> define your own XmlResolver derived class which processes the remote DTD
>> in any way you like.
>>
>> John
>>
>>
>
>

Re: XML reading issue.... by Lloyd

Lloyd
Mon Aug 28 18:37:12 CDT 2006

>> However that doesn't work, if I disable the DTD, I get an XmlException:
>> "The DTD is deactivate, activate it this way..."
>>
>> So I'm stuck between a rock and a hard place.
>> I don't want to valid the DTD because there is no network and the XML
>> reader doesn't want to read the XML document because the DTD is not
>> validated...
>
> Just cut out the DocType Declaration before the file gets processed
> (ie pass it through a filter of some kind, like sed).

I had avoid that if I could.
That makes it forgetfulness prone. Our Mac developer edit the fil with the
PList editor which puts that in. Every time they edit a file I will have to
go after them.....

>
> Or filter it so that the SYSTEM Identifier resolves to a local file,
> and keep a copy of the DTD at that filename.
>
that's interesting! how do I do that?
I tryed to set my own XmlResolver but, unless I write a bug during my
experimentation, that didn't work... (I'm a bit suspicious though...)

> ///Peter
> --
> XML FAQ: http://xml.silmaril.ie/
>
>> "John Saunders" <john.saunders at trizetto.com> wrote in message
>> news:uPhDCTkyGHA.2392@TK2MSFTNGP03.phx.gbl...
>>> "Lloyd Dupont" <net.galador@ld> wrote in message
>>> news:%23qBd%23ijyGHA.3428@TK2MSFTNGP02.phx.gbl...
>>>> I have some XML file like that:
>>>>
>>>> ===
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
>>>> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>>>> <plist version="1.0">
>>>> <dict>
>>>> <key>affiliateId</key>
>>>> <string>AFL9124395098</string>
>>>> ..........................
>>>> ===
>>>>
>>>> Now when I'm reading them with XmlDocument or XmlTextReader the reader
>>>> try to connect to aple (because of <!DOCTYPE plist PUBLIC "-//Apple
>>>> Computer//DTD PLIST 1.0//EN"
>>>> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">)
>>>> and that causes exception when there is no network (and of course the
>>>> XmlTextReader or XmlDocument fail to read the text)
>>>>
>>>> The problem is: I don't care about apple schema, I do the reading
>>>> myself and it's going to be alllright.
>>>> Is there a way I could skip over it?
>>> I believe that if you set the XmlResolver property of the XmlTextReader
>>> to null, it will ignore the remote DTD. If that doesn't do it, you could
>>> define your own XmlResolver derived class which processes the remote DTD
>>> in any way you like.
>>>
>>> John
>>>
>>>
>>


Re: XML reading issue.... by Peter

Peter
Tue Aug 29 16:15:03 CDT 2006

Lloyd Dupont wrote:
>>> I don't want to valid the DTD because there is no network and the XML
>>> reader doesn't want to read the XML document because the DTD is not
>>> validated...
[me]
>> Just cut out the DocType Declaration before the file gets processed
>> (ie pass it through a filter of some kind, like sed).
[lloyd]
> I had avoid that if I could.
> That makes it forgetfulness prone. Our Mac developer edit the fil with the
> PList editor which puts that in. Every time they edit a file I will have to
> go after them...

OK, I thought this might be an automated process.

[me]
>> Or filter it so that the SYSTEM Identifier resolves to a local file,
>> and keep a copy of the DTD at that filename.
[lloyd]
> that's interesting! how do I do that?

sed -e "s+http://www.apple.com+file:///some/directory+" old.xml >new.xml

This leaves you with output that starts like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"/some/directory/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

All you need to do is make sure you have a directory in the relevant
place in your tree called /some/directory/DTDs, and in it a copy of the
PropertyList-1.0.dtd file (which you get from Apple; plus any ancillary
files it references).

Now when you edit/process the document, it will validate against the
local copy. You can replace /some/directory with whatever is suitable
for your system.

sed is available for Microsoft systems both with and without Cygwin
support, I believe.

///Peter
--
XML FAQ: http://xml.silmaril.ie/

Re: XML reading issue.... by Lloyd

Lloyd
Fri Sep 01 04:14:56 CDT 2006

mmh....
thanks ;-)

"Peter Flynn" <peter.nosp@m.silmaril.ie> wrote in message
news:4ljp24F29tqbU1@individual.net...
> Lloyd Dupont wrote:
>>>> I don't want to valid the DTD because there is no network and the XML
>>>> reader doesn't want to read the XML document because the DTD is not
>>>> validated...
> [me]
>>> Just cut out the DocType Declaration before the file gets processed
>>> (ie pass it through a filter of some kind, like sed).
> [lloyd]
>> I had avoid that if I could.
>> That makes it forgetfulness prone. Our Mac developer edit the fil with
>> the PList editor which puts that in. Every time they edit a file I will
>> have to go after them...
>
> OK, I thought this might be an automated process.
>
> [me]
>>> Or filter it so that the SYSTEM Identifier resolves to a local file,
>>> and keep a copy of the DTD at that filename.
> [lloyd]
>> that's interesting! how do I do that?
>
> sed -e "s+http://www.apple.com+file:///some/directory+" old.xml >new.xml
>
> This leaves you with output that starts like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
> "/some/directory/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
>
> All you need to do is make sure you have a directory in the relevant place
> in your tree called /some/directory/DTDs, and in it a copy of the
> PropertyList-1.0.dtd file (which you get from Apple; plus any ancillary
> files it references).
>
> Now when you edit/process the document, it will validate against the
> local copy. You can replace /some/directory with whatever is suitable for
> your system.
>
> sed is available for Microsoft systems both with and without Cygwin
> support, I believe.
>
> ///Peter
> --
> XML FAQ: http://xml.silmaril.ie/