XmlReader Parsing XML with DTD

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

XmlReader Parsing XML with DTD

Jonathan Overholser

Will the XmlReader parse XML that contains a Document Type Declaration in the file.  I’m attempting to use the parser and my call to DOMDocument::getDocumentElement returns a NULL root element.

 

Thanks,

 

Jon W. Overholser

Ball Aerospace & Technologies Corp.

Phone: (937) 320-6055

Fax: (937) 429-1687

Email: [hidden email]

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: XmlReader Parsing XML with DTD

Kip Streithorst
Administrator

I just tried adding a document type declaration to an existing .gcp file (ie. xml based file) and once I do that I’m seeing the same thing.  I’m going to tweak some settings inside XmlReader to see if I can track it down quickly.  You can go ahead and report that.

 

Thanks,

Kip

 


From: Overholser, Jonathan [mailto:[hidden email]]
Sent: Friday, April 04, 2008 2:12 PM
To: [hidden email]
Subject: XmlReader Parsing XML with DTD

 

Will the XmlReader parse XML that contains a Document Type Declaration in the file.  I’m attempting to use the parser and my call to DOMDocument::getDocumentElement returns a NULL root element.

 

Thanks,

 

Jon W. Overholser

Ball Aerospace & Technologies Corp.

Phone: (937) 320-6055

Fax: (937) 429-1687

Email: [hidden email]

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: XmlReader Parsing XML with DTD

Kip Streithorst
Administrator
In reply to this post by Jonathan Overholser
I'm spent some time investigating and I'm still not sure why it isn't working.  In case you want to look into it more, I've tried the following:

I created a modified gcp file that has an in-line DTD that I have validated using an on-line, here is the file:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE GcpList [
  <!ELEMENT GcpList ANY>
  <!ATTLIST GcpList name CDATA #REQUIRED type CDATA #REQUIRED version CDATA #REQUIRED xmlns CDATA #REQUIRED>
  <!ELEMENT DataDescriptor ANY>
  <!ATTLIST DataDescriptor name CDATA #REQUIRED processingLocation CDATA #REQUIRED type CDATA #REQUIRED version CDATA #REQUIRED>
  <!ELEMENT classification EMPTY>
  <!ATTLIST classification level CDATA #REQUIRED version CDATA #REQUIRED>
  <!ELEMENT metadata EMPTY>
  <!ATTLIST metadata version CDATA #REQUIRED>
  <!ELEMENT gcpPoint ANY>
  <!ELEMENT pixel ANY>
  <!ELEMENT coordinate ANY>
  <!ELEMENT rmsError ANY>
]>
<GcpList name="Corner Coordinates" type="GcpList" version="3">

  <DataDescriptor name="Corner Coordinates" processingLocation="inMemory" type="GcpList" version="3">
    <classification level="U" version="3"/>
    <metadata version="3"/>
  </DataDescriptor>

  <gcpPoint>
    <pixel>0 0</pixel>
    <coordinate>44.2833333346 -107.783333329</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

  <gcpPoint>
    <pixel>0 511</pixel>
    <coordinate>44.1523691043 -107.777166232</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

  <gcpPoint>
    <pixel>511 0</pixel>
    <coordinate>44.287633476 -107.60101455</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

  <gcpPoint>
    <pixel>511 511</pixel>
    <coordinate>44.1566497565 -107.595250275</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

  <gcpPoint>
    <pixel>255.5 255.5</pixel>
    <coordinate>44.2201570873 -107.689375131</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

</GcpList>

I have also tried modifying the XmlReader constructor to set these two features:

   mpParser->setFeature(X("http://apache.org/xml/features/validation/schema/skip-dtd-validation"), true);
   mpParser->setFeature(X("http://apache.org/xml/features/validation/ignoreCachedDTD"), true);

So far that hasn't worked.  My only other idea would be to fiddle with the http://apache.org/xml/properties/scannerName feature or to try disabling use of XQilla when we create our parser.  It could be that XQilla which allows us to traverse the document using XPath doesn't support an internal DTD.  Happy hunting.

Thanks,
Kip

________________________________________
From: Streithorst, Kip
Sent: Friday, April 04, 2008 3:00 PM
To: '[hidden email]'
Subject: RE: XmlReader Parsing XML with DTD

I just tried adding a document type declaration to an existing .gcp file (ie. xml based file) and once I do that I'm seeing the same thing.  I'm going to tweak some settings inside XmlReader to see if I can track it down quickly.  You can go ahead and report that.

Thanks,
Kip

________________________________________
From: Overholser, Jonathan [mailto:[hidden email]]
Sent: Friday, April 04, 2008 2:12 PM
To: [hidden email]
Subject: XmlReader Parsing XML with DTD

Will the XmlReader parse XML that contains a Document Type Declaration in the file.  I'm attempting to use the parser and my call to DOMDocument::getDocumentElement returns a NULL root element.
 
Thanks,
 
Jon W. Overholser
Ball Aerospace & Technologies Corp.
Phone: (937) 320-6055
Fax: (937) 429-1687
Email: [hidden email]
 



This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: RE: XmlReader Parsing XML with DTD

Jonathan Overholser
Thanks,

I'm using a different a different library that wraps Xerces and it seems to be working fine.


Jon W. Overholser
Ball Aerospace & Technologies Corp.
Phone: (937) 320-6055
Fax: (937) 429-1687
Email: [hidden email]
 
-----Original Message-----
From: Streithorst, Kip [mailto:[hidden email]]
Sent: Friday, April 04, 2008 4:13 PM
To: [hidden email]
Subject: RE: XmlReader Parsing XML with DTD

I'm spent some time investigating and I'm still not sure why it isn't working.  In case you want to look into it more, I've tried the following:

I created a modified gcp file that has an in-line DTD that I have validated using an on-line, here is the file:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE GcpList [
  <!ELEMENT GcpList ANY>
  <!ATTLIST GcpList name CDATA #REQUIRED type CDATA #REQUIRED version CDATA #REQUIRED xmlns CDATA #REQUIRED>
  <!ELEMENT DataDescriptor ANY>
  <!ATTLIST DataDescriptor name CDATA #REQUIRED processingLocation CDATA #REQUIRED type CDATA #REQUIRED version CDATA #REQUIRED>
  <!ELEMENT classification EMPTY>
  <!ATTLIST classification level CDATA #REQUIRED version CDATA #REQUIRED>
  <!ELEMENT metadata EMPTY>
  <!ATTLIST metadata version CDATA #REQUIRED>
  <!ELEMENT gcpPoint ANY>
  <!ELEMENT pixel ANY>
  <!ELEMENT coordinate ANY>
  <!ELEMENT rmsError ANY>
]>
<GcpList name="Corner Coordinates" type="GcpList" version="3">

  <DataDescriptor name="Corner Coordinates" processingLocation="inMemory" type="GcpList" version="3">
    <classification level="U" version="3"/>
    <metadata version="3"/>
  </DataDescriptor>

  <gcpPoint>
    <pixel>0 0</pixel>
    <coordinate>44.2833333346 -107.783333329</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

  <gcpPoint>
    <pixel>0 511</pixel>
    <coordinate>44.1523691043 -107.777166232</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

  <gcpPoint>
    <pixel>511 0</pixel>
    <coordinate>44.287633476 -107.60101455</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

  <gcpPoint>
    <pixel>511 511</pixel>
    <coordinate>44.1566497565 -107.595250275</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

  <gcpPoint>
    <pixel>255.5 255.5</pixel>
    <coordinate>44.2201570873 -107.689375131</coordinate>
    <rmsError>0 0</rmsError>
  </gcpPoint>

</GcpList>

I have also tried modifying the XmlReader constructor to set these two features:

   mpParser->setFeature(X("http://apache.org/xml/features/validation/schema/skip-dtd-validation"), true);
   mpParser->setFeature(X("http://apache.org/xml/features/validation/ignoreCachedDTD"), true);

So far that hasn't worked.  My only other idea would be to fiddle with the http://apache.org/xml/properties/scannerName feature or to try disabling use of XQilla when we create our parser.  It could be that XQilla which allows us to traverse the document using XPath doesn't support an internal DTD.  Happy hunting.

Thanks,
Kip

________________________________________
From: Streithorst, Kip
Sent: Friday, April 04, 2008 3:00 PM
To: '[hidden email]'
Subject: RE: XmlReader Parsing XML with DTD

I just tried adding a document type declaration to an existing .gcp file (ie. xml based file) and once I do that I'm seeing the same thing.  I'm going to tweak some settings inside XmlReader to see if I can track it down quickly.  You can go ahead and report that.

Thanks,
Kip

________________________________________
From: Overholser, Jonathan [mailto:[hidden email]]
Sent: Friday, April 04, 2008 2:12 PM
To: [hidden email]
Subject: XmlReader Parsing XML with DTD

Will the XmlReader parse XML that contains a Document Type Declaration in the file.  I'm attempting to use the parser and my call to DOMDocument::getDocumentElement returns a NULL root element.
 
Thanks,
 
Jon W. Overholser
Ball Aerospace & Technologies Corp.
Phone: (937) 320-6055
Fax: (937) 429-1687
Email: [hidden email]
 



This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]




This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]