Obtaining XML version and encoding using TDOMDocument object

I want to read an strict XML file including the <?xml> tag into a Delphi program. For this I use the TDOMDocument as imported from the msxml.dll library. I can currently access everything except the information in the <?xml> tag.
I previously tried the IXMLDOMDocumentType and searched through the members of alle the msxml objects in the MSDN. Both yielded no results.

Comments

  • : I want to read an strict XML file including the <?xml> tag into a Delphi program. For this I use the TDOMDocument as imported from the msxml.dll library. I can currently access everything except the information in the <?xml> tag.
    : I previously tried the IXMLDOMDocumentType and searched through the members of alle the msxml objects in the MSDN. Both yielded no results.
    :
    Quite strange... is that necessary to use TDOMDocument or IXMLDOMDocumentType? I don't anything about XML's...

    **************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • : : I want to read an strict XML file including the <?xml> tag into a Delphi program. For this I use the TDOMDocument as imported from the msxml.dll library. I can currently access everything except the information in the <?xml> tag.
    : : I previously tried the IXMLDOMDocumentType and searched through the members of alle the msxml objects in the MSDN. Both yielded no results.
    : :
    : Quite strange... is that necessary to use TDOMDocument or IXMLDOMDocumentType? I don't anything about XML's...
    :
    : **************
    : Any questions? Just ask!
    :
    : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    :
    :
    :
    I was just trying to point that if both yielded no results, maybe not these two are the correct to use for reading the ?xml> section. Maybe you should use simple AssignFile and the others to read the data inside it, and then interpret it somehow. (Further info about XML would help me helping you.) :-)

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • [b][red]This message was edited by zibadian at 2005-4-8 9:40:53[/red][/b][hr]
    : : : I want to read an strict XML file including the <?xml> tag into a Delphi program. For this I use the TDOMDocument as imported from the msxml.dll library. I can currently access everything except the information in the <?xml> tag.
    : : : I previously tried the IXMLDOMDocumentType and searched through the members of alle the msxml objects in the MSDN. Both yielded no results.
    : : :
    : : Quite strange... is that necessary to use TDOMDocument or IXMLDOMDocumentType? I don't anything about XML's...
    : :
    : : **************
    : : Any questions? Just ask!
    : :
    : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : :
    : :
    : :
    : I was just trying to point that if both yielded no results, maybe not these two are the correct to use for reading the ?xml> section. Maybe you should use simple AssignFile and the others to read the data inside it, and then interpret it somehow. (Further info about XML would help me helping you.) :-)
    :
    : ****************
    : Any questions? Just ask!
    :
    : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    :
    :
    :
    XML is a very flexible and complex structured language. I don't have the time (nor the inclination) to create a parser for it, since it already exists. More info on the structure of XML can be found here: http://www.w3schools.com/xml/default.asp
    Reading the XML file will not do, because the file might be a webpage, so I also need to be able to open it using an URL.

  • : : : : I want to read an strict XML file including the <?xml> tag into a Delphi program. For this I use the TDOMDocument as imported from the msxml.dll library. I can currently access everything except the information in the <?xml> tag.
    : : : : I previously tried the IXMLDOMDocumentType and searched through the members of alle the msxml objects in the MSDN. Both yielded no results.
    : : : :
    : : : Quite strange... is that necessary to use TDOMDocument or IXMLDOMDocumentType? I don't anything about XML's...
    : : :
    : : : **************
    : : : Any questions? Just ask!
    : : :
    : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : :
    : : :
    : : :
    : : I was just trying to point that if both yielded no results, maybe not these two are the correct to use for reading the ?xml> section. Maybe you should use simple AssignFile and the others to read the data inside it, and then interpret it somehow. (Further info about XML would help me helping you.) :-)
    : :
    : : ****************
    : : Any questions? Just ask!
    : :
    : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : :
    : :
    : :
    : XML is a very flexible and complex structured language. I don't have the time (nor the inclination) to create a parser for it, since it already exists. More info on the structure of XML can be found here: http://www.w3schools.com/xml/default.asp
    :
    Wow! Trying your link... XML is quite cool. Maybe I will learn it...

    That's it then. If you don't have time to create a parser, then forget it. Here's one suggestion: Use the TDomDocument, and run trough the file with the AssignFile and its "friends" on the file, search for a ?xml tag, and then retrieve the info(maybe by using your fine StringSplit proc). This may fit in your time.

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • [b][red]This message was edited by zibadian at 2005-4-8 12:30:52[/red][/b][hr]
    [b][red]This message was edited by zibadian at 2005-4-8 12:30:20[/red][/b][hr]
    : : : : : I want to read an strict XML file including the <?xml> tag into a Delphi program. For this I use the TDOMDocument as imported from the msxml.dll library. I can currently access everything except the information in the <?xml> tag.
    : : : : : I previously tried the IXMLDOMDocumentType and searched through the members of alle the msxml objects in the MSDN. Both yielded no results.
    : : : : :
    : : : : Quite strange... is that necessary to use TDOMDocument or IXMLDOMDocumentType? I don't anything about XML's...
    : : : :
    : : : : **************
    : : : : Any questions? Just ask!
    : : : :
    : : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : : :
    : : : :
    : : : :
    : : : I was just trying to point that if both yielded no results, maybe not these two are the correct to use for reading the ?xml> section. Maybe you should use simple AssignFile and the others to read the data inside it, and then interpret it somehow. (Further info about XML would help me helping you.) :-)
    : : :
    : : : ****************
    : : : Any questions? Just ask!
    : : :
    : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : :
    : : :
    : : :
    : : XML is a very flexible and complex structured language. I don't have the time (nor the inclination) to create a parser for it, since it already exists. More info on the structure of XML can be found here: http://www.w3schools.com/xml/default.asp
    : :
    : Wow! Trying your link... XML is quite cool. Maybe I will learn it...
    :
    : That's it then. If you don't have time to create a parser, then forget it. Here's one suggestion: Use the TDomDocument, and run trough the file with the AssignFile and its "friends" on the file, search for a ?xml tag, and then retrieve the info(maybe by using your fine StringSplit proc). This may fit in your time.
    :
    : ****************
    : Any questions? Just ask!
    :
    : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    :
    :
    :
    The TDomDocument does slightly more than just parse the XML file, it can also validate it using a DTD, maintain the XML structure, download XML (and DTD) files from the net (both asynchronously and synchronously). As I already know that the TDOMDocument must parse the <?XML?> tag (invalid version number error for one), it also must store that info somewhere. And because the TDomDocument is poorly documented, hence my question.
    Since I need to validate certain XML documents (numbering in the 100s) and extract information from, replace or delete certain nodes in a real-time situation, the program needs to be speed-optimalized. I cannot permit a pre-parser to search the file one for a single value which is already recorded somewhere in the TDomDocument structure. AssignFile() cannot be used, because the files are never stored on disk.
    So if you have another "helpful" suggestion, please feel free to post it.
    On a side note: information about the DomDocument and IXMLDOMDocument can be found at http://msdn.microsoft.com.


  • Does that ?xml? tag exist in EVERY XML file? Maybe that is the reason for the problem.

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • : Does that ?xml? tag exist in EVERY XML file? Maybe that is the reason for the problem.
    :
    : ****************
    : Any questions? Just ask!
    :
    : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    :
    :
    :
    The <?xml?> tag must exists in every xml file, because it provides the details on the xml-version and encoding, which is necessary for the parsing of the file.
  • : : Does that ?xml? tag exist in EVERY XML file? Maybe that is the reason for the problem.
    : :
    : : ****************
    : : Any questions? Just ask!
    : :
    : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : :
    : :
    : :
    : The <?xml?> tag must exists in every xml file, because it provides the details on the xml-version and encoding, which is necessary for the parsing of the file.
    :
    I really don't know why does not TDOMDocument parse ?xml... I have only one last suggestion left what maybe will work, but it won't be the fastest... maybe this is the fastest solution with TDOMDocument: Download the XML file, and then use AssignFile to run through it and search for the ?xml tag, then retrieve the data.

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • : : : Does that ?xml? tag exist in EVERY XML file? Maybe that is the reason for the problem.
    : : :
    : : : ****************
    : : : Any questions? Just ask!
    : : :
    : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : :
    : : :
    : : :
    : : The <?xml?> tag must exists in every xml file, because it provides the details on the xml-version and encoding, which is necessary for the parsing of the file.
    : :
    : I really don't know why does not TDOMDocument parse ?xml... I have only one last suggestion left what maybe will work, but it won't be the fastest... maybe this is the fastest solution with TDOMDocument: Download the XML file, and then use AssignFile to run through it and search for the ?xml tag, then retrieve the data.
    :
    : ****************
    : Any questions? Just ask!
    :
    : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    :
    :
    :
    The TDomDocument does parse the <?xml?> tag, because if I enter an invalid version number I get an error. The question is simply in which property does it store it?
  • : : : : Does that ?xml? tag exist in EVERY XML file? Maybe that is the reason for the problem.
    : : : :
    : : : : ****************
    : : : : Any questions? Just ask!
    : : : :
    : : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : : :
    : : : :
    : : : :
    : : : The <?xml?> tag must exists in every xml file, because it provides the details on the xml-version and encoding, which is necessary for the parsing of the file.
    : : :
    : : I really don't know why does not TDOMDocument parse ?xml... I have only one last suggestion left what maybe will work, but it won't be the fastest... maybe this is the fastest solution with TDOMDocument: Download the XML file, and then use AssignFile to run through it and search for the ?xml tag, then retrieve the data.
    : :
    : : ****************
    : : Any questions? Just ask!
    : :
    : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : :
    : :
    : :
    : The TDomDocument does parse the <?xml?> tag, because if I enter an invalid version number I get an error. The question is simply in which property does it store it?
    :
    That makes it much clear. Looking around the site, I've found some info:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcexmldm/html/cerefxmlproperty.asp

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories